Skip to content

Commit

Permalink
Merge pull request #502 from danielhollas/defer-zipp
Browse files Browse the repository at this point in the history
Defer import of zipp
  • Loading branch information
jaraco authored Sep 11, 2024
2 parents 5dd80c3 + e3ce33b commit 58832f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
from itertools import starmap
from typing import Any, Iterable, List, Mapping, Match, Optional, Set, cast

from zipp.compat.overlay import zipfile

from . import _meta
from ._collections import FreezableDefaultDict, Pair
from ._compat import (
Expand Down Expand Up @@ -777,6 +775,9 @@ def children(self):
return []

def zip_children(self):
# deferred for performance (python/importlib_metadata#502)
from zipp.compat.overlay import zipfile

zip_path = zipfile.Path(self.root)
names = zip_path.root.namelist()
self.joinpath = zip_path.joinpath
Expand Down
1 change: 1 addition & 0 deletions newsfragments/502.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deferred import of zipfile.Path

0 comments on commit 58832f2

Please sign in to comment.