Towards a minimal-dependency install#1871
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a minimal dependency verification script and updates various tests and modules to lazily import optional dependencies (such as quimb, galois, fxpmath, pennylane, and pydot) or gracefully skip tests when they are not installed. Key feedback points out that using pytest.skip inside test_gate_with_registers when quimb is missing will prematurely skip subsequent assertions, and suggests catching ModuleNotFoundError instead. Additionally, it is recommended to add pennylane to the optional packages verification list and to specify stacklevel=2 when raising warnings in qualtran/drawing/init.py to improve warning traceability.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
mpharrigan
added a commit
that referenced
this pull request
Jun 17, 2026
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is an initial step towards carving out a core of functionality that doesn't need niche dependencies. This adds a new CI check that runs tests in
qualtran/_infraandqualtran/dtypewith only a small set of dependencies.This is accomplished with pytest
importorskips and local imports in the library for "optional" functionality.The heaviest "minimal" dependency is of course Cirq, which is technically challenging to make optimal since
GateWithRegistersinherits fromcirq.Gatewhich needscirq.Gateat the global/module level.