Closed mauvilsa closed 3 years ago
Well, the entire pep517.meta
module is going to be removed to some point in the future (see #91).
To answer the underlying question though -- No. There is no "official" approach to getting the metadata/package dependencies of a package without building. The closest to that is using the equivalent of pep517.meta.load
which does run the metadata generation step, which (depending on how the package is written) can trigger a full build.
@pradyunsg thanks for the answer. But then a followup question would be, should there be an official way? For example should this be added to python-build?
Well, the entire pep517.meta module is going to be removed to some point in the future (see #91).
I don't see pep517.meta mentioned as scheduled for removal
We should probably mention it specifically in the README, but everything which relies on creating a build environment and installing dependencies is deprecated in this project, because those are fairly complex things which this package has never really done a good job of.
The build package does offer an API besides just CI and solves:
creating a build environment and installing dependencies
So I guess we could add support for this, if @FFY00, @layday, @pganssle (other maintainers besides me) agree. I'm personally +1 on a such proposal.
get package dependencies without building
I'm happy to fallback to building if the build-system doesn't provide the metadata - eg like how pep517.meta.load
currently works
Would this require anything other than exposing prepare_metadata_for_build_wheel
in build
? I thought we were already planning on doing that: https://github.com/pypa/build/issues/130. As I understand it, there's not really any other way to pull out runtime dependencies other than to generate dist-info
or to build a wheel if the former's not supported by the backend.
PEP 621 is being discussed to add a standardized dependencies table in pyproject.toml.
That's advisory and non required metadata. It can be a shortcut to finding some information without the need of the build backend but will never be mandated, frontends can decide not to support it, and users can always opt-out of it via the dynamic tag. The only universal way of getting package metadata remains PEP-517.
Would this require anything other than exposing prepare_metadata_for_build_wheel in build?
Yep I currently use pep517.meta.load and now understand that it's pending deprecation. Could you hold off on the deprecation until an upgrade path is available?
Ah right, you'd like a wrapper that automates calling prepare_metadata_for_build_wheel
/build_wheel
and pipes the output into importlib.metadata
. I think this is something worth transposing from pep517.
For example should this be added to python-build?
Yes. And as @gaborbernat noted, it's quite likely that the maintainers of that project would be up for that! :)
I have created an issue in build https://github.com/pypa/build/issues/181 to request this feature as @gaborbernat suggested.
There are cases in which it is needed to get the requirements of a package without having to build it, see for example github's dependabot #2281. Is using
pep517.meta.load
the recommended way to do this?