Skip to content

Keep the dependency specs consistent with the conda recipe - #747

Merged
xylar merged 5 commits into
MPAS-Dev:masterfrom
xylar:fix-numpy-scipy-constraints
Aug 19, 2026
Merged

Keep the dependency specs consistent with the conda recipe#747
xylar merged 5 commits into
MPAS-Dev:masterfrom
xylar:fix-numpy-scipy-constraints

Conversation

@xylar

@xylar xylar commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

mpas_tools describes its dependencies in four places — recipe/recipe.yaml, pyproject.toml, dev-spec.txt and pixi.toml — and they had quietly drifted apart. This PR fixes the discrepancies and adds a test so they cannot drift again.

Fixes

recipe/recipe.yaml is treated as the source of truth for the run requirements:

  • pyproject.toml was missing the >=2.0,<3.0 constraint on numpy and the !=0.20.0 constraint on scikit-image
  • pyproject.toml was missing h5py entirely, even though it is imported by mpas_tools.viz.mpas_to_xdmf.io and is available on PyPI
  • pyproject.toml, dev-spec.txt and pixi.toml were all missing the >=0.10.0 constraint on (python-)igraph
  • dev-spec.txt still asked for geometric_features >=1.0.1 rather than >=1.6.3
  • dev-spec.txt and pixi.toml still asked for python >=3.10 while requires-python in pyproject.toml is >=3.11
  • recipe/recipe.yaml now skips building for python <3.11, matching requires-python and the conda-forge feedstock

New test

conda_package/tests/test_dependencies.py checks that every run requirement of the conda recipe appears with the same version constraints in the other three files. dev-spec.txt and pixi.toml may still list extra packages for development, testing and building the documentation, but pyproject.toml is also checked in the reverse direction so that it cannot list a package the recipe is missing.

A few details worth noting:

  • Package names are normalized following PEP 503, with a small table for the conda-forge names that differ from their PyPI equivalents (matplotlib-basematplotlib, python-igraphigraph).
  • geometric_features and nco are not on PyPI, so they are skipped for pyproject.toml only.
  • Version constraints are compared as unordered sets of clauses, so ordering and spacing do not matter.
  • Python is checked against requires-python from pyproject.toml rather than the recipe, since the recipe deliberately leaves python unconstrained and lets conda pin it to the version being built. A constraint in the recipe is still checked if one is ever added.
  • The tests skip when the spec files are absent, which is the case when the test suite runs during a conda build.

The test imports yaml, so pyyaml was added as a development dependency rather than relying on it arriving transitively via pre-commit.

xylar and others added 5 commits August 19, 2026 17:10
We were missing constraints on numpy and scikit-image that are
in dev-spec.txt and recipe.yaml
The run requirements in recipe/recipe.yaml are the source of truth but
several of them had drifted in the other dependency specs:

* pyproject.toml was missing h5py, which is imported by
  mpas_tools.viz.mpas_to_xdmf.io and is available on PyPI
* pyproject.toml, dev-spec.txt and pixi.toml were all missing the
  >=0.10.0 constraint on (python-)igraph
* dev-spec.txt still had geometric_features >=1.0.1 rather than >=1.6.3

Also add pyyaml as a development dependency, needed to parse the conda
recipe in the test added in the following commit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Treat the run requirements in recipe/recipe.yaml as the source of truth
and check that each of them shows up with the same version constraints
in pyproject.toml (for those available on PyPI), dev-spec.txt and
pixi.toml.  The latter two are still allowed to list extra packages for
development, testing and building the documentation, but pyproject.toml
is also checked in the reverse direction so that it cannot drift ahead
of the recipe.

Version constraints are compared as unordered sets of clauses so that
ordering and spacing do not matter, and a small table maps the few
conda-forge names that differ from their PyPI equivalents.  The tests
skip when the spec files are absent, as is the case when the test suite
runs during a conda build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dev-spec.txt and pixi.toml still asked for python >=3.10 while
"requires-python" in pyproject.toml is >=3.11.

Also check python in the dependency consistency tests.  Since the conda
recipe deliberately leaves python unconstrained, letting conda pin it to
the version being built, "requires-python" from pyproject.toml is used
as the source of truth for python rather than recipe/recipe.yaml.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This matches "requires-python" in pyproject.toml and the skip line in
the conda-forge feedstock.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@xylar xylar added bug dependencies Pull requests that update a dependency file labels Aug 19, 2026
@xylar xylar self-assigned this Aug 19, 2026
@xylar
xylar merged commit 5febf98 into MPAS-Dev:master Aug 19, 2026
5 checks passed
@xylar
xylar deleted the fix-numpy-scipy-constraints branch August 19, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant