meson-python
meson-python copied to clipboard
ENH: add support for dynamic dependencies computation
When dependencies
is specified as a dynamic field in the [project]
section in pyproject.toml, the dependencies reported for the sdist are copied from the dependencies
field in the [tool.meson-python]
section. More importantly, the dependencies reported for the wheels are computed combining this field and the "build-time-pins" field in the same section completed with the build time version information.
The dependencies
and build-time-pins
fields in the [tool.meson-python]
section accept the standard metadata
dependencies syntax as specified in PEP 440. The build-time-pins
field cannot contain markers or extras but it is expanded as a format string where the v
variable is bound to the version of the package to which the dependency requirements applies present at the time of the build parsed as a packaging.version.Version object.
This is based on #304 to incorporate the metadata handling simplification introduced there.
This ass a dependency on importlib_metatada
for Python 3.7. In principle it could be made conditional to the use of build-time-pins
but I don't think it is worth the trouble. It also adds a dependency on packaging
, but it is already a transitive dependency of meson-python via the pyproject_metadata
dependency.
I just wanted to experiment with how this would look like in practice. Working on this made me realize that I didn't completely understand the problem.
Matching version with more than three components is an easy fix. Added. You can use {v.major}.{v.minor}.{v.micro}.{v[3]}.{v[4]}
. It is not pretty, but that's what you get for using crazy version numbers.
I converted the PR to draft while we wait for a resolution in #29, so that the state of PR log is easier to understand. @dnicolodi I hope that is okay.
Once we get a decision on the issue, we can go ahead with a proper review and merge of this PR :)