-
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
Partially implement PEP 517 #4589
Conversation
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 |
related: pypa/setuptools#1039 |
@xoviat The build failed for some reason... I restarted it. |
@pradyunsg What happened there? |
I'm not very sure, to be honest. We might have hit #4588. :/ |
This might have happened because of some change you've made, because IIRC tox uses the local pip because of how the import system works. I think so because even AppVeyor is being held up by this change. PS: It's 2am and I'm guessing. |
It would be nice if you revert the readability/:art: changes as they have bloated the diff making it difficult to see what's actually changed. |
704-740 are the only changes. Everything that I work on is run through yapf. |
Just look at ce0a49740a0126485b5c346746d00ce971e046d3 |
pip/wheel.py
Outdated
def __build_one_inside_subprocess(self, wheel_args, cwd, env): | ||
os.chdir(cwd) | ||
os.environ = env | ||
config_settings = {"--build-option": wheel_args} |
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.
One thing I'm not completely sure about is whether environ is checked as part of sys.path. Or does that need to be updated as well to env['PYTHONPATH']
The thing is YAPF is formatting in a manner that is not consistent with the rest of the codebase and currently, these changes only add noise to the diff; no functionality.
That won't work out when you make another commit. To look at everything that changed over the course of this PR using the web UI, it is difficult to figure out what changed due to the noise from the style changes. FWIW, my reasoning - the style changes don't help the PR get reviewed quicker or add any functionality. To avoid getting into a code-style related debate and making it easier to review, I'm requesting you to revert those changes. |
+1 Please only make functional changes as part of the PR. |
Done. |
Thanks! |
@xoviat I checked this out locally and reproduced the hold up on the CI. Could you look into it? |
pip/compat.py
Outdated
"get_path_uid", "stdlib_pkgs", "WINDOWS", "samefile", | ||
"ThreadPoolExecutor", "ProcessPoolExecutor", | ||
] | ||
|
||
try: |
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.
@pradyunsg Why was this not a valid idea? Is there a circular import or something?
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.
Not really sure...
If I'm reading this code correct, it's using a
|
pip/wheel.py
Outdated
@@ -37,6 +37,12 @@ | |||
from pip.utils.temp_dir import TempDirectory | |||
from pip.utils.ui import open_spinner | |||
|
|||
try: | |||
from concurrent.futures.process import ProcessPoolExecutor |
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.
Don't try importing the unvendored version, it could break compatibility. :)
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.
The vendored version could fail on unreleased newer python versions. Trying to maintain python core libraries is just duplicating efforts.
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.
I mean technically the core library could be changed, but isn't that subject to a backward compatibility guarantee?
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.
The vendored version could fail on unreleased newer python versions.
Which would warrant a new release of pip, which is fine. You can't support something that doesn't exist when you built it. No laptop supported USB-C before it was standardised, even though OEMs knew how it would almost be.
OTOH, If the user install a release of concurrent.futures that pip has not been tested with and pip would not work - it is pip's fault and if you think about it, it'll be impossible to use pip if it has such a try-except to recover from a situation.
Trying to maintain python core libraries is just duplicating efforts.
pip simply vendors versions of these libraries that it knows it works with. They are all still separate projects in their own right and they just happen to be used by pip and because pip is special (for various reasons that I won't go into), it vendors its dependencies.
Point being - any third party library that pip imports must be a vendored within pip and only that vendored library should be used.
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.
What if the backport only works on Python 2.7 and the core library only works on Python 3.2 and above? Then developers will need to spend additional time to update the vendored version.
OTOH, If the user install a release of concurrent.futures that pip has not been tested with and pip would not work - it is pip's fault and if you think about it, it'll be impossible to use pip if it has such a try-except to recover from a situation.
Ordinarily I would agree, but concurrent.futures is a core python library. It's included in the Python distribution. Using this logic, pip would have to account for every case where users patch core python functions such as shutil.copy.
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.
Could you change this into a conditional on the Python version? That'll address my reservations.
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.
That's fine with me.
NEWS.rst
Outdated
@@ -19,7 +19,6 @@ | |||
- Fix an SyntaxError in an unused module of a vendored dependency. (#4059) | |||
- Fix UNC paths on Windows. (#4064) | |||
|
|||
|
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.
This is unnecessary.
I'm not too keen on having pip import setuptools for anything since that is exactly what we're trying to move away from in PEP518 - the difficulty of using a build toolchain other than setuptools with pip today. |
The setuptools function is PEP 517 compliant. Your suggestion would not be PEP 517 compliant.
This is incrementally moving pip away from depending on setuptools. In the future, line 493 could be changed to the build system specified in pyproject.toml. |
@pradyunsg The other thing we need to replace after this is merged is attempting to use the |
Closing as PEP 518 seems to be on hold. |
What do you mean? PEP 518 was accepted in May and 517 provisionally accepted in September. |
PEP 518 implementation discussion is ongoing. This particular implementation approach may not be the one chosen (that's part of the discussion) but PEP 518 is still very much in the plans (as is PEP 517, although we're not as far on with that one). |
I currently don't have time to implement it. Obviously someone needs to and I'm willing to do what I can to help that is reasonably time-efficient. But I don't know how this PR could be merged given that it removes legacy behavior and relies on isolated environments to function. The simplest path forward is probably to wait until build isolation is enabled by default and hope that |
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 |
cc @pradyunsg Upon resolving recent conflicts, the diff appears to be ~300 lines. Is that okay, or do we need to break out the changes further? |
Sounds fine to me. |
Please do open a new PR, rebased on master. |
Umm... Could you please open a new PR for this, instead of working on this one? Even closing this and opening a new PR from the same branch would be fine. It's just, cleaner. |
@pradyunsg If you're interested, gh-4997 needs to be addressed before this can proceed. |
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 change accomplishes two principle objectives:
egg_info
is invoked outside the wheel builder, the scope of the build environment should be (and is now here) the scope of req_install.setup.py
interactions into a new class called build backend. The goal of this is to make all of the build backend functions pure except forself.setup_py_dir
. We can then simply copy the build backend directly into setuptools, but it's faster to develop here first so that we can stay in a single project.