Skip to content

Commit

Permalink
GH-109653: Defer import of importlib.metadata._adapters (python/c…
Browse files Browse the repository at this point in the history
…python#109829)

---------

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
  • Loading branch information
AA-Turner and jaraco committed Mar 21, 2024
1 parent f5d6b5f commit 6673723
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import posixpath
import collections

from . import _adapters, _meta
from . import _meta
from .compat import py39
from ._collections import FreezableDefaultDict, Pair
from ._compat import (
Expand Down Expand Up @@ -461,6 +461,9 @@ def metadata(self) -> _meta.PackageMetadata:
Custom providers may provide the METADATA file or override this
property.
"""
# deferred for performance (python/cpython#109829)
from . import _adapters

opt_text = (
self.read_text('METADATA')
or self.read_text('PKG-INFO')
Expand Down
1 change: 1 addition & 0 deletions newsfragments/+.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deferred select imports in for speedup (python/cpython#109829).

0 comments on commit 6673723

Please sign in to comment.