Skip to content

Importable bloq manifest#1875

Merged
mpharrigan merged 32 commits into
quantumlib:mainfrom
mpharrigan:2026-06/mindep2
Jun 17, 2026
Merged

Importable bloq manifest#1875
mpharrigan merged 32 commits into
quantumlib:mainfrom
mpharrigan:2026-06/mindep2

Conversation

@mpharrigan

Copy link
Copy Markdown
Collaborator

Another step forwards in having programmatic access to importing bloqs.

In an earlier PR we added the "bloq manifest", which is in bloqs/manifest.py and defines two static lists of strings (essentially). The first is a list of all the bloq class names (fully qualified). The bloq classes report their canonical import path with our _pkg_ class method, which defaults to one level up from the leaf module the class is defined in. This presumes that we "re-export" our classes one level up. This PR adds a check that the bloq class names from the manifest actually are importable and fixes the failures by re-exporting the import to an __init__.py or by overriding _pkg_ to make it a "local" bloq.

The test also compliments the "minimal install" test from #1871 by asserting that everything is at least importable without heavy dependencies except for specific subpackages (galois bloqs need the galois package is the main one)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request makes galois an optional dependency by moving its imports to TYPE_CHECKING blocks and using string annotations. It exposes numerous bloq classes in package __init__.py files, updates the manifest list (BLOQ_CLASS_NAMES and BLOQ_EXAMPLE_OBJECTSTRINGS) to include and enable many previously commented-out bloq examples, and adds a new test (manifest_test.py) to ensure all manifest classes can be imported with minimal dependencies. Additionally, several classes now implement the _pkg_ classmethod to correctly resolve their package names. I have no feedback to provide as there are no review comments.

@mpharrigan mpharrigan merged commit afedf49 into quantumlib:main Jun 17, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant