Skip to content

[DRAFT] chore: move h5py from base deps to [benchmarks] extra#17

Draft
speckhard wants to merge 2 commits intoLeMaterial:mainfrom
speckhard:chore/h5py-to-extras
Draft

[DRAFT] chore: move h5py from base deps to [benchmarks] extra#17
speckhard wants to merge 2 commits intoLeMaterial:mainfrom
speckhard:chore/h5py-to-extras

Conversation

@speckhard
Copy link
Copy Markdown

@speckhard speckhard commented Apr 30, 2026

Summary

h5py>=3.10 was a runtime dep but only used by 2 comparison benchmark scripts under atompack-py/benchmarks/. Move to a new [benchmarks] extra so the base wheel doesn't pull ~50 MB of HDF5 binaries unnecessarily.

What changes

  • pyproject.tomlh5py>=3.10 moves from [project] dependencies to [project.optional-dependencies] benchmarks.
  • uv.lock — regenerated; h5py is still locked, just under the benchmarks extra now.
  • atompack-py/benchmarks/README.md — two stale claims about h5py being part of the base benchmark environment are updated to point users at pip install atompack-db[benchmarks].
  • Makefile py-test-benchmarks target — now passes --extra benchmarks alongside --extra dev so the benchmark suite continues to actually exercise h5py paths instead of silently skipping them.

Users running comparison benchmarks now install with:

pip install atompack-db[benchmarks]

Test plan

  • After resync, h5py absent from base dev env:
$ uv run python -c "import h5py"
ModuleNotFoundError: No module named 'h5py'
  • Full pytest suite green; h5py-gated tests skip cleanly via existing pytest.importorskip("h5py") calls:
$ uv run --extra dev --locked pytest tests/ -q
118 passed, 8 skipped in 2.15s
  • make py-test-benchmarks (now --extra dev --extra benchmarks) actually runs the h5py tests instead of skipping them — verified directly:
$ uv run --extra dev --extra benchmarks --locked pytest tests/benchmarks -q
52 passed, 4 skipped in 6.88s

Backward compat

  • Existing users running python atompack-py/benchmarks/atom_hdf5_soa.py without re-installing will see ImportError: No module named 'h5py'. They should pip install atompack-db[benchmarks].
  • Production users of the atompack Python package never imported h5py, so they're unaffected.
  • No on-disk format change. No API change.

Considered alternatives

  • Keep h5py in [dev]: rejected — most contributors don't run the HDF5 benchmark and shouldn't pay the install cost.
  • Have dev include benchmarks (nested extras): no precedent for nested extras in this repo. Just updated the Makefile target to pass both.

h5py is only imported by atompack-py/benchmarks/atom_hdf5_soa.py and
benchmarks/hdf5_tuned_experiment.py — comparison scripts, not the
package itself. Zero imports anywhere under python/atompack/ or
production code paths. Yet h5py was listed as a runtime dependency,
so every install of atompack-db pulled ~50 MB of HDF5 binaries that
were never used at import time.

Move h5py>=3.10 to a new [project.optional-dependencies] benchmarks
extra. Users who actually run the comparison benchmarks install with
'pip install atompack-db[benchmarks]'; everyone else gets a slimmer
wheel.

Tests under tests/benchmarks/ that exercise the comparison scripts
already use pytest.importorskip("h5py"), so they cleanly skip when
the extra isn't installed — no test failures from the move.

uv.lock regenerated to reflect the change. h5py is still locked, just
under the benchmarks extra now.
Independent reviewer caught two follow-ups for the h5py-to-extras PR:

- atompack-py/benchmarks/README.md still claimed h5py was "part of the
  default benchmark environment" and shipped "through the base project
  dependencies." Updated both lines to point users at
  'pip install atompack-db[benchmarks]'.

- Makefile py-test-benchmarks target only passed --extra dev. After
  moving h5py to [benchmarks], that meant 'make py-test-benchmarks'
  silently skipped every hdf5-gated test (defeating the target's
  purpose). Added --extra benchmarks alongside --extra dev so the
  benchmarks suite actually exercises h5py paths again.

Verified with a direct pytest run: 'uv run --extra dev --extra benchmarks
--locked pytest tests/benchmarks' now reports 52 passed, 4 skipped (vs.
the same command with only --extra dev which would have skipped all h5py
tests).
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