Fix dependencies - #125
Merged
Merged
Fix dependencies#125
Conversation
t-reents
force-pushed
the
fix/bare-install
branch
from
September 25, 2026 10:33
6bbc4fa to
f68f13b
Compare
`scipy` is an optional dependency, installed with the `bz` extra, and only the Brillouin zone code needs it. Up to `v2.1.0`, `import seekpath` did not load that code, so a plain `pip install seekpath` was enough to compute paths. Since cffa9d5 (materialscloud-org#102), `seekpath/__init__.py` imports it eagerly to make `seekpath.brillouinzone` available without a separate import, so in `v2.2.0` and `v2.2.1` `import seekpath` itself fails with `ModuleNotFoundError: No module named 'scipy'` unless the extra is installed. Here we keep `seekpath.brillouinzone` available, but import it on first access through a module-level `__getattr__`, so `import seekpath` no longer needs `scipy`. Without `scipy`, accessing the subpackage raises an `ImportError` that points to `pip install seekpath[bz]`. The `__getattr__` uses `importlib.import_module` rather than `from . import brillouinzone`, which checks the attribute with `hasattr` and would recurse into `__getattr__`.
The `spglib` version check in `seekpath/hpkot/tools.py` imports `packaging.version.Version` since d910bb3 (materialscloud-org#107), but `packaging` was never added to the dependencies in `pyproject.toml`.
t-reents
force-pushed
the
fix/bare-install
branch
from
September 25, 2026 10:41
1877422 to
2e7698e
Compare
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.
No description provided.