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

Reduce import time part 3: remove typing import #251

Merged
merged 4 commits into from
Jan 12, 2025
Merged

Conversation

hukkin
Copy link
Owner

@hukkin hukkin commented Jan 10, 2025

No description provided.

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4188188) to head (32af4fd).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #251   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          525       526    +1     
  Branches        97        97           
=========================================
+ Hits           525       526    +1     

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

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Does TYPE_CHECKING = False not work? Only mypy will understand MYPY = False

@hukkin
Copy link
Owner Author

hukkin commented Jan 11, 2025

I actually only tried MYPY. My interpretation of mypy docs is that only MYPY is officially promised to work here, and TYPE_CHECKING only when imported from typing.

@hauntsaninja
Copy link
Collaborator

@hukkin
Copy link
Owner Author

hukkin commented Jan 11, 2025

Great! Switched to TYPE_CHECKING here.

@hukkin
Copy link
Owner Author

hukkin commented Jan 12, 2025

According to my tests, making Output inherit from object rather than typing.NamedTuple doesn't hurt performance (of pure Python or mypyc whels), so merging this doesn't appear to have a downside.

@hukkin hukkin merged commit 1da01ef into master Jan 12, 2025
36 checks passed
@hukkin hukkin deleted the importtime-pt3 branch January 12, 2025 13:40
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.

2 participants