Closed
Description
Feature or enhancement
Proposal:
As noted in https://discuss.python.org/t/deferred-computation-evalution-for-toplevels-imports-and-dataclasses/34173, typing
isn't the slowest stdlib module in terms of import time, but neither is it one of the quickest. We should speed it up, if possible.
Links to previous discussion of this feature:
Linked PRs
- gh-109653:
typing.py
: improve import time by creating soft-deprecated members on demand #109651 - gh-109653: Improve
enum
import time by avoiding import offunctools
#109789 - gh-109653: Remove unused imports in the
Lib/
directory #109803 - gh-109653: Avoid a top-level import of
types
infunctools
#109804 - gh-109653: Just import
recursive_repr
indataclasses
#109822 - gh-109653: Improve the import time of
email.utils
#109824 - GH-109653: Defer import of
importlib.metadata._adapters
#109829 - gh-109653: Fix py312 regression in the import time of
random
#110221 - [3.12] gh-109653: Fix py312 regression in the import time of
random
(GH-110221) #110247 - gh-109653: Defer importing
warnings
in several modules #110286 - gh-109653: Improve import time of
logging
by lazy loadingtraceback
#112995 - gh-109653: Speedup import of threading module #114509
- gh-109653: Improve import time of importlib.metadata / email.utils #114664
- gh-109653: Reduce import overhead of uuid module on Linux #115160
- gh-109653: What's new: Note improved import times for several stdlib modules in Python 3.13 #118697