Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the official way to get package dependencies without building? #100

Closed
mauvilsa opened this issue Nov 3, 2020 · 13 comments
Closed

Comments

@mauvilsa
Copy link

mauvilsa commented Nov 3, 2020

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?

@pradyunsg
Copy link
Member

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.

@mauvilsa mauvilsa changed the title Official way to get package dependencies without building What is the official way to get package dependencies without building? Nov 3, 2020
@mauvilsa
Copy link
Author

mauvilsa commented Nov 3, 2020

@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?

@graingert
Copy link
Contributor

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

@takluyver
Copy link
Member

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.

@gaborbernat
Copy link

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.

@graingert
Copy link
Contributor

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

@layday
Copy link
Member

layday commented Nov 3, 2020

Would this require anything other than exposing prepare_metadata_for_build_wheel in build? I thought we were already planning on doing that: pypa/build#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.

@merwok
Copy link

merwok commented Nov 3, 2020

PEP 621 is being discussed to add a standardized dependencies table in pyproject.toml.

@gaborbernat
Copy link

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.

@graingert
Copy link
Contributor

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?

@layday
Copy link
Member

layday commented Nov 3, 2020

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.

@pradyunsg
Copy link
Member

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! :)

@mauvilsa
Copy link
Author

mauvilsa commented Nov 4, 2020

I have created an issue in build pypa/build#181 to request this feature as @gaborbernat suggested.

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

No branches or pull requests

7 participants