From aa41ab5de437a96bd62f31c1c1fe5633850e80f4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 17 Jul 2024 17:07:55 -0400 Subject: [PATCH 01/23] Pin Sphinx to <7.4 as workaround for sphinx-doc/sphinx#12613. Closes #4474. --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 54931e2ff2..8b6fd48edd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,6 +99,9 @@ doc = [ # workaround for pypa/setuptools#4333 "pyproject-hooks!=1.1", + + # workaround for sphinx-doc/sphinx#12613 + "sphinx < 7.4", ] ssl = [] certs = [] From 8482e6b2a75ba5b74d2cb88c85383b6dcb7c5f94 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 17 Jul 2024 19:58:22 -0400 Subject: [PATCH 02/23] Revert "Ensure that package data from vendored packages gets installed." This reverts commit fa7ee9130dd012ddfb4bf22e39e442a1e73ff0ed. --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8b6fd48edd..9bf9cc6df9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -194,10 +194,6 @@ exclude = [ ] namespaces = true -[tool.setuptools.package-data] -# ensure that `setuptools/_vendor/jaraco/text/Lorem ipsum.txt` is installed -"*" = ["*.txt"] - [tool.distutils.sdist] formats = "zip" From 1a52f11e3c28b3776a5d5184c536a280f7061acd Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 17 Jul 2024 20:52:03 -0400 Subject: [PATCH 03/23] Revert "Disable inclusion of package data as it causes 'tests' to be included as data. Fixes #2505." This reverts commit fbc9bd6fdbce132b9b5136345b0f6b3a1f6debaf. --- pyproject.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9bf9cc6df9..a117304491 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -178,9 +178,7 @@ PKG-INFO = "setuptools.command.egg_info:write_pkg_info" "dependency_links.txt" = "setuptools.command.egg_info:overwrite_arg" [tool.setuptools] -# disabled as it causes tests to be included #2505 -# include_package_data = true -include-package-data = false +include-package-data = true [tool.setuptools.packages.find] include = [ From 5be48b997dc49f9c75f6615cb5bfab2d15323104 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 17 Jul 2024 21:06:26 -0400 Subject: [PATCH 04/23] Add test asserting cli scripts are included in wheel. Captures missed expectation in #4475. --- setuptools/tests/test_setuptools.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setuptools/tests/test_setuptools.py b/setuptools/tests/test_setuptools.py index 0c5b1f18fa..176c7862de 100644 --- a/setuptools/tests/test_setuptools.py +++ b/setuptools/tests/test_setuptools.py @@ -307,3 +307,10 @@ def test_its_own_wheel_does_not_contain_tests(setuptools_wheel): for member in contents: assert '/tests/' not in member + + +def test_wheel_includes_cli_scripts(setuptools_wheel): + with ZipFile(setuptools_wheel) as zipfile: + contents = [f.replace(os.sep, '/') for f in zipfile.namelist()] + + assert any('cli-64.exe' in member for member in contents) From 9f07e225b6e283bb5c9497518ad59ed104181d34 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 17 Jul 2024 21:14:33 -0400 Subject: [PATCH 05/23] Remove test as it's redundant to the check in test_its_own_wheel_does_not_contain_tests. --- setuptools/tests/config/test_apply_pyprojecttoml.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/setuptools/tests/config/test_apply_pyprojecttoml.py b/setuptools/tests/config/test_apply_pyprojecttoml.py index 6b3ee9cf1e..ff9c5fc66e 100644 --- a/setuptools/tests/config/test_apply_pyprojecttoml.py +++ b/setuptools/tests/config/test_apply_pyprojecttoml.py @@ -12,7 +12,6 @@ from inspect import cleandoc from pathlib import Path from unittest.mock import Mock -from zipfile import ZipFile import pytest from ini2toml.api import LiteTranslator @@ -422,11 +421,6 @@ def test_example_file_in_sdist(self, setuptools_sdist): with tarfile.open(setuptools_sdist) as tar: assert any(name.endswith(EXAMPLES_FILE) for name in tar.getnames()) - def test_example_file_not_in_wheel(self, setuptools_wheel): - """Meta test to ensure auxiliary test files are not in wheel""" - with ZipFile(setuptools_wheel) as zipfile: - assert not any(name.endswith(EXAMPLES_FILE) for name in zipfile.namelist()) - class TestInteropCommandLineParsing: def test_version(self, tmp_path, monkeypatch, capsys): From 75116176d417bcb65033da0373432d6d8086ab37 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 17 Jul 2024 21:20:30 -0400 Subject: [PATCH 06/23] Mark the file as xfail for now. It's more important to be able to include the important resources than to exclude unwanted ones. Ref #4475. --- setuptools/tests/test_setuptools.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setuptools/tests/test_setuptools.py b/setuptools/tests/test_setuptools.py index 176c7862de..613a52d042 100644 --- a/setuptools/tests/test_setuptools.py +++ b/setuptools/tests/test_setuptools.py @@ -301,6 +301,7 @@ def test_findall_missing_symlink(tmpdir, can_symlink): assert found == [] +@pytest.mark.xfail(reason="unable to exclude tests; #4475 #3260") def test_its_own_wheel_does_not_contain_tests(setuptools_wheel): with ZipFile(setuptools_wheel) as zipfile: contents = [f.replace(os.sep, '/') for f in zipfile.namelist()] From cf298e76bae4781ca4a1a85e7bb8ea6c8f260611 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 17 Jul 2024 21:39:57 -0400 Subject: [PATCH 07/23] Add news fragment. --- newsfragments/4475.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/4475.bugfix.rst diff --git a/newsfragments/4475.bugfix.rst b/newsfragments/4475.bugfix.rst new file mode 100644 index 0000000000..73e323eb2d --- /dev/null +++ b/newsfragments/4475.bugfix.rst @@ -0,0 +1 @@ +Restored package data that went missing in 71.0. This change also incidentally causes tests to be installed once again. \ No newline at end of file From f2a6bb190202577595a45ceebdedb0016b7cf864 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 17 Jul 2024 21:48:13 -0400 Subject: [PATCH 08/23] =?UTF-8?q?Bump=20version:=2071.0.0=20=E2=86=92=2071?= =?UTF-8?q?.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- NEWS.rst | 9 +++++++++ newsfragments/4475.bugfix.rst | 1 - pyproject.toml | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 newsfragments/4475.bugfix.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 24c407b586..3e6e8fd332 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 71.0.0 +current_version = 71.0.1 commit = True tag = True diff --git a/NEWS.rst b/NEWS.rst index 52b10f837b..1b569cc88a 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -1,3 +1,12 @@ +v71.0.1 +======= + +Bugfixes +-------- + +- Restored package data that went missing in 71.0. This change also incidentally causes tests to be installed once again. (#4475) + + v71.0.0 ======= diff --git a/newsfragments/4475.bugfix.rst b/newsfragments/4475.bugfix.rst deleted file mode 100644 index 73e323eb2d..0000000000 --- a/newsfragments/4475.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Restored package data that went missing in 71.0. This change also incidentally causes tests to be installed once again. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index a117304491..b3399570bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ backend-path = ["."] [project] name = "setuptools" -version = "71.0.0" +version = "71.0.1" authors = [ { name = "Python Packaging Authority", email = "distutils-sig@python.org" }, ] From ea5ce1a2e1406a51bd235c8afd854716d4b8a775 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Jul 2024 09:31:58 -0400 Subject: [PATCH 09/23] Update changelog to reflect common experience seen in #4478 and #4483. --- NEWS.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.rst b/NEWS.rst index 1b569cc88a..974aae24fa 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -13,7 +13,7 @@ v71.0.0 Deprecations and Removals ------------------------- -- Now setuptools declares its own dependencies in the ``core`` extra. Dependencies are still vendored for bootstrapping purposes, but setuptools will prefer installed dependencies if present. The ``core`` extra is used for informational purposes and should *not* be declared in package metadata (e.g. ``build-requires``). Downstream packagers can de-vendor by simply removing the ``setuptools/_vendor`` directory. (#2825) +- Now setuptools declares its own dependencies in the ``core`` extra. Dependencies are still vendored for bootstrapping purposes, but setuptools will prefer installed dependencies if present. The ``core`` extra is used for informational purposes and should *not* be declared in package metadata (e.g. ``build-requires``). Downstream packagers can de-vendor by simply removing the ``setuptools/_vendor`` directory. Since Setuptools now prefers installed dependencies, those installing to an environment with old, incompatible dependencies will not work. In that case, either uninstall the incompatible dependencies or upgrade them to satisfy those declared in ``core``. (#2825) v70.3.0 From 284e8afc5a481a1ac40405111058421a0c68c683 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Jul 2024 09:14:31 -0400 Subject: [PATCH 10/23] Add a failing test covering the missed expectation. Ref #4480 --- setuptools/tests/test_setuptools.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/setuptools/tests/test_setuptools.py b/setuptools/tests/test_setuptools.py index 613a52d042..9b7285459a 100644 --- a/setuptools/tests/test_setuptools.py +++ b/setuptools/tests/test_setuptools.py @@ -1,5 +1,6 @@ """Tests for the 'setuptools' package""" +import re import sys import os import distutils.core @@ -315,3 +316,13 @@ def test_wheel_includes_cli_scripts(setuptools_wheel): contents = [f.replace(os.sep, '/') for f in zipfile.namelist()] assert any('cli-64.exe' in member for member in contents) + + +@pytest.mark.xfail(reason="#4480") +def test_wheel_includes_vendored_metadata(setuptools_wheel): + with ZipFile(setuptools_wheel) as zipfile: + contents = [f.replace(os.sep, '/') for f in zipfile.namelist()] + + assert any( + re.search(r'_vendor/.*\.dist-info/METADATA', member) for member in contents + ) From 65e00b6e96c531c2b0be023475bb956ebc976c39 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Jul 2024 09:22:17 -0400 Subject: [PATCH 11/23] Include all vendored files in the sdist. Closes #4480 --- MANIFEST.in | 2 +- newsfragments/4480.bugfix.rst | 1 + setuptools/tests/test_setuptools.py | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 newsfragments/4480.bugfix.rst diff --git a/MANIFEST.in b/MANIFEST.in index c4f12dc68a..092612cb21 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,7 +2,7 @@ recursive-include setuptools *.py *.exe *.xml *.tmpl recursive-include tests *.py recursive-include setuptools/tests *.html recursive-include docs *.py *.txt *.rst *.conf *.css *.css_t Makefile indexsidebar.html -recursive-include setuptools/_vendor *.py *.txt +recursive-include setuptools/_vendor * recursive-include pkg_resources *.py *.txt recursive-include pkg_resources/tests/data * recursive-include tools * diff --git a/newsfragments/4480.bugfix.rst b/newsfragments/4480.bugfix.rst new file mode 100644 index 0000000000..a43949fa7d --- /dev/null +++ b/newsfragments/4480.bugfix.rst @@ -0,0 +1 @@ +Include all vendored files in the sdist. \ No newline at end of file diff --git a/setuptools/tests/test_setuptools.py b/setuptools/tests/test_setuptools.py index 9b7285459a..566af6980e 100644 --- a/setuptools/tests/test_setuptools.py +++ b/setuptools/tests/test_setuptools.py @@ -318,7 +318,6 @@ def test_wheel_includes_cli_scripts(setuptools_wheel): assert any('cli-64.exe' in member for member in contents) -@pytest.mark.xfail(reason="#4480") def test_wheel_includes_vendored_metadata(setuptools_wheel): with ZipFile(setuptools_wheel) as zipfile: contents = [f.replace(os.sep, '/') for f in zipfile.namelist()] From 17b735a260dc6e51cce1edbeb21eaaa5a32ef188 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Jul 2024 09:51:06 -0400 Subject: [PATCH 12/23] =?UTF-8?q?Bump=20version:=2071.0.1=20=E2=86=92=2071?= =?UTF-8?q?.0.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- NEWS.rst | 9 +++++++++ newsfragments/4480.bugfix.rst | 1 - pyproject.toml | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 newsfragments/4480.bugfix.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 3e6e8fd332..6c082474d9 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 71.0.1 +current_version = 71.0.2 commit = True tag = True diff --git a/NEWS.rst b/NEWS.rst index 974aae24fa..cd8adc74a1 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -1,3 +1,12 @@ +v71.0.2 +======= + +Bugfixes +-------- + +- Include all vendored files in the sdist. (#4480) + + v71.0.1 ======= diff --git a/newsfragments/4480.bugfix.rst b/newsfragments/4480.bugfix.rst deleted file mode 100644 index a43949fa7d..0000000000 --- a/newsfragments/4480.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Include all vendored files in the sdist. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index b3399570bc..c814f09b42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ backend-path = ["."] [project] name = "setuptools" -version = "71.0.1" +version = "71.0.2" authors = [ { name = "Python Packaging Authority", email = "distutils-sig@python.org" }, ] From 299d27655f3f3a06d698b9ae06a3e3ad13943e81 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Jul 2024 10:42:40 -0400 Subject: [PATCH 13/23] Reset the backports module when enabling vendored packages. Closes #4476 --- newsfragments/4476.bugfix.rst | 1 + pkg_resources/__init__.py | 2 ++ ruff.toml | 5 +++++ setuptools/__init__.py | 2 ++ 4 files changed, 10 insertions(+) create mode 100644 newsfragments/4476.bugfix.rst diff --git a/newsfragments/4476.bugfix.rst b/newsfragments/4476.bugfix.rst new file mode 100644 index 0000000000..96122578c8 --- /dev/null +++ b/newsfragments/4476.bugfix.rst @@ -0,0 +1 @@ +Reset the backports module when enabling vendored packages. \ No newline at end of file diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 822232a7fb..6b273d4d23 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -75,6 +75,8 @@ import _imp sys.path.extend(((vendor_path := os.path.join(os.path.dirname(os.path.dirname(__file__)), 'setuptools', '_vendor')) not in sys.path) * [vendor_path]) # fmt: skip +# workaround for #4476 +sys.modules.pop('backports', None) # capture these to bypass sandboxing from os import utime diff --git a/ruff.toml b/ruff.toml index be78969cdb..af3c567d83 100644 --- a/ruff.toml +++ b/ruff.toml @@ -43,6 +43,11 @@ ignore = [ "ISC002", ] +# Suppress nuisance warnings about E402 due to workaround for #4476 +[lint.per-file-ignores] +"setuptools/__init__.py" = ["E402"] +"pkg_resources/__init__.py" = ["E402"] + [format] # Enable preview to get hugged parenthesis unwrapping preview = true diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 8b0e494f01..afca08be9c 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -7,6 +7,8 @@ from typing import TYPE_CHECKING sys.path.extend(((vendor_path := os.path.join(os.path.dirname(os.path.dirname(__file__)), 'setuptools', '_vendor')) not in sys.path) * [vendor_path]) # fmt: skip +# workaround for #4476 +sys.modules.pop('backports', None) import _distutils_hack.override # noqa: F401 import distutils.core From 6d915ca1b67d43609714a70bff23526a362dd0f1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Jul 2024 12:48:33 -0400 Subject: [PATCH 14/23] =?UTF-8?q?Bump=20version:=2071.0.2=20=E2=86=92=2071?= =?UTF-8?q?.0.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- NEWS.rst | 9 +++++++++ newsfragments/4476.bugfix.rst | 1 - pyproject.toml | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 newsfragments/4476.bugfix.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 6c082474d9..5648405125 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 71.0.2 +current_version = 71.0.3 commit = True tag = True diff --git a/NEWS.rst b/NEWS.rst index cd8adc74a1..6c72073293 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -1,3 +1,12 @@ +v71.0.3 +======= + +Bugfixes +-------- + +- Reset the backports module when enabling vendored packages. (#4476) + + v71.0.2 ======= diff --git a/newsfragments/4476.bugfix.rst b/newsfragments/4476.bugfix.rst deleted file mode 100644 index 96122578c8..0000000000 --- a/newsfragments/4476.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Reset the backports module when enabling vendored packages. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index c814f09b42..6e93ec1fb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ backend-path = ["."] [project] name = "setuptools" -version = "71.0.2" +version = "71.0.3" authors = [ { name = "Python Packaging Authority", email = "distutils-sig@python.org" }, ] From b4963ff1983a16976d8aab56488a222633f7c827 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Jul 2024 14:17:55 -0400 Subject: [PATCH 15/23] Rely on pytest defaults for reporting. Closes #4491 --- pytest.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index e49b81561a..292b65864c 100644 --- a/pytest.ini +++ b/pytest.ini @@ -4,7 +4,6 @@ addopts= --doctest-modules --import-mode importlib --doctest-glob=pkg_resources/api_tests.txt - -r sxX consider_namespace_packages=true filterwarnings= # Fail on warnings From 6e90cbd45013d0b89f5f5f6f250fc2e70bd146d1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Jul 2024 14:37:50 -0400 Subject: [PATCH 16/23] Revert "Pin Sphinx to <7.4 as workaround for sphinx-doc/sphinx#12613. Closes #4474." This reverts commit aa41ab5de437a96bd62f31c1c1fe5633850e80f4. A fix has been released in 7.4.6 (sphinx-doc/sphinx#12615). --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6e93ec1fb5..bcd2416334 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,9 +99,6 @@ doc = [ # workaround for pypa/setuptools#4333 "pyproject-hooks!=1.1", - - # workaround for sphinx-doc/sphinx#12613 - "sphinx < 7.4", ] ssl = [] certs = [] From dc56040f4ef01fba97624ac0186463c7876e5ec2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Jul 2024 21:34:41 -0400 Subject: [PATCH 17/23] Revert "Fix error when integrating with pip (#3823)" This reverts commit 19cbbadd304c41873e6d1fd531b964eaf675672d, reversing changes made to bd37bfc622a6f2220c2e4e30b18f2cd2904b7da6. --- setuptools/command/egg_info.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 9e63a934e6..fd9b54a411 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -255,8 +255,7 @@ def finalize_options(self): # to the version info # pd = self.distribution._patched_dist - key = getattr(pd, "key", None) or getattr(pd, "name", None) - if pd is not None and key == self.egg_name.lower(): + if pd is not None and pd.key == self.egg_name.lower(): pd._version = self.egg_version pd._parsed_version = packaging.version.Version(self.egg_version) self.distribution._patched_dist = None From fbba8dec6d2fa251e826cb6024740f21d5505d30 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Jul 2024 22:04:21 -0400 Subject: [PATCH 18/23] =?UTF-8?q?=F0=9F=91=B9=20Feed=20the=20hobgoblins=20?= =?UTF-8?q?(delint).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg_resources/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 6b273d4d23..dbcc87d771 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2628,6 +2628,7 @@ def _normalize_cached(filename: StrPath) -> str: ... @overload def _normalize_cached(filename: BytesPath) -> bytes: ... def _normalize_cached(filename: StrOrBytesPath) -> str | bytes: ... + else: @functools.lru_cache(maxsize=None) From c7844325a6b933c8e71be0532848905651c194f7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Jul 2024 21:52:03 -0400 Subject: [PATCH 19/23] Removed lingering unused code around Distribution._patched_dist. Fixes #4489 --- newsfragments/4489.bugfix.rst | 1 + setuptools/command/egg_info.py | 10 ---------- setuptools/dist.py | 18 ------------------ 3 files changed, 1 insertion(+), 28 deletions(-) create mode 100644 newsfragments/4489.bugfix.rst diff --git a/newsfragments/4489.bugfix.rst b/newsfragments/4489.bugfix.rst new file mode 100644 index 0000000000..3f11d73393 --- /dev/null +++ b/newsfragments/4489.bugfix.rst @@ -0,0 +1 @@ +Removed lingering unused code around Distribution._patched_dist. \ No newline at end of file diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index fd9b54a411..30b62f5f2e 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -250,16 +250,6 @@ def finalize_options(self): # self.distribution.metadata.version = self.egg_version - # If we bootstrapped around the lack of a PKG-INFO, as might be the - # case in a fresh checkout, make sure that any special tags get added - # to the version info - # - pd = self.distribution._patched_dist - if pd is not None and pd.key == self.egg_name.lower(): - pd._version = self.egg_version - pd._parsed_version = packaging.version.Version(self.egg_version) - self.distribution._patched_dist = None - def _get_egg_basename(self, py_version=PY_MAJOR, platform=None): """Compute filename of the output egg. Private API.""" return _egg_basename(self.egg_name, self.egg_version, py_version, platform) diff --git a/setuptools/dist.py b/setuptools/dist.py index bcab50ba65..b4496ab986 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -6,7 +6,6 @@ import os import re import sys -from contextlib import suppress from glob import iglob from pathlib import Path from typing import TYPE_CHECKING, MutableMapping @@ -28,7 +27,6 @@ from packaging.version import Version from . import _entry_points -from . import _normalization from . import _reqs from . import command as _ # noqa -- imported for side-effects from ._importlib import metadata @@ -269,24 +267,9 @@ class Distribution(_Distribution): 'extras_require': dict, } - _patched_dist = None # Used by build_py, editable_wheel and install_lib commands for legacy namespaces namespace_packages: list[str] #: :meta private: DEPRECATED - def patch_missing_pkg_info(self, attrs): - # Fake up a replacement for the data that would normally come from - # PKG-INFO, but which might not yet be built if this is a fresh - # checkout. - # - if not attrs or 'name' not in attrs or 'version' not in attrs: - return - name = _normalization.safe_name(str(attrs['name'])).lower() - with suppress(metadata.PackageNotFoundError): - dist = metadata.distribution(name) - if dist is not None and not dist.read_text('PKG-INFO'): - dist._version = _normalization.safe_version(str(attrs['version'])) - self._patched_dist = dist - def __init__(self, attrs: MutableMapping | None = None) -> None: have_package_data = hasattr(self, "package_data") if not have_package_data: @@ -295,7 +278,6 @@ def __init__(self, attrs: MutableMapping | None = None) -> None: self.dist_files: list[tuple[str, str, str]] = [] # Filter-out setuptools' specific options. self.src_root = attrs.pop("src_root", None) - self.patch_missing_pkg_info(attrs) self.dependency_links = attrs.pop('dependency_links', []) self.setup_requires = attrs.pop('setup_requires', []) for ep in metadata.entry_points(group='distutils.setup_keywords'): From f087fb4ca05eb08c46abdd2cd67b18a3f33e3c79 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos Orfanos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Fri, 19 Jul 2024 16:32:46 +0200 Subject: [PATCH 20/23] "preserve" does not require preview any more (jaraco/skeleton#133) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * "preserve" does not require preview any more * Update URL in ruff.toml comment --------- Co-authored-by: Bartosz SÅ‚awecki --- ruff.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ruff.toml b/ruff.toml index 70612985a7..7da4bee791 100644 --- a/ruff.toml +++ b/ruff.toml @@ -22,7 +22,5 @@ ignore = [ ] [format] -# Enable preview, required for quote-style = "preserve" -preview = true -# https://docs.astral.sh/ruff/settings/#format-quote-style +# https://docs.astral.sh/ruff/settings/#format_quote-style quote-style = "preserve" From 30f940e74b599400347d1162b7096f184cc46d31 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos Orfanos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Fri, 19 Jul 2024 16:34:53 +0200 Subject: [PATCH 21/23] Enforce ruff/Perflint rule PERF401 (jaraco/skeleton#132) --- ruff.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/ruff.toml b/ruff.toml index 7da4bee791..f1d03f8379 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,6 +1,7 @@ [lint] extend-select = [ "C901", + "PERF401", "W", ] ignore = [ From ab34814ca3ffe511ad63bb9589da06fd76758db8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 19 Jul 2024 12:33:01 -0400 Subject: [PATCH 22/23] Re-enable preview, this time not for one specific feature, but for all features in preview. Ref jaraco/skeleton#133 --- ruff.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ruff.toml b/ruff.toml index f1d03f8379..922aa1f198 100644 --- a/ruff.toml +++ b/ruff.toml @@ -23,5 +23,8 @@ ignore = [ ] [format] +# Enable preview to get hugged parenthesis unwrapping and other nice surprises +# See https://github.com/jaraco/skeleton/pull/133#issuecomment-2239538373 +preview = true # https://docs.astral.sh/ruff/settings/#format_quote-style quote-style = "preserve" From 48f95c0a1b8aa033d5a489eff8c4a6abc881b743 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 19 Jul 2024 17:49:09 -0400 Subject: [PATCH 23/23] =?UTF-8?q?Bump=20version:=2071.0.3=20=E2=86=92=2071?= =?UTF-8?q?.0.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- NEWS.rst | 9 +++++++++ newsfragments/4489.bugfix.rst | 1 - pyproject.toml | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 newsfragments/4489.bugfix.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 5648405125..c74a2d56c8 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 71.0.3 +current_version = 71.0.4 commit = True tag = True diff --git a/NEWS.rst b/NEWS.rst index 6c72073293..9065b038b7 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -1,3 +1,12 @@ +v71.0.4 +======= + +Bugfixes +-------- + +- Removed lingering unused code around Distribution._patched_dist. (#4489) + + v71.0.3 ======= diff --git a/newsfragments/4489.bugfix.rst b/newsfragments/4489.bugfix.rst deleted file mode 100644 index 3f11d73393..0000000000 --- a/newsfragments/4489.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Removed lingering unused code around Distribution._patched_dist. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index bcd2416334..020f57ee17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ backend-path = ["."] [project] name = "setuptools" -version = "71.0.3" +version = "71.0.4" authors = [ { name = "Python Packaging Authority", email = "distutils-sig@python.org" }, ]