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

Avoid using setuptools shim of distutils #2305

Merged
merged 1 commit into from
Mar 8, 2024
Merged

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Mar 8, 2024

Summary

It turns out that setuptools includes a shim to patch distutils. I'll admit that I don't fully understand why or how it's different, but this is the trick pip uses to ensure that it gets the "original" distutils.

We actually use distutils in two places: once for the system Python scheme, and once for virtual environments. In virtualenv, they do use the patched distutils, so this could deviate in ways I don't understand.

Closes #2302.

@charliermarsh charliermarsh added compatibility Compatibility with a specification or another tool bug Something isn't working labels Mar 8, 2024
@charliermarsh
Copy link
Member Author

@gaborbernat - do you know if it's necessary for virtualenv to use the patched version of distutils? I see a note in pypa/virtualenv#1771, but I can't tell if it's required or merely necessary for others that might import virtualenv.

@potiuk
Copy link

potiuk commented Mar 8, 2024

Nice!

@gaborbernat
Copy link
Contributor

I believe this aligns with how packages behave. pip uses setuptools distutils historically for installing packages. So without that shim you might end up with bug reports of installations ending up in expected locations when the OS patched distutils and setuptools distutils information differs (primarily in debian).

@charliermarsh charliermarsh merged commit ff62fe2 into main Mar 8, 2024
7 checks passed
@charliermarsh charliermarsh deleted the charlie/patch branch March 8, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compatibility Compatibility with a specification or another tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A bit too strict pyproject.toml validation for uv 0.1.16
3 participants