Declare numpy runtime dependency#71
Merged
Merged
Conversation
724aaca to
c97817e
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.
Summary
numpyas a runtime dependency inpyproject.toml.pixi.lockso locked CI installs stay consistent.Motivation
MHR imports NumPy at runtime in
mhr/io.pyandmhr/mhr.py, for example fornp.ndarraydata handling andnp.load(...)when loading blendshape and corrective activation data. However, the wheel metadata currently only declarestorchandtrimesh, so a clean install can installmhrwithout NumPy even though importing and using the package requires it.This also forces downstream packagers, such as the conda-forge feedstock, to carry a patch that adds
numpyto the generated package metadata. Declaring the dependency upstream keeps PyPI/wheel metadata accurate and lets downstream packaging drop that patch after the next release.The ideal downstream end state is to remove
recipe/pyproject-runtime-deps.patchfrom conda-forge entirely once a release includes this metadata fix. The patch still has to stay for the already-published1.0.1artifact because that source distribution is immutable.Relevant links
mhr/io.py:MHR/mhr/io.py
Line 19 in c97817e
mhr/mhr.py:MHR/mhr/mhr.py
Line 21 in c97817e
np.load(...)usage for runtime data loading:MHR/mhr/mhr.py
Line 108 in c97817e
Details
This is a package metadata-only change. NumPy is already present in the development/test environment through other dependencies, but it should be declared directly because MHR itself imports it. The lockfile change is intentionally minimal: it adds
numpyto the editablemhrpackage metadata without converting the lockfile format.Test plan
pixi run wheel-buildunzip -p dist/*.whl "*/METADATA" | rg -n "^Requires-Dist: "pixi install -e py312 --lockedpixi install -e py313 --lockedpixi run -e py312 testpixi run -e py313 test