You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: avoid O(n) packages_distributions() scan at import time
Replace `importlib.metadata.packages_distributions()` with targeted
O(1) `metadata.distribution()` lookups by trying common distribution
name conventions (dot-to-dash, dot-to-underscore, last component).
`packages_distributions()` scans every installed package in the
environment to build a complete module-to-distribution mapping. In
large venvs (500+ packages, common with many google-cloud-* libs),
this causes multi-second import delays for google.api_core and
every library that depends on it.
Also defer the package label resolution in `check_python_version()`
so it only runs when a warning is actually emitted (not on the
common happy path of a supported Python version).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments