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

Defer imports for faster overall import time: 19 ms -> 5 ms #234

Merged
merged 3 commits into from
Feb 13, 2025

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Feb 12, 2025

Defer imports, especially avoid typing import for normal use, which is getting slower in 3.14, to make the overall import time of humanize faster.

Before: 19 ms

image

After: 5 ms

image

Also move mypy dependency to autoupdateable requirements file.

@hugovk hugovk added the changelog: Changed For changes in existing functionality label Feb 12, 2025
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.48%. Comparing base (c6455cf) to head (147cbbc).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
- Coverage   99.49%   99.48%   -0.01%     
==========================================
  Files          11       11              
  Lines         785      782       -3     
==========================================
- Hits          781      778       -3     
  Misses          4        4              
Flag Coverage Δ
macos-latest 97.69% <100.00%> (-0.01%) ⬇️
ubuntu-latest 97.69% <100.00%> (-0.01%) ⬇️
windows-latest 95.90% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hugovk hugovk changed the title Defer imports for faster overall import time Defer imports for faster overall import time: 19 ms -> 5 ms Feb 13, 2025
@hugovk hugovk merged commit 13f71a3 into python-humanize:main Feb 13, 2025
32 checks passed
@hugovk hugovk deleted the mypy branch February 13, 2025 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: Changed For changes in existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant