Skip to content

Commit

Permalink
Merge pull request #354 from FFY00/remove-distribution-local
Browse files Browse the repository at this point in the history
metadata: remove Distribution._local
  • Loading branch information
jaraco committed Dec 20, 2021
2 parents 4abad44 + 1f6fe1e commit 9491ef9
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 36 deletions.
10 changes: 10 additions & 0 deletions CHANGES.rst
@@ -1,3 +1,13 @@
v4.10.0
=======

* #354: Removed ``Distribution._local`` factory. This
functionality was created as a demonstration of the
possible implementation. Now, the
`pep517 <https://pypi.org/project/pep517>`_ package
provides this functionality directly through
`pep517.meta.load <https://github.com/pypa/pep517/blob/a942316305395f8f757f210e2b16f738af73f8b8/pep517/meta.py#L63-L73>`_.

v4.9.0
======

Expand Down
12 changes: 0 additions & 12 deletions importlib_metadata/__init__.py
Expand Up @@ -576,18 +576,6 @@ def _discover_resolvers():
)
return filter(None, declared)

@classmethod
def _local(cls, root='.'):
from pep517 import build, meta

system = build.compat_system(root)
builder = functools.partial(
meta.build,
source_dir=root,
system=system,
)
return PathDistribution(zipp.Path(meta.build_as_zip(builder)))

@property
def metadata(self) -> _meta.PackageMetadata:
"""Return the parsed metadata for this Distribution.
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Expand Up @@ -3,3 +3,5 @@ norecursedirs=dist build .tox .eggs
addopts=--doctest-modules
doctest_optionflags=ALLOW_UNICODE ELLIPSIS
filterwarnings=
# Suppress deprecation warning in flake8
ignore:SelectableGroups dict interface is deprecated::flake8
1 change: 0 additions & 1 deletion setup.cfg
Expand Up @@ -46,7 +46,6 @@ testing =
# local
importlib_resources>=1.3; python_version < "3.9"
packaging
pep517
pyfakefs
flufl.flake8
pytest-perf >= 0.9.2
Expand Down
15 changes: 0 additions & 15 deletions tests/fixtures.py
Expand Up @@ -231,21 +231,6 @@ def setUp(self):
build_files(EggInfoFile.files, prefix=self.site_dir)


class LocalPackage:
files: FilesDef = {
"setup.py": """
import setuptools
setuptools.setup(name="local-pkg", version="2.0.1")
""",
}

def setUp(self):
self.fixtures = contextlib.ExitStack()
self.addCleanup(self.fixtures.close)
self.fixtures.enter_context(tempdir_as_cwd())
build_files(self.files)


def build_files(file_defs, prefix=pathlib.Path()):
"""Build a set of files/directories, as described by the
Expand Down
8 changes: 0 additions & 8 deletions tests/test_integration.py
Expand Up @@ -4,7 +4,6 @@

from . import fixtures
from importlib_metadata import (
Distribution,
MetadataPathFinder,
_compat,
distributions,
Expand Down Expand Up @@ -44,13 +43,6 @@ def __getattribute__(self, name):
_compat.disable_stdlib_finder()


class LocalProjectTests(fixtures.LocalPackage, unittest.TestCase):
def test_find_local(self):
dist = Distribution._local()
assert dist.metadata['Name'] == 'local-pkg'
assert dist.version == '2.0.1'


class DistSearch(unittest.TestCase):
def test_search_dist_dirs(self):
"""
Expand Down

0 comments on commit 9491ef9

Please sign in to comment.