Skip to content

ci(commit): add optional dependencies to the pixi environment - #2822

Open
jdhughes-dev wants to merge 3 commits into
modflowpy:developfrom
jdhughes-dev:ci-test-h5py
Open

ci(commit): add optional dependencies to the pixi environment#2822
jdhughes-dev wants to merge 3 commits into
modflowpy:developfrom
jdhughes-dev:ci-test-h5py

Conversation

@jdhughes-dev

@jdhughes-dev jdhughes-dev commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

The Test job runs in the MODFLOW 6 pixi environment and installs FloPy with --no-deps,
so none of the optional extras are present and every test guarded by requires_pkg() for
them is skipped on a pull request.

  • add h5py, pymetis, and scikit-learn to the pixi environment rather than installing them
    from pypi, so they are consistent with the libraries already there
  • h5py gates the node mapping save and load tests, pymetis and scikit-learn gate the metis
    splitting tests, none of which have run on a pull request
  • conda-forge builds pymetis for windows, which pypi does not, so those tests run on all
    three platforms

The test job runs in the MODFLOW 6 pixi environment and installs FloPy with
--no-deps, so none of the optional extras are present and every test guarded by
requires_pkg() for them is skipped. h5py gates the four node mapping save and load
tests, which have never run on a pull request.

pymetis and scikit-learn gate the remaining skipped tests and are left for a
follow-up.
@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.6%. Comparing base (556c088) to head (0c72e9c).
⚠️ Report is 211 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2822      +/-   ##
===========================================
+ Coverage     55.5%    73.6%   +18.0%     
===========================================
  Files          644      659      +15     
  Lines       124135   132188    +8053     
===========================================
+ Hits         68947    97321   +28374     
+ Misses       55188    34867   -20321     

see 585 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jdhughes-dev
jdhughes-dev removed the request for review from jlarsen-usgs August 23, 2026 05:56
The h5py and netcdf4 wheels each bundle their own HDF5 library, and on windows
the wrong one is loaded, so importing h5py fails with a DLL load error. The error
is an ImportError rather than a ModuleNotFoundError, which requires_pkg() does not
catch, so the whole of test_model_splitter.py failed to collect. Install h5py on
linux and macOS only.
@jdhughes-dev

Copy link
Copy Markdown
Contributor Author

Windows failed on the first attempt: the h5py and netcdf4 wheels each bundle their own
HDF5 library and windows loaded the wrong one, so import h5py raised

ImportError: DLL load failed while importing _errors: The specified procedure could not be found.

requires_pkg() only catches ModuleNotFoundError, so this propagated out of has_pkg() and
the whole of test_model_splitter.py failed to collect rather than skipping. Pushed 2dd000b to
install h5py on linux and macOS only.

Worth noting separately: modflow_devtools.misc.has_pkg() catching only ModuleNotFoundError in
try_import() means a package that is installed but broken takes down collection instead of
reporting as unavailable. Catching ImportError there would make it degrade the way the strict
check intends.

@wpbonelli wpbonelli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the windows failures are pypi/conda inconsistencies. the pixi env has hdf5 the library as a transitive conda dependency and then we install h5py from pypi.

Instead of tacking on pypi dependencies here we might as well just add these few to the mf6 pixi env, I think.

Installing h5py from pypi into an environment that already carries the HDF5
library from conda loaded the wrong library on windows, so add the optional
dependencies FloPy tests need with pixi instead. conda-forge builds pymetis for
windows, which pypi does not, so the metis tests run on all three platforms.
@jdhughes-dev jdhughes-dev changed the title ci(commit): install h5py for the test job ci(commit): add optional dependencies to the pixi environment Aug 23, 2026
@jdhughes-dev

Copy link
Copy Markdown
Contributor Author

Good call, that is the cause. Switched to pixi add h5py pymetis scikit-learn so they come from conda and match the HDF5 library already in the environment, and dropped the windows carve out. conda-forge also builds pymetis for windows where pypi does not, so the metis tests now run on all three platforms rather than being skipped.

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.

2 participants