Skip to content

Commit 24934db

Browse files
authored
Bump mypy to 1.12 and pyright to 1.1.385 (#4688)
2 parents 89b4401 + 206c4b8 commit 24934db

File tree

7 files changed

+19
-7
lines changed

7 files changed

+19
-7
lines changed

.github/workflows/pyright.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ env:
2626
# For help with static-typing issues, or pyright update, ping @Avasam
2727
#
2828
# An exact version from https://github.com/microsoft/pyright/releases or "latest"
29-
PYRIGHT_VERSION: "1.1.377"
29+
PYRIGHT_VERSION: "1.1.385"
3030

3131
# Environment variable to support color support (jaraco/skeleton#66)
3232
FORCE_COLOR: 1
@@ -73,4 +73,5 @@ jobs:
7373
uses: jakebailey/pyright-action@v2
7474
with:
7575
version: ${{ env.PYRIGHT_VERSION }}
76+
python-version: ${{ matrix.python }}
7677
extra-args: --threads

mypy.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@ disable_error_code = import-not-found
5252
# for setuptools to import `_distutils` directly
5353
# - or non-stdlib distutils typings are exposed
5454
# - The following are not marked as py.typed:
55+
# - jaraco: Since mypy 1.12, the root name of the untyped namespace package gets called-out too
5556
# - jaraco.develop: https://github.com/jaraco/jaraco.develop/issues/22
5657
# - jaraco.envs: https://github.com/jaraco/jaraco.envs/issues/7
5758
# - jaraco.packaging: https://github.com/jaraco/jaraco.packaging/issues/20
5859
# - jaraco.path: https://github.com/jaraco/jaraco.path/issues/2
5960
# - jaraco.test: https://github.com/jaraco/jaraco.test/issues/7
6061
# - jaraco.text: https://github.com/jaraco/jaraco.text/issues/17
6162
# - wheel: does not intend on exposing a programmatic API https://github.com/pypa/wheel/pull/610#issuecomment-2081687671
62-
[mypy-distutils.*,jaraco.develop,jaraco.envs,jaraco.packaging.*,jaraco.path,jaraco.test.*,jaraco.text,wheel.*]
63+
[mypy-distutils.*,jaraco,jaraco.develop,jaraco.envs,jaraco.packaging.*,jaraco.path,jaraco.test.*,jaraco.text,wheel.*]
6364
ignore_missing_imports = True
6465

6566
# Even when excluding a module, import issues can show up due to following import

pkg_resources/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2648,7 +2648,7 @@ def _cygwin_patch(filename: StrOrBytesPath): # pragma: nocover
26482648
would probably better, in Cygwin even more so, except
26492649
that this seems to be by design...
26502650
"""
2651-
return os.path.abspath(filename) if sys.platform == 'cygwin' else filename
2651+
return os.path.abspath(filename) if sys.platform == 'cygwin' else filename # type: ignore[type-var] # python/mypy#17952
26522652

26532653

26542654
if TYPE_CHECKING:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ type = [
136136
# pin mypy version so a new version doesn't suddenly cause the CI to fail,
137137
# until types-setuptools is removed from typeshed.
138138
# For help with static-typing issues, or mypy update, ping @Avasam
139-
"mypy==1.11.*",
139+
"mypy==1.12.*",
140140
# Typing fixes in version newer than we require at runtime
141141
"importlib_metadata>=7.0.2; python_version < '3.10'",
142142
# Imported unconditionally in tools/finalize.py

setuptools/_path.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111

1212
from more_itertools import unique_everseen
1313

14-
if sys.version_info >= (3, 9):
14+
if TYPE_CHECKING:
1515
StrPath: TypeAlias = Union[str, os.PathLike[str]] # Same as _typeshed.StrPath
1616
else:
17+
# Python 3.8 support
1718
StrPath: TypeAlias = Union[str, os.PathLike]
1819

1920

setuptools/command/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1+
# mypy: disable_error_code=call-overload
2+
# pyright: reportCallIssue=false, reportArgumentType=false
3+
# Can't disable on the exact line because distutils doesn't exists on Python 3.12
4+
# and type-checkers aren't aware of distutils_hack,
5+
# causing distutils.command.bdist.bdist.format_commands to be Any.
6+
17
import sys
28

39
from distutils.command.bdist import bdist
410

511
if 'egg' not in bdist.format_commands:
612
try:
13+
# format_commands is a dict in vendored distutils
14+
# It used to be a list in older (stdlib) distutils
15+
# We support both for backwards compatibility
716
bdist.format_commands['egg'] = ('bdist_egg', "Python .egg file")
817
except TypeError:
9-
# For backward compatibility with older distutils (stdlib)
1018
bdist.format_command['egg'] = ('bdist_egg', "Python .egg file")
1119
bdist.format_commands.append('egg')
1220

setuptools/command/sdist.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import re
66
from itertools import chain
7+
from typing import ClassVar
78

89
from .._importlib import metadata
910
from ..dist import Distribution
@@ -49,7 +50,7 @@ class sdist(orig.sdist):
4950
]
5051

5152
distribution: Distribution # override distutils.dist.Distribution with setuptools.dist.Distribution
52-
negative_opt: dict[str, str] = {}
53+
negative_opt: ClassVar[dict[str, str]] = {}
5354

5455
README_EXTENSIONS = ['', '.rst', '.txt', '.md']
5556
READMES = tuple('README{0}'.format(ext) for ext in README_EXTENSIONS)

0 commit comments

Comments
 (0)