-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Default to isolated, pyproject.toml-based builds #9175
Comments
This sounds like a good idea to me. I think PEP 517 has been around long enough to make this a reasonable change. One thought I had was whether we needed a deprecation period here. But we're not actually deprecating anything, just changing the default, so I don't think we necessarily need one. It is an incompatible change, so some might argue otherwise, though. |
I'm not actually sure what a deprecation period would look like for something like this. We don't have a good way to message this I think, if we just message on any thing that might break with the new default we're going to produce a lot of false positives/noise. The only thing I could think of is implement an intermediate state where we switch to something like I don't personally feel like that's a high value win, since I think a lot of the subtle issues have gotten worked out now, and I think that I do think it would be worthwhile to wait until next year for this change, I think 20.3 is close enough now that sneaking it in would be counterproductive AND I think the new resolver is a big enough change on it's own that this change would only muddy the waters. |
Given that we currently have a fairly non-trivial performance penalty to using PEP 517, I'm very much a -1 to making this switch without trying to address them. Thinking a bit more, there's also the issue of poor end-user control over isolated environments (our isolation also has bugs, but I'm too tired to locate them right now). Unless we address these two concerns, I expect this to cause more churn than our original PEP 517 rollout. I'd consider things like #7294, #9081 to be essential pre-requisites for this -- overall, I feel like there's a lot of need for improvements to PEP 517's quality-of-implementation based on all the things we've learned and the changes in pip, since the original implementation. It'd be a good thing if we can make it so that this doesn't make pip's own test suite slower. :) |
That said, I'm very very on board to actually figuring out what all do we consider as critical path to doing this. |
This is probably true (it hadn't occurred to me because I tend to think of build isolation as a separate thing, because it was introduced with PEP 518 support, not with PEP 517). Is anyone planning to work on those two issues? They are both marked as "needs discussion", and I'd be very keen on not having the path to making PEP 517 the default blocked by proposals we can't decide on. |
I think the discussion needed on those two, at least, is how the implementation looks and not whether we wanna do them. |
As maintainer of Setuptools, I've been trying to wean myself off of environments where setuptools is installed. I've been using |
I've mentioned this issue in https://discuss.python.org/t/pip-without-setuptools-could-the-experience-be-improved/11810 -- my idea is that pip might want to default to |
I found one case where |
This makes sense to me. And it could be a sensible way to move things forward as well since our current problem is blanket-defaulting to |
We "control" both those modes -- the reason that setuptools and virtualenv ship setuptools, is because pip depends on them. Once we default to PEP 517 workflows, we'll need to go around and remove setuptools from the default shipped packages as well. |
Yes, but the “problem” is that we are currently unable to come up with a scenario that not shipping setuptools is a good practical idea; even though we have a “long term goal” to remove it, it’s unclear how we can move closer to the goal. Those who are (still currently) publishing non-PEP-517 projects have little incentive to move to PEP 517 because every environment comes with setuptools and only packaging nerds contrieve weird scenarios where setuptools is unavailable, and we can’t make removing setuptools a less weird scenario because way too many packages are non-installable by default in this situation. It’s a circular dependency. By making |
That was always my intention when I first added |
Could you elaborate on how/why this would be the case? The only packages that wouldn't work are packages that are somehow incompatible with build-isolation. And they can use Everything else gets |
Note that "no longer be non-installable" = "will be installable". By using PEP 517, and consequently build isolation, projects that rely on Without PEP 517. projects that rely on setuptools will go down the legacy path and fail if setuptools isn't in the user's main environment. So if we stop shipping setuptools by default, those projects will fail to build. Making |
Heh, nvm me. I tripped on the double negative |
We're already set up to build with pyproject.toml based builds, when setuptools is not in the environment. Once we kill setup.py install and setup.py develop, we should be good to flip the switch on build isolation and pyproject.toml-based builds as well. |
Is there a place where the progress on this is tracked? Or is that place here? |
This comment was marked as off-topic.
This comment was marked as off-topic.
The flake8 issue isn't really relevant here. Whatever reasons the flake8 maintainers have for not reading config from But can we please avoid the Footnotes
|
That would be #8102. All issues and PRs towards that goal reference it. |
OK, since I keep stumbling upon this issue:
the individual steps are at the time of writing:
|
## Summary Our current setup uses the legacy `setup.py`-based builds if a `pyproject.toml` file isn't present. This matches pip's behavior. However, `pypa/build` uses PEP 517-based builds in such cases, and it looks like pip plans to make that the default (pypa/pip#9175), with the limiting factor being performance issues related to isolated builds. This is now the default behavior, but the `--legacy-setup-py` flag allows users to opt-in to using `setup.py` directly for distributions that lack a `pyproject.toml`.
If helpful: we use PEP 517 builds by default in uv. I've been tracking projects that fail to install with uv under PEP 517 build isolation, and similarly fail with pip under |
Is it possible to turn off build isolation for one line (or several specific lines) in requirements.txt? |
That is not possible at the moment. The documentation lists the 3 options that are allowed per requirement line. |
I'm curious, why does enabling build isolation by default depend on removing support for pip's fallback to When using build isolation with a
ie: Whilst deprecating Lastly, since pip already defaults to isolated build environments if either
Plus in the wider ecosystem:
As such, it seems like we're now finally at the point where we can make this change? (With of course a mention of |
Update on Oct 7 2022: Once
setup.py install
andsetup.py develop
code paths are killed, there is no reason for pip to use the legacy setup.py-based builds by default, other than to avoid the additional overhead of the creation of build environments.Currently if you try to
pip install
something that only is provided a "legacy" setuptools only sdist without apyproject.toml
, that will be installed using the "legacy" path unless you explicitly invoke--use-pep517
.This is particularly troublesome in cases where you don't have (or want to have) setuptools installed in the environment, since the legacy path depends on having setuptools preinstalled.
This flag does not affect editable installs in any way, and those still require having setuptools preinstalled in either case.
This seems like it would be a good stepping stone on the way to #6334, since it narrows the cases where we're using the legacy path to just editable installs.
The text was updated successfully, but these errors were encountered: