From a27fa9df09d0801b2db1011aeb262dc9cd15e496 Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 9 Feb 2026 10:29:44 -0500 Subject: [PATCH] Cleanup `pkg_resources` dependencies and configuration --- MANIFEST.in | 2 -- conftest.py | 1 - docs/development/developer-guide.rst | 3 +-- mypy.ini | 26 ++++++++++---------------- newsfragments/5175.misc.rst | 1 + pyproject.toml | 3 --- ruff.toml | 3 --- tox.ini | 1 - 8 files changed, 12 insertions(+), 28 deletions(-) create mode 100644 newsfragments/5175.misc.rst diff --git a/MANIFEST.in b/MANIFEST.in index 0643e7ee2d..7266e23fd0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,8 +3,6 @@ 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 * -recursive-include pkg_resources *.py *.txt -recursive-include pkg_resources/tests/data * recursive-include tools * recursive-include newsfragments * include *.py diff --git a/conftest.py b/conftest.py index 0807a8d3d0..023857d499 100644 --- a/conftest.py +++ b/conftest.py @@ -32,7 +32,6 @@ def pytest_configure(config): 'setuptools/tests/mod_with_constant.py', 'setuptools/_distutils', '_distutils_hack', - 'pkg_resources/tests/data', 'setuptools/_vendor', 'setuptools/config/_validate_pyproject', 'setuptools/modified.py', diff --git a/docs/development/developer-guide.rst b/docs/development/developer-guide.rst index ae1b58f2f5..917594cd34 100644 --- a/docs/development/developer-guide.rst +++ b/docs/development/developer-guide.rst @@ -122,8 +122,7 @@ cannot be declared as they won't be resolved soon enough to build setuptools from source. Eventually, this limitation may be lifted as PEP 517/518 reach ubiquitous adoption, but for now, Setuptools cannot declare dependencies other than through -``setuptools/_vendor/vendored.txt`` and -``pkg_resources/_vendor/vendored.txt``. +``setuptools/_vendor/vendored.txt``. All the dependencies specified in these files are "vendorized" using a simple Python script ``tools/vendor.py``. diff --git a/mypy.ini b/mypy.ini index c1d01a42c3..979e5af00c 100644 --- a/mypy.ini +++ b/mypy.ini @@ -31,9 +31,8 @@ exclude = (?x)( # These are vendored | ^setuptools/_vendor/ | ^setuptools/_distutils/ - # Duplicate module name - | ^pkg_resources/tests/data/my-test-package-source/setup.py$ ) + [mypy-setuptools.*] disable_error_code = # DistributionMetadata.license_files and DistributionMetadata.license_file @@ -43,30 +42,25 @@ disable_error_code = # See issue described below about distutils across Python versions has-type, -# - pkg_resources tests create modules that won't exists statically before the test is run. -# Let's ignore all "import-not-found" since, if an import really wasn't found, then the test would fail. -[mypy-pkg_resources.tests.*] -disable_error_code = import-not-found - -# - distutils doesn't exist on Python 3.12, unfortunately, this means typing -# will be missing for subclasses of distutils on Python 3.12 until either: -# - support for `SETUPTOOLS_USE_DISTUTILS=stdlib` is dropped (#3625) -# for setuptools to import `_distutils` directly -# - or non-stdlib distutils typings are exposed +# distutils doesn't exist on Python 3.12, unfortunately, this means typing +# will be missing for subclasses of distutils on Python 3.12 until either: +# - support for `SETUPTOOLS_USE_DISTUTILS=stdlib` is dropped (#3625) +# for setuptools to import `_distutils` directly +# - or non-stdlib distutils typings are exposed [mypy-distutils.*] ignore_missing_imports = True -# - wheel: does not intend on exposing a programmatic API https://github.com/pypa/wheel/pull/610#issuecomment-2081687671 +# wheel: does not intend on exposing a programmatic API https://github.com/pypa/wheel/pull/610#issuecomment-2081687671 [mypy-wheel.*] follow_untyped_imports = True -# - The following are not marked as py.typed: + +# The following are not marked as py.typed: # - jaraco: Since mypy 1.12, the root name of the untyped namespace package gets called-out too # - jaraco.develop: https://github.com/jaraco/jaraco.develop/issues/22 # - jaraco.envs: https://github.com/jaraco/jaraco.envs/issues/7 # - jaraco.packaging: https://github.com/jaraco/jaraco.packaging/issues/20 # - jaraco.path: https://github.com/jaraco/jaraco.path/issues/2 -# - jaraco.text: https://github.com/jaraco/jaraco.text/issues/17 -[mypy-jaraco,jaraco.develop.*,jaraco.envs,jaraco.packaging.*,jaraco.path,jaraco.text] +[mypy-jaraco,jaraco.develop.*,jaraco.envs,jaraco.packaging.*,jaraco.path] follow_untyped_imports = True # Even when excluding a module, import issues can show up due to following import diff --git a/newsfragments/5175.misc.rst b/newsfragments/5175.misc.rst new file mode 100644 index 0000000000..06bd3ca10d --- /dev/null +++ b/newsfragments/5175.misc.rst @@ -0,0 +1 @@ +Cleanup `pkg_resources` dependencies and configuration -- by :user:`Avasam` diff --git a/pyproject.toml b/pyproject.toml index 4864673e99..d8d6de2d48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,9 +102,6 @@ core = [ "tomli>=2.0.1; python_version < '3.11'", "wheel>=0.43.0", - # pkg_resources - "platformdirs >= 4.2.2", # Made ctypes optional (see #4461) - # for distutils "jaraco.functools >= 4", "more_itertools", diff --git a/ruff.toml b/ruff.toml index 567074d50a..9525996ab0 100644 --- a/ruff.toml +++ b/ruff.toml @@ -72,9 +72,6 @@ ignore = [ [lint.per-file-ignores] # Suppress nuisance warnings about module-import-not-at-top-of-file (E402) due to workaround for #4476 "setuptools/__init__.py" = ["E402"] -# pkg_resources is due for removal, not worth fixing existing errors -"pkg_resources/__init__.py" = ["E402", "ANN204"] -"pkg_resources/tests/test_resources.py" = ["PT031"] [lint.isort] combine-as-imports = true diff --git a/tox.ini b/tox.ini index 33d6a3c09f..589a81ebe8 100644 --- a/tox.ini +++ b/tox.ini @@ -22,7 +22,6 @@ pass_env = PRE_BUILT_SETUPTOOLS_SDIST TIMEOUT_BACKEND_TEST # timeout (in seconds) for test_build_meta SSH_AUTH_SOCK # for exercise.py if repo was checked out with ssh - windir # required for test_pkg_resources # honor git config in pytest-perf HOME