Skip to content

Avoid using setuptools shim of distutils#2305

Merged
charliermarsh merged 1 commit intomainfrom
charlie/patch
Mar 8, 2024
Merged

Avoid using setuptools shim of distutils#2305
charliermarsh merged 1 commit intomainfrom
charlie/patch

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).

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