Further improve import time of importlib.metadata
#118761
Labels
performance
Performance or resource usage
topic-importlib
type-feature
A feature request or enhancement
importlib.metadata
is often used for tasks that need to happen at import, e.g. to enumerate/load entry point plug-ins, so it might be worth seeing if we can cut down its own import time a bit more.importlib.metadata
importszipfile
at the top for a function that won't be called in the vast majority of cases. It also importsimportlib.abc
, which in turn importsimportlib.resources
, to subclass an ABC with a single, non-abstract method - I assume redefining the method inimportlib.metadata
would be harmless. Some other less frequently-used imports which are only accessed once or twice, such asjson
, could also be tucked away in their calling functions.Split from #109653.
The text was updated successfully, but these errors were encountered: