diff --git a/CHANGES.rst b/CHANGES.rst index 305987ef..e61e6e82 100644 --- a/CHANGES.rst +++ b/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 `_ package + provides this functionality directly through + `pep517.meta.load `_. + v4.9.0 ====== diff --git a/importlib_metadata/__init__.py b/importlib_metadata/__init__.py index d08e9c14..08f7a9ea 100644 --- a/importlib_metadata/__init__.py +++ b/importlib_metadata/__init__.py @@ -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. diff --git a/pytest.ini b/pytest.ini index 845aec00..ec965b24 100644 --- a/pytest.ini +++ b/pytest.ini @@ -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 diff --git a/setup.cfg b/setup.cfg index cf296c95..f214b8ec 100644 --- a/setup.cfg +++ b/setup.cfg @@ -46,7 +46,6 @@ testing = # local importlib_resources>=1.3; python_version < "3.9" packaging - pep517 pyfakefs flufl.flake8 pytest-perf >= 0.9.2 diff --git a/tests/fixtures.py b/tests/fixtures.py index 68584abf..08a478ac 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -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 diff --git a/tests/test_integration.py b/tests/test_integration.py index 00e9021a..c382a506 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -4,7 +4,6 @@ from . import fixtures from importlib_metadata import ( - Distribution, MetadataPathFinder, _compat, distributions, @@ -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): """