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

Generate __version__ at build to avoid slow importlib.metadata import #141

Merged
merged 1 commit into from
Oct 12, 2024

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Oct 12, 2024

Like python/blurb#30.

importlib.metadata is quite a heavy library to import, and can make CLI use less snappy.

It's only used for fetching the version, and we can pre-generate it as part of our regular build instead.

The call itself is also slow, for example 15s: python/blurb#30 (review).

Before

python -X importtime -c "import cherry_picker" 2> import.log && tuna import.log
image image

After

image image

@AA-Turner AA-Turner merged commit a7d1d0d into python:main Oct 12, 2024
22 checks passed
@hugovk hugovk deleted the rm-importlib.metadata branch October 12, 2024 19:26
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.

3 participants