diff --git a/.github/workflows/pyright.yml b/.github/workflows/pyright.yml index 38fb910d850..17a1e2dbbec 100644 --- a/.github/workflows/pyright.yml +++ b/.github/workflows/pyright.yml @@ -26,7 +26,7 @@ env: # For help with static-typing issues, or pyright update, ping @Avasam # # An exact version from https://github.com/microsoft/pyright/releases or "latest" - PYRIGHT_VERSION: "1.1.377" + PYRIGHT_VERSION: "1.1.385" # Environment variable to support color support (jaraco/skeleton#66) FORCE_COLOR: 1 @@ -73,4 +73,5 @@ jobs: uses: jakebailey/pyright-action@v2 with: version: ${{ env.PYRIGHT_VERSION }} + python-version: ${{ matrix.python }} extra-args: --threads diff --git a/mypy.ini b/mypy.ini index 26692755eae..2dc8aab56f7 100644 --- a/mypy.ini +++ b/mypy.ini @@ -52,6 +52,7 @@ disable_error_code = import-not-found # for setuptools to import `_distutils` directly # - or non-stdlib distutils typings are exposed # - 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 @@ -59,7 +60,7 @@ disable_error_code = import-not-found # - jaraco.test: https://github.com/jaraco/jaraco.test/issues/7 # - jaraco.text: https://github.com/jaraco/jaraco.text/issues/17 # - wheel: does not intend on exposing a programmatic API https://github.com/pypa/wheel/pull/610#issuecomment-2081687671 -[mypy-distutils.*,jaraco.develop,jaraco.envs,jaraco.packaging.*,jaraco.path,jaraco.test.*,jaraco.text,wheel.*] +[mypy-distutils.*,jaraco,jaraco.develop,jaraco.envs,jaraco.packaging.*,jaraco.path,jaraco.test.*,jaraco.text,wheel.*] ignore_missing_imports = True # Even when excluding a module, import issues can show up due to following import diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index f1f0ef25358..47824ab66ec 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2648,7 +2648,7 @@ def _cygwin_patch(filename: StrOrBytesPath): # pragma: nocover would probably better, in Cygwin even more so, except that this seems to be by design... """ - return os.path.abspath(filename) if sys.platform == 'cygwin' else filename + return os.path.abspath(filename) if sys.platform == 'cygwin' else filename # type: ignore[type-var] # python/mypy#17952 if TYPE_CHECKING: diff --git a/pyproject.toml b/pyproject.toml index eb6ec110410..72fc6df93a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -136,7 +136,7 @@ type = [ # pin mypy version so a new version doesn't suddenly cause the CI to fail, # until types-setuptools is removed from typeshed. # For help with static-typing issues, or mypy update, ping @Avasam - "mypy==1.11.*", + "mypy==1.12.*", # Typing fixes in version newer than we require at runtime "importlib_metadata>=7.0.2; python_version < '3.10'", # Imported unconditionally in tools/finalize.py diff --git a/setuptools/command/__init__.py b/setuptools/command/__init__.py index bf011e896d9..eea212b819a 100644 --- a/setuptools/command/__init__.py +++ b/setuptools/command/__init__.py @@ -4,9 +4,11 @@ if 'egg' not in bdist.format_commands: try: - bdist.format_commands['egg'] = ('bdist_egg', "Python .egg file") + # format_commands is a dict in vendored distutils + # It used to be a list in older (stdlib) distutils + # We support both for backwards compatibility + bdist.format_commands['egg'] = ('bdist_egg', "Python .egg file") # type: ignore[call-overload] except TypeError: - # For backward compatibility with older distutils (stdlib) bdist.format_command['egg'] = ('bdist_egg', "Python .egg file") bdist.format_commands.append('egg') diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index fa9a2c4d812..65ce735dde6 100644 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -4,6 +4,7 @@ import os import re from itertools import chain +from typing import ClassVar from .._importlib import metadata from ..dist import Distribution @@ -49,7 +50,7 @@ class sdist(orig.sdist): ] distribution: Distribution # override distutils.dist.Distribution with setuptools.dist.Distribution - negative_opt: dict[str, str] = {} + negative_opt: ClassVar[dict[str, str]] = {} README_EXTENSIONS = ['', '.rst', '.txt', '.md'] READMES = tuple('README{0}'.format(ext) for ext in README_EXTENSIONS)