Skip to content

Fix dependencies - #125

Merged
t-reents merged 2 commits into
materialscloud-org:mainfrom
t-reents:fix/bare-install
Sep 25, 2026
Merged

t-reents merged 2 commits into
materialscloud-org:mainfrom
t-reents:fix/bare-install

Conversation

@t-reents

Copy link
Copy Markdown
Collaborator

No description provided.

`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
t-reents merged commit 029b303 into materialscloud-org:main Sep 25, 2026
6 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