Skip to content

perf(venv): skip the distutils shim on Python 3.10+#1358

Open
konsti-openai wants to merge 1 commit into
aspect-build:mainfrom
konsti-openai:konsti/remove-virtualenv-distutils-shim
Open

perf(venv): skip the distutils shim on Python 3.10+#1358
konsti-openai wants to merge 1 commit into
aspect-build:mainfrom
konsti-openai:konsti/remove-virtualenv-distutils-shim

Conversation

@konsti-openai

Copy link
Copy Markdown

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

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config):no
  • Suggested release notes appear below: yes

Test plan

  • Covered by existing test cases

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
@konsti-openai
konsti-openai force-pushed the konsti/remove-virtualenv-distutils-shim branch from e57b68d to 6d2673b Compare July 20, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant