-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Don't install setup_requires when run as a PEP 517 backend #2303
Comments
Under PEP-517, installing build dependencies is up to the frontend. Closes pypagh-2303
I'm more inclined to simply deprecate |
Would there be any replacement way for a project to specify build requirements? We're specifically dealing with an optional build requirement - you can configure building with or without MPI integration - so we can't just put it in |
To clarify, I think I was saying that Conditional dependencies of any sort are the bane of dependency resolvers and that sort of thing, so I think the proper way to solve this is to add "feature flag" / "optional features" to the standards metadata, rather than to actually recommend that people have conditional dependencies in A possible compromise until we have a standards-based solution to the very common feature request of "optional" / "opportunistic" dependencies would be to deprecate the idea that It would be cleaner to add a new |
Actually, come to think of it, I can think of one valid use case (though maybe this should be a modification to the It might be worth adding in more explicit ways to list which dependencies apply to which step of the process. |
Aha, sorry, I had over-optimistically read the thread as "setuptools supports this through the In our case, we have a fairly clear "normal" build (without MPI), and I expect the people building it with MPI support to be prepared to cope with packaging oddities that might come up. We've had this optional feature for years already, and we're trying to adapt it to a world with PEPs 518 & 517. So my interest in |
Could you instead split out the behavior into two packages, one with the core support and another with the supplementary MPI support? Then the user could conditionally install just core or core + mpi (perhaps using extras as |
It may be possible - I don't know enough about MPI to say so definitively. I'd expect it to be a fair bit of work, and probably introduce new bugs. It's certainly not something I want to tackle for the next release. Building two binary flavours from the same source code is a fairly familiar solution, and one that we're generally pretty happy with in h5py. Maybe we'll do our workaround for this for the next release, and then look at switching build system. |
PEP 517 separates the responsibilities around build requirements: the backend is responsible for saying what is required, and the frontend is responsible for ensuring they're available to the build.
In setuptools, build requirements are defined by
setup_requires
, and these get passed through to PEP 517'sget_requires_for_build_*
hooks. There is a monkeypatch to return them from these hooks and prevent setuptools trying to install them itself:setuptools/setuptools/build_meta.py
Lines 56 to 75 in 5e60dc5
But something similar to that - preventing installation - should really be in place for all the PEP 517 hooks, because a PEP 517 backend isn't responsible for installing dependencies.
Why does this matter? Pip has the
--no-build-isolation
option, with which the caller can declare that they have taken care of build dependencies and pip should try to build the package in the current environment. This is useful for downstream packagers, and for experimenting with different versions of your build dependencies. But setuptools doesn't know about this, so it charges ahead and attempts to install things when that's not what you want.The workaround I'm looking at is to only specify
setup_requires
if'egg_info' in sys.argv
, as is the case when theget_requires_for_build_*
hooks are called. But this is clearly not ideal.The text was updated successfully, but these errors were encountered: