From 5a2add23c8f48ed150de37a4c75b27f849b84f54 Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 8 Mar 2024 17:25:56 -0500 Subject: [PATCH 1/4] Update mypy to 1.9 --- mypy.ini | 2 ++ setup.cfg | 1 + setuptools/_core_metadata.py | 2 +- setuptools/command/editable_wheel.py | 3 +-- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index 42ade6537e..90c8ff13e7 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,5 +1,6 @@ [mypy] # CI should test for all versions, local development gets hints for oldest supported +# Some upstream typeshed distutils stubs fixes are necessary before we can start testing on Python 3.12 python_version = 3.8 strict = False warn_unused_ignores = True @@ -8,6 +9,7 @@ explicit_package_bases = True exclude = (?x)( ^build/ | ^.tox/ + | ^.egg/ | ^pkg_resources/tests/data/my-test-package-source/setup.py$ # Duplicate module name | ^.+?/(_vendor|extern)/ # Vendored | ^setuptools/_distutils/ # Vendored diff --git a/setup.cfg b/setup.cfg index 4d1155e884..5231358289 100644 --- a/setup.cfg +++ b/setup.cfg @@ -73,6 +73,7 @@ testing = # for tools/finalize.py jaraco.develop >= 7.21; python_version >= "3.9" and sys_platform != "cygwin" pytest-home >= 0.5 + mypy==1.9 # No Python 3.11 dependencies require tomli, but needed for type-checking since we import it directly tomli # No Python 3.12 dependencies require importlib_metadata, but needed for type-checking since we import it directly diff --git a/setuptools/_core_metadata.py b/setuptools/_core_metadata.py index 4bf3c7c947..5dd97c7719 100644 --- a/setuptools/_core_metadata.py +++ b/setuptools/_core_metadata.py @@ -62,7 +62,7 @@ def _read_list_from_msg(msg: Message, field: str) -> Optional[List[str]]: def _read_payload_from_msg(msg: Message) -> Optional[str]: - value = msg.get_payload().strip() + value = str(msg.get_payload()).strip() if value == 'UNKNOWN' or not value: return None return value diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py index 5f08ab53fc..4d21e2253f 100644 --- a/setuptools/command/editable_wheel.py +++ b/setuptools/command/editable_wheel.py @@ -620,8 +620,7 @@ def _simple_layout( layout = {pkg: find_package_path(pkg, package_dir, project_dir) for pkg in packages} if not layout: return set(package_dir) in ({}, {""}) - # TODO: has been fixed upstream, waiting for new mypy release https://github.com/python/typeshed/pull/11310 - parent = os.path.commonpath(starmap(_parent_path, layout.items())) # type: ignore[call-overload] + parent = os.path.commonpath(starmap(_parent_path, layout.items())) return all( _path.same_path(Path(parent, *key.split('.')), value) for key, value in layout.items() From 1749aea0e4c1f92e7e46f4b6dcd250fc0b992933 Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 8 Mar 2024 19:27:59 -0500 Subject: [PATCH 2/4] Update cache action to v4 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e841bde57c..4d65b0dad4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,7 @@ jobs: with: python-version: ${{ matrix.python }} allow-prereleases: true - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: cache with: path: setuptools/tests/config/downloads/*.cfg From 0575cc5fadf3e49944c901bbdeb6cf3ca94a73ae Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 11 Mar 2024 11:45:04 +0000 Subject: [PATCH 3/4] Update setup.cfg --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 5231358289..c41b226e0c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -73,7 +73,7 @@ testing = # for tools/finalize.py jaraco.develop >= 7.21; python_version >= "3.9" and sys_platform != "cygwin" pytest-home >= 0.5 - mypy==1.9 + mypy==1.9 # pin mypy version so a new version doesn't suddenly cause the CI to fail # No Python 3.11 dependencies require tomli, but needed for type-checking since we import it directly tomli # No Python 3.12 dependencies require importlib_metadata, but needed for type-checking since we import it directly From 6efc720f0fdd79e0689f81acba3fe45878ec43a3 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 10 Mar 2024 20:57:58 +0100 Subject: [PATCH 4/4] Fix a couple typos found by codespell --- pkg_resources/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 163a5521d6..c2ba0476e5 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -3193,7 +3193,7 @@ def _find_adapter(registry, ob): for t in types: if t in registry: return registry[t] - # _find_adapter would previously return None, and immediatly be called. + # _find_adapter would previously return None, and immediately be called. # So we're raising a TypeError to keep backward compatibility if anyone depended on that behaviour. raise TypeError(f"Could not find adapter for {registry} and {ob}") diff --git a/setup.py b/setup.py index 1a6074766a..542edaea68 100755 --- a/setup.py +++ b/setup.py @@ -88,6 +88,6 @@ def _restore_install_lib(self): if __name__ == '__main__': # allow setup.py to run from another directory - # TODO: Use a proper conditonal statement here + # TODO: Use a proper conditional statement here here and os.chdir(here) # type: ignore[func-returns-value] dist = setuptools.setup(**setup_params)