Skip to content

Commit 9491ef9

Browse files
authored
Merge pull request #354 from FFY00/remove-distribution-local
metadata: remove Distribution._local
2 parents 4abad44 + 1f6fe1e commit 9491ef9

File tree

6 files changed

+12
-36
lines changed

6 files changed

+12
-36
lines changed

CHANGES.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
v4.10.0
2+
=======
3+
4+
* #354: Removed ``Distribution._local`` factory. This
5+
functionality was created as a demonstration of the
6+
possible implementation. Now, the
7+
`pep517 <https://pypi.org/project/pep517>`_ package
8+
provides this functionality directly through
9+
`pep517.meta.load <https://github.com/pypa/pep517/blob/a942316305395f8f757f210e2b16f738af73f8b8/pep517/meta.py#L63-L73>`_.
10+
111
v4.9.0
212
======
313

importlib_metadata/__init__.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -576,18 +576,6 @@ def _discover_resolvers():
576576
)
577577
return filter(None, declared)
578578

579-
@classmethod
580-
def _local(cls, root='.'):
581-
from pep517 import build, meta
582-
583-
system = build.compat_system(root)
584-
builder = functools.partial(
585-
meta.build,
586-
source_dir=root,
587-
system=system,
588-
)
589-
return PathDistribution(zipp.Path(meta.build_as_zip(builder)))
590-
591579
@property
592580
def metadata(self) -> _meta.PackageMetadata:
593581
"""Return the parsed metadata for this Distribution.

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ norecursedirs=dist build .tox .eggs
33
addopts=--doctest-modules
44
doctest_optionflags=ALLOW_UNICODE ELLIPSIS
55
filterwarnings=
6+
# Suppress deprecation warning in flake8
7+
ignore:SelectableGroups dict interface is deprecated::flake8

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ testing =
4646
# local
4747
importlib_resources>=1.3; python_version < "3.9"
4848
packaging
49-
pep517
5049
pyfakefs
5150
flufl.flake8
5251
pytest-perf >= 0.9.2

tests/fixtures.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -231,21 +231,6 @@ def setUp(self):
231231
build_files(EggInfoFile.files, prefix=self.site_dir)
232232

233233

234-
class LocalPackage:
235-
files: FilesDef = {
236-
"setup.py": """
237-
import setuptools
238-
setuptools.setup(name="local-pkg", version="2.0.1")
239-
""",
240-
}
241-
242-
def setUp(self):
243-
self.fixtures = contextlib.ExitStack()
244-
self.addCleanup(self.fixtures.close)
245-
self.fixtures.enter_context(tempdir_as_cwd())
246-
build_files(self.files)
247-
248-
249234
def build_files(file_defs, prefix=pathlib.Path()):
250235
"""Build a set of files/directories, as described by the
251236

tests/test_integration.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from . import fixtures
66
from importlib_metadata import (
7-
Distribution,
87
MetadataPathFinder,
98
_compat,
109
distributions,
@@ -44,13 +43,6 @@ def __getattribute__(self, name):
4443
_compat.disable_stdlib_finder()
4544

4645

47-
class LocalProjectTests(fixtures.LocalPackage, unittest.TestCase):
48-
def test_find_local(self):
49-
dist = Distribution._local()
50-
assert dist.metadata['Name'] == 'local-pkg'
51-
assert dist.version == '2.0.1'
52-
53-
5446
class DistSearch(unittest.TestCase):
5547
def test_search_dist_dirs(self):
5648
"""

0 commit comments

Comments
 (0)