-
-
Notifications
You must be signed in to change notification settings - Fork 31.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
Enabled build-system isolation via pip. #13994
Conversation
eae5a1e
to
28044a6
Compare
For reference, using We should also update the reusable apps documentation - there was vaguely some discussion in #12006 too. |
Just to clarify: To the best of my knowledge pip always builds a wheel nowadays. I just made the minimal changes (that even keep setup.py) to enable build isolation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... have your opinions changed @carltongibson?
Hehe. Not really. 😜 I'm a bit Meh about this at best.
But if folks are keen, it's not something I want to plant a flag in the ground about, more that I don't really see the need (having understood it, and looked at the setuptools
alternatives).
When presented like this:
This is a good thing (tm) :D
Then what can I say? Sold! 😀
...the minimal changes...
From the linked docs:
Projects with a pyproject.toml file, but which don’t have a build-system section, will be assumed to have the following backend settings...
So I think an empty pyproject.toml would be minimal. 🤔
This (I think) is the source of my Meh: if we're just using setuptools, why declare it? Who exactly is in this imagined virtualenv that doesn't have a recent enough setuptools? Who's using this?
Last time, we declined the pyproject.toml because of the extra wheel building steps for sdist installations. #12013 (comment) — we hadn't managed to state — beyond "(tm)" — what were the benefits?
But, again, not something I'm stuck to. If you all feel that this is important to add then no problem…
Yes, but I thought it would not hurt to write it out explicitly, so the intentions are clear. Or we'd at least have to have a comment in it.
I do not have setuptools in my venv at all. Why should I install it? Django has no runtime dependency on it after all. The only thing I have is pip. Why should I put setuptools into my environment just to install Django -- after the install I can immediately remove it. FWIW it is not just about us doing
FWIW if people install the sdist nowdays (I did have to fetch it via the url, because
It does not clutter a minimal environment with dependencies that are not needed at runtime. In practice it also has the possibility to prevent conflicts with other packages in the environment (granted those are rather slim because everyone is afraid of setuptools anyways :D) -- I am not 100% sure, but probably also with broken setuptools entrypoints in the venv; I did had problems with those in the past.
Well it is not the end of the world if we don't include it. But why prevent people with a valid virtualenv from installing the Django .tar.gz? I wouldn't argue at all if it would not make any difference, but here we prevent an allowed/valid setup from working. |
We can do this in a separate PR.
I've changed my mind 🤷 Now I can see the benefits (pointed out by Florian). For example, installation of Django 3.1.6 crashed for me:
but it went smoothly with
|
28044a6
to
381e8c6
Compare
381e8c6
to
f8f35e8
Compare
For what it's worth, this broke django-cockroachdb's build at the step |
Thanks for the update Tim. I need to have a play to work out exactly what's going on, since we still have the minimal |
I can reproduce this locally adding the
|
Hmmm. This looks setup dependent.
@cjerdonek is more knowledgable here 😀 — are we missing something? Is there some comment we could add to guide people who get stuck? (Thanks!) |
Looking at the output of @timgraham
This is weird, why was it disabled? The rest is just a follow up. If user site-packages are disabled, then it will try to install globally which will fail due to permissions. But this should similarly fail for every other packages as well. |
This was what I noticed too. What output do you get from the following? $ python -m site
sys.path = [
'/home/nick',
'/usr/lib/python39.zip',
'/usr/lib/python3.9',
'/usr/lib/python3.9/lib-dynload',
'/home/nick/.local/lib/python3.9/site-packages',
'/usr/lib/python3.9/site-packages',
]
USER_BASE: '/home/nick/.local' (exists)
USER_SITE: '/home/nick/.local/lib/python3.9/site-packages' (exists)
ENABLE_USER_SITE: True You don't happen to have the
So if you see |
This is on Ubuntu 20.04.
|
In the description of pypa/pip#7953, you can see that pip sets |
Yes, yuck. And I managed to see the issue for myself with this reproducer. It seems that nobody is interested in fixing this because PEP 517 doesn't officially make provision for editable installs. It looks like there are two competing solutions in the works though, so hopefully in the next 6~12 months we'll have a blessed solution to this problem. In the meantime, it looks as though this only affects pypa/pip#9990 seems to imply that build isolation should be automatically disabled for editable installs, but, after a quick scan through the source, there is no logic that makes any decision about this other than the The three options open to us seem to be:
|
Thanks for those proposals, Nick. This discussion can continue on the ticket I created. |
This is described in https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support and enables build system isolation via PEP-517. In practice this means that pip will use an environment where it downloads setuptools and wheel first and as such will not conflict with whatever is active in the current python env. This is a good thing (tm) :D This now allows for installation in virtualenvs that do not have setuptools/wheel but only pip.
The new behavior (compare against master) of a pip install can be observed due to the following output:
if the loglevel is increased further one sees that pip now downloads setuptools & wheel.