diff --git a/mypy.ini b/mypy.ini index 42ade6537ee..90c8ff13e70 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/pkg_resources/__init__.py b/pkg_resources/__init__.py index 163a5521d67..c2ba0476e51 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.cfg b/setup.cfg index 4d1155e884d..c41b226e0cf 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 # 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 diff --git a/setup.py b/setup.py index 1a6074766a5..542edaea681 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) diff --git a/setuptools/_core_metadata.py b/setuptools/_core_metadata.py index 4bf3c7c947c..5dd97c7719f 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 5f08ab53fca..4d21e2253fa 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()