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

Remove import re from entrypoint wrapper scripts #10627

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

hukkin
Copy link
Contributor

@hukkin hukkin commented Jan 15, 2025

Summary

This removes import re from the wrapper script of installed tools, so that small tools that never import re themselves are allowed to load faster.

This was offered to distlib but was rejected pypa/distlib#239. That discussion includes all the relevant performance measurements for this change.

Here's the corresponding pip issue pypa/pip#13165 and pip PR pypa/pip#13166

The motivation for this change was this discussion on Python Discourse.

Test Plan

Ran

cargo build
./target/debug/uv tool install black
black --version
# observed that installed black runs succesfully
cat ~/.local/bin/black
# observed that the wrapper script no longer imports `re` module

Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me.

cc @konstin

@charliermarsh
Copy link
Member

Yeah this is good.

Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work, thanks!

@konstin konstin added the performance Potential performance improvement label Jan 15, 2025
@konstin konstin merged commit ad075c3 into astral-sh:main Jan 15, 2025
64 checks passed
@hukkin hukkin deleted the rm-re-import branch January 15, 2025 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Potential performance improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants