perf(venv): skip the distutils shim on Python 3.10+ - #1358
Conversation
Stop materializing and importing the virtualenv distutils shim for Python 3.10+, where pip and setuptools already ignore the affected install configuration. Keep the shim for Python 3.9 and move the rules_py-specific PATH setup into the existing venv .pth so console scripts remain discoverable. Match the upstream changes: pypa/virtualenv#3184 astral-sh/uv#20222
e57b68d to
6d2673b
Compare
|
@tamird review |
what am I reviewing? |
|
@tamird review this PR |
|
But why? Konsti works at OAI and is a core contributor to uv. |
|
@tamird because you provide valuable feedback, and I'm uncertain if someone being an OAI employee means they know how a bazel change will effect your full build/CI? |
|
One compatibility case this doesn’t cover: setuptools/distutils checks its venv ignore list before normalizing option names, so underscore-form Separately, this changes the observable virtualenv layout: |
|
Please checkout the failing test.
Since we are still in v2 alpha maybe we can remove those entirely, how does it effect the tests? Do we know how common this is though? @xangcastle |
|
I believe the |
This is a port of pypa/virtualenv#3184 and astral-sh/uv#20222, which removed the distutils hack recently. Removing this brings venv creation in line with virtualenv and uv again and improves Python startup perf.
This is the conservative version of this change. The workaround is only required in an obscure setup where you have the bogus ancient configuration file in the current directory when performing operations. If we can safely assume that bazel users don't do that, we can remove the two files entirely.
Changes are visible to end-users: yes/no
Test plan