-
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
Fix editable-mode logic when pyproject.toml present #6370
Fix editable-mode logic when pyproject.toml present #6370
Conversation
6eb4b59
to
414c359
Compare
414c359
to
d021deb
Compare
d021deb
to
233a023
Compare
233a023
to
71f506e
Compare
Someone just reported as a new issue (#6375) the issue that this PR is meant to address. |
@pfmoore I'm hoping you can take a look at this PR at some point. I think it would be good to try to get it into the next release in some form so that we can head off people unwittingly trying to combine editable mode with PEP 517 behavior before it gets too ingrained and harder to change. I'm worried some people may already be doing this -- see e.g. the just-filed #6375, as well as the Poetry issue #6314 from before. This PR will also serve another important function by helping to educate people through the error message. Finally, the PR also unit tests pretty much all of the logical interactions between the various flags and error messages so we can encode that behavior and prevent regressions. |
If I understand correctly, then accepting the proposed solution here means:
I might be wrong, but to me that means, the only canonical way to specify build dependencies in such a project is the Regardless, even if it did install the specified build dependencies, some other tools like Pipenv, have no way to specify this option on a by-requirement bases. What I mean is that in a Pipenv Pipfile, there is no way to do something like:
Which effectively means, one cannot use those tools to develop projects with old-style I'm not at all sure if everything I wrote is correct and if the following is a good idea, but maybe, case 1.) should just display a warning instead of failing and the proceed with installing the build dependencies and not processing according to PEP517? Btw. education on PEP517/518 and the new canonical way of building, developing and installing python package is, from my user perspective, a bit scarce at the moment. So every little bit as soon as possible is appreciated. Just as an example, it took me a long time to find out, that setup-tools does not have its own section in a
And other little things like PEP517/518, |
@con-f-use I believe your summary is correct. A few comments:
The issue you're raising here was discussed in "part 1" of this PR. (I was the one that brought it up there.) See e.g. this comment: #6331 (comment) Basically, the issue is that the presence of One reason I want this PR to land sooner rather than later is to head off this problem earlier, because the longer it's postponed, the more users will be negatively affected by waiting. |
PS - yes, I agree there needs to be better documentation. Having said that, I do think the error messages in this PR and the previous will help to educate people and point them to where to find more information on this topic. That was a deliberate goal on my part and one of the reasons the error messages are a bit longer compared with other error messages by pip. |
Again, thanks for you patience.
Already kinda did yesterday. Maybe a gentle nudge from someone more known in the packaging work wold be additional motivation, tough ;-) |
Thanks, @pfmoore. |
@con-f-use original post:
@cjerdonek response:
Another thing that crossed my mind is to have something like this:
Not sure if it's a good idea either, but it would not break a Pipenv installation in the way I outlined in #6370 (comment) and would also not break backwards compatibility. Maybe make it more concrete with |
This breaks editable installs for people who use pyproject.toml for unrelated configuration (eg black). I think I understand the rationale, but going through a gentler deprecation path would have been nice. |
Echoing the above, a bunch of our builds have started failing for the same reason - we use the new toml file purely for 2 lines of black configuration. We have a project structure like:
This setup allows us to
It's not immediately clear from the docs I've seen so far what the minimal change we need to make is - I'd guessing in the short term are options are to
I'd echo the author above that a deprecation warning would have been nice here, but mostly I'd like to understand if there's a small change/addition we can make to the pyproject.toml file to resume previous behaviour. The examples I've seen so far use poetry or flit as example build tools, I'm surprised there's been no example using 'historical' tooling (e.g. pip/setuptools) so I'm wondering if I'm missing something here. |
Just making unqualified comments here, but doesn't black have a specific config file other than Btw. what was the reason again to not automatically fall back to the old |
Unfortunately (for me at least) black doesn't offer anything other than pyproject.toml. Opinions seem a bit split on it, personally I'm disappointed it doesn't offer |
A little background on this: It was a bug / oversight that this was ever working. (It shouldn't have ever been working in the first place.) Yes, we know it's going to be an inconvenience for some that started using this. But PEP 517 is still a very new feature, and it would create much bigger problems further down the road if people started relying on this behavior more, which is why we wanted to stop it earlier while adoption is still small.
Here are three comments with more detailed background / rationale:
The simplest work-around for people should be to add |
In some cases editable install is desirable (Cython code coverage, development of a library), so the later two options are often no-go from the get-go. Will |
Hmm. I might be doing something wrong but the new flag doesn't seem to work for me:
|
I'm going to open a new issue if only to prevent cluttering up this merged PR. |
:) I'll add my info to the bug above |
@gaborbernat Yes, mixed caeses were my concern, too, like:
would this work:
I mean Pipenv and similar tools still have now way to pass options to pip on a per-package basis, but it be nice. |
That fails with:
This seems to imply that PIP refuses to opt-out of PEP 517 if there is a |
It will only work when PEP 517 doesn't mandate that The flag for the legacy behavior will eventually go away (that's the plan). Here's the tracking issue: #6334 |
So I get now pip is PEP compliant, but this now breaks peoples workflow without any sane workaround, I consider it as a PEP oversight. PEP-517/8 on purpose did not want to cover editable installs, considering something to be addressed down the line. As such I would argue PEP-517/PEP-518 no longer applies when editable install mode is enabled. It's the build frontend dependent on how this case is handled. In such a case, pip should fallback to the old system, until we define editable installs inside a PEP. @pfmoore want to weigh in? |
I have no |
Raised #6433 for further discussion |
`pip install -e . --no-deps` started breaking with pypa/pip#6370 as seen in https://travis-ci.org/pyviz/panel/jobs/524005537#L1438
* Use python setup.py rather than editable pip `pip install -e . --no-deps` started breaking with pypa/pip#6370 as seen in https://travis-ci.org/pyviz/panel/jobs/524005537#L1438 * Reverting conda pin
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This is the second of two PR's to address installing in editable mode when a
pyproject.toml
file is present. The first part was PR #6331, which has already been merged.Whereas PR #6331 addressed the case when PEP 517 requires handling the source tree as
pyproject.toml
-style, this PR addresses the case where it is optional (i.e. PEP 517 doesn't mandate it).Specifically, this PR does four things:
Raises an informative
InstallationError
if editable mode was requested, apyproject.toml
file is present but PEP 517 processing is optional, and no other PEP 517-related options were passed. Among other things, the error message tells the user they can pass--no-use-pep517
to bypasspyproject.toml
-style processing and use editable mode. This behavior was discussed and agreed to on the comment thread for PR Show a nice error if editable mode is attempted with a pyproject.toml source tree #6331. The error currently looks like this--Gets
pip install -e
working again for the PEP 517-is-optional case (provided--no-use-pep517
was passed). Previously, this case was broken because when PEP 517 processing was turned on by default for pip, thebuild-system.requires
section was ignored in the non-PEP 517 case (in theIsSDist.prep_for_dist()
method).Adds a lot more unit test coverage of
resolve_pyproject_toml()
(the pure function responsible for interpreting the various flags in relation to the contents ofpyproject.toml
). It also fixestest_constraints_local_editable_install_pep518()
by passing--no-use-pep517
to thepip install -e
invocation in the test, which it should have been doing before.Fixes some exception handling that occurs in
IsSDist.prep_for_dist()
when conflicts are found while processing build dependencies. The prior code constructed an exception message using a variable (conflicting
) that hadn't been defined yet. So I don't think that code path was working before.