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

Improve message when setuptools is missing (PEP 518) #4989

Merged
merged 1 commit into from
Mar 26, 2018

Conversation

pradyunsg
Copy link
Member

No description provided.

@pradyunsg pradyunsg added type: enhancement Improvements to functionality skip news Does not need a NEWS file entry (eg: trivial changes) labels Jan 23, 2018
@benoit-pierre
Copy link
Member

Does it make sense to tell the user to upgrade to a non-existent version of pip? PEP 517 is still not supported, even in master, no?

@pradyunsg
Copy link
Member Author

How does the following read? (current msg quoted)

This version of pip does not implement PEP 517, so it cannot build a wheel without setuptools. You need to upgrade to a newer version of pip that implements PEP 517.

This version of pip does not implement PEP 517, so it cannot build a wheel without setuptools. The next major version release of pip would implement PEP 517.

@pfmoore
Copy link
Member

pfmoore commented Jan 23, 2018

I agree woth @benoit-pierre . I'll need to check the context of this (no time now) but I'm confused as to what's going on here. I thought that pre-PEP 517, projects wouldn't explicitly include setuptools in their build-requires, and we'd simply assume that as now, setuptools and wheel would be required. Post PEP 517, we'd allow build tools to be specified, but still fall back to setuptools/wheel. So still entirely possible for setuptools nort to be present.

I'll check the wider code later, but as things stand I hope this is all irrelevant, as this message should never appear in practice (makes me wonder why it's appearing in the forkbomb example, though...)

@pradyunsg
Copy link
Member Author

no time now

No hurries. I'm gonna sleep now anyways. =)

@pfmoore
Copy link
Member

pfmoore commented Jan 23, 2018

Ah, I now see what's going on here. PEP 518 states that if pyproject.toml isn't present, build-system.requires should default to ['setuptools', 'wheel'] (for backward compatibility, as that's what legacy setup.py needs. If it is present, build-system.requires "will have a value of a list of strings representing the PEP 508 dependencies required to execute the build system (currently that means what dependencies are required to execute a setup.py file)."

The case we're catching here is when there is a pyproject.toml, but it doesn't specify the build system. That's cool - you've said what your build system is, and it's not setuptools, so we don't support it yet (because PEP 517 isn't supported yet).

But, #4647 has a pyproject.toml that looks like the following:

[build-system]
requires = ["python-xlib"]

That's not specifying the build system, but rather additional requirements needed to execute setup.py in addition to the assumed setuptools and wheel.

It looks like #4647 is based on a mistaken assumption about how PEP 518 works. Ideally, we'd need to catch cases like this and give a more meaningful error, which the current proposed error doesn't really do. How about this:

Currently, pip does not support PEP 517, and can only build wheels using setuptools. Your pyproject.toml specifies ["python-xlib"] as its build system, which needs PEP 517 support.

@pradyunsg
Copy link
Member Author

How about reversing the order of those statements?

@pradyunsg
Copy link
Member Author

Your pyproject.toml specifies ["python-xlib"] as its build system, which needs PEP 517 support. Currently, pip does not support PEP 517, and can only build wheels using setuptools.

@pradyunsg
Copy link
Member Author

(huh, cmd+enter posts a comment, interesting)

@pradyunsg
Copy link
Member Author

Except, maybe instead of "Your" we need to mention the project name.

@pfmoore
Copy link
Member

pfmoore commented Jan 23, 2018

Sounds OK to me.

(Offtopic thought - if @benoit-pierre assumed in #4647, and no-one who reviewed that issue corrected him, that you only need to specify additional requirements needed for setup.py, maybe that means there's a need to be clearer in PEP 518 how the build-system.requires field should be used...?)

@pradyunsg pradyunsg added this to the 10.0 milestone Jan 24, 2018
@pradyunsg pradyunsg self-assigned this Jan 24, 2018
@pradyunsg pradyunsg changed the title Improve message when setuptools is missing Improve message when setuptools is missing (PEP 518) Jan 24, 2018
@pradyunsg
Copy link
Member Author

(Offtopic thought - if @benoit-pierre assumed in #4647, and no-one who reviewed that issue corrected him, that you only need to specify additional requirements needed for setup.py, maybe that means there's a need to be clearer in PEP 518 how the build-system.requires field should be used...?)

Yes, I think a line making this clear would be useful.


I've committed the following:

pip-forkbomb-test does not include 'setuptools' as a buildtime requirement in its pyproject.toml.
This version of pip does not implement PEP 517 so it cannot build a wheel without setuptools.

It just came out of my head as I typed in what we'd discussed above.

@pfmoore
Copy link
Member

pfmoore commented Jan 24, 2018

lgtm

@ghost
Copy link

ghost commented Jan 26, 2018

Please do not merge this until after gh-4799 as it will create merge conflicts and is a lower priority.

@pradyunsg pradyunsg mentioned this pull request Mar 1, 2018
@BrownTruck
Copy link
Contributor

Hello!

I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the master branch into this pull request or rebase this pull request against master then it will eligible for code review and hopefully merging!

@BrownTruck BrownTruck added the needs rebase or merge PR has conflicts with current master label Mar 2, 2018
@pypa-bot pypa-bot removed the needs rebase or merge PR has conflicts with current master label Mar 8, 2018
@pradyunsg pradyunsg requested a review from pfmoore March 9, 2018 06:07
pfmoore
pfmoore previously requested changes Mar 9, 2018
Copy link
Member

@pfmoore pfmoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something's wrong here as when I look at the PR, it says "0 files changed"...

@sersorrel
Copy link

Indeed, the warning message got moved into prep_for_dist in src/pip/_internal/operations/prepare.py - the relevant commit on master is 163149f. The merge restored the existing message.

@pradyunsg pradyunsg force-pushed the misc/better-pep-518-message branch from 846f0a3 to 22124af Compare March 9, 2018 09:48
@pradyunsg
Copy link
Member Author

Whoops! I'd messed up... I had local changes that didn't get added before the merge commit.

Anyway, rebased and squashed everything. :)

@pradyunsg pradyunsg dismissed pfmoore’s stale review March 9, 2018 09:50

Changes have been made.

@pradyunsg pradyunsg force-pushed the misc/better-pep-518-message branch from 22124af to 398fea8 Compare March 9, 2018 10:21
@pfmoore pfmoore merged commit 61eda75 into pypa:master Mar 26, 2018
@pradyunsg pradyunsg deleted the misc/better-pep-518-message branch May 27, 2018 10:08
@lock
Copy link

lock bot commented Jun 2, 2019

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.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation skip news Does not need a NEWS file entry (eg: trivial changes) type: enhancement Improvements to functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants