Skip to content

Commit 18a2fe1

Browse files
committed
Add Python 3.15 test infrastructure
1 parent d1198ba commit 18a2fe1

16 files changed

Lines changed: 642 additions & 39 deletions

File tree

.github/workflows/daily.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
matrix:
3737
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
38-
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
38+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
3939
exclude:
4040
# https://github.com/python/typeshed/issues/15694
4141
- os: "windows-latest"

.github/workflows/stubtest_stdlib.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
matrix:
3333
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
34-
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
34+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
3535
exclude:
3636
# https://github.com/python/typeshed/issues/15694
3737
- os: "windows-latest"

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
strategy:
4343
matrix:
4444
platform: ["linux", "win32", "darwin"]
45-
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
45+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
4646
fail-fast: false
4747
steps:
4848
- uses: actions/checkout@v6
@@ -71,7 +71,7 @@ jobs:
7171
- uses: actions/checkout@v6
7272
- uses: actions/setup-python@v6
7373
with:
74-
python-version: "3.14"
74+
python-version: "3.15"
7575
- uses: astral-sh/setup-uv@v7
7676
with:
7777
version-file: "requirements-tests.txt"
@@ -84,7 +84,7 @@ jobs:
8484
strategy:
8585
matrix:
8686
python-platform: ["Linux", "Windows", "Darwin"]
87-
python-version: ["3.11", "3.12", "3.13", "3.14"]
87+
python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
8888
fail-fast: false
8989
steps:
9090
- uses: actions/checkout@v6

requirements-tests.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ pyright==1.1.409
55

66
# Libraries used by our various scripts.
77
aiohttp==3.13.5
8-
grpcio-tools>=1.76.0 # For grpc_tools.protoc
9-
mypy-protobuf==5.0.0
8+
grpcio-tools>=1.76.0; python_version < "3.15" # For grpc_tools.protoc
9+
mypy-protobuf==5.0.0; python_version < "3.15"
1010
packaging==26.0
1111
pathspec>=1.1.1
1212
pre-commit
13-
# Required by create_baseline_stubs.py. Must match .pre-commit-config.yaml.
13+
# Required by create_baseline_stubs.py.
14+
# stubdefaulter depends on libcst, which does not yet install cleanly on Python 3.15.
1415
ruff==0.15.8
15-
stubdefaulter==0.1.0
16+
stubdefaulter==0.1.0; python_version < "3.15"
1617
termcolor>=2.3
1718
tomli==2.4.1; python_version < "3.11"
1819
tomlkit==0.14.0

scripts/sync_protobuf/_utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@
44
import sys
55
from collections.abc import Iterable
66
from http.client import HTTPResponse
7+
from importlib.metadata import PackageNotFoundError, version
78
from pathlib import Path
89
from typing import TYPE_CHECKING
910
from urllib.request import urlopen
1011
from zipfile import ZipFile
1112

12-
from mypy_protobuf.main import ( # type: ignore[import-untyped] # pyright: ignore[reportMissingTypeStubs]
13-
__version__ as mypy_protobuf__version__,
14-
)
13+
try:
14+
_mypy_protobuf_version = version("mypy-protobuf")
15+
except PackageNotFoundError:
16+
_mypy_protobuf_version = "unavailable"
1517

1618
if TYPE_CHECKING:
1719
from _typeshed import StrOrBytesPath, StrPath
1820

19-
MYPY_PROTOBUF_VERSION = mypy_protobuf__version__
21+
MYPY_PROTOBUF_VERSION = _mypy_protobuf_version
2022

2123

2224
def download_file(url: str, destination: Path) -> None:

stdlib/@tests/stubtest_allowlists/common.txt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
importlib.abc.MetaPathFinder.find_spec # Not defined on the actual class, but expected to exist.
88
importlib.abc.PathEntryFinder.find_spec # Not defined on the actual class, but expected to exist.
9-
tkinter.simpledialog.[A-Z_]+
10-
tkinter.simpledialog.TclVersion
11-
tkinter.simpledialog.TkVersion
129
tarfile.TarInfo.__slots__ # it's a big dictionary at runtime and the dictionary values are a bit long
1310

1411

@@ -457,17 +454,6 @@ typing(_extensions)?\.TextIO\.newlines
457454
typing(_extensions)?\.IO\.__iter__
458455
typing(_extensions)?\.IO\.__next__
459456

460-
# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
461-
# to mark these as positional-only for compatibility with existing sub-classes.
462-
typing(_extensions)?\.BinaryIO\.write
463-
typing(_extensions)?\.IO\.read
464-
typing(_extensions)?\.IO\.readline
465-
typing(_extensions)?\.IO\.readlines
466-
typing(_extensions)?\.IO\.seek
467-
typing(_extensions)?\.IO\.truncate
468-
typing(_extensions)?\.IO\.write
469-
typing(_extensions)?\.IO\.writelines
470-
471457
types.MethodType.__closure__ # read-only but not actually a property; stubtest thinks it doesn't exist.
472458
types.MethodType.__code__ # read-only but not actually a property; stubtest thinks it doesn't exist.
473459
types.MethodType.__defaults__ # read-only but not actually a property; stubtest thinks it doesn't exist.
@@ -499,7 +485,3 @@ xml.etree.ElementTree.XMLParser.__init__ # Defined in C so has general signatur
499485
# Iterable classes that don't define __iter__ at runtime (usually iterable via __getitem__)
500486
# These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220
501487
xml.etree.ElementTree.Element.__iter__
502-
503-
# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
504-
posixpath.join
505-
ntpath.join

stdlib/@tests/stubtest_allowlists/py310.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# New errors in Python 3.10
33
# =========================
44

5-
65
# =========
76
# 3.10 only
87
# =========
@@ -134,6 +133,35 @@ importlib.abc.Traversable.open # Problematic protocol signature at runtime, see
134133
typing_extensions.TypeAliasType.__call__
135134

136135

136+
# =====
137+
# <3.15
138+
# =====
139+
140+
tkinter.simpledialog.[A-Z_]+
141+
tkinter.simpledialog.TclVersion
142+
tkinter.simpledialog.TkVersion
143+
144+
145+
# =============================================================
146+
# Allowlist entries that cannot or should not be fixed; <3.15
147+
# =============================================================
148+
149+
# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
150+
# to mark these as positional-only for compatibility with existing sub-classes.
151+
typing(_extensions)?\.BinaryIO\.write
152+
typing(_extensions)?\.IO\.read
153+
typing(_extensions)?\.IO\.readline
154+
typing(_extensions)?\.IO\.readlines
155+
typing(_extensions)?\.IO\.seek
156+
typing(_extensions)?\.IO\.truncate
157+
typing(_extensions)?\.IO\.write
158+
typing(_extensions)?\.IO\.writelines
159+
160+
# These have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
161+
posixpath.join
162+
ntpath.join
163+
164+
137165
# ===============================================================
138166
# Allowlist entries that cannot or should not be fixed; 3.10 only
139167
# ===============================================================

stdlib/@tests/stubtest_allowlists/py311.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# New errors in Python 3.11
33
# =========================
44

5-
65
# =======
76
# >= 3.11
87
# =======
@@ -108,6 +107,35 @@ typing_extensions.TypeAliasType.__call__
108107
enum.Enum.__init__
109108

110109

110+
# =====
111+
# <3.15
112+
# =====
113+
114+
tkinter.simpledialog.[A-Z_]+
115+
tkinter.simpledialog.TclVersion
116+
tkinter.simpledialog.TkVersion
117+
118+
119+
# =============================================================
120+
# Allowlist entries that cannot or should not be fixed; <3.15
121+
# =============================================================
122+
123+
# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
124+
# to mark these as positional-only for compatibility with existing sub-classes.
125+
typing(_extensions)?\.BinaryIO\.write
126+
typing(_extensions)?\.IO\.read
127+
typing(_extensions)?\.IO\.readline
128+
typing(_extensions)?\.IO\.readlines
129+
typing(_extensions)?\.IO\.seek
130+
typing(_extensions)?\.IO\.truncate
131+
typing(_extensions)?\.IO\.write
132+
typing(_extensions)?\.IO\.writelines
133+
134+
# These have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
135+
posixpath.join
136+
ntpath.join
137+
138+
111139
# =============================================================
112140
# Allowlist entries that cannot or should not be fixed; >= 3.11
113141
# =============================================================

stdlib/@tests/stubtest_allowlists/py312.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# New errors in Python 3.12
33
# =========================
44

5-
65
# =======
76
# >= 3.12
87
# =======
@@ -101,6 +100,35 @@ _?hashlib.scrypt # Raises TypeError if salt, n, r or p are None
101100
typing_extensions.TypeAliasType.__call__
102101

103102

103+
# =====
104+
# <3.15
105+
# =====
106+
107+
tkinter.simpledialog.[A-Z_]+
108+
tkinter.simpledialog.TclVersion
109+
tkinter.simpledialog.TkVersion
110+
111+
112+
# =============================================================
113+
# Allowlist entries that cannot or should not be fixed; <3.15
114+
# =============================================================
115+
116+
# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
117+
# to mark these as positional-only for compatibility with existing sub-classes.
118+
typing(_extensions)?\.BinaryIO\.write
119+
typing(_extensions)?\.IO\.read
120+
typing(_extensions)?\.IO\.readline
121+
typing(_extensions)?\.IO\.readlines
122+
typing(_extensions)?\.IO\.seek
123+
typing(_extensions)?\.IO\.truncate
124+
typing(_extensions)?\.IO\.write
125+
typing(_extensions)?\.IO\.writelines
126+
127+
# These have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
128+
posixpath.join
129+
ntpath.join
130+
131+
104132
# =============================================================
105133
# Allowlist entries that cannot or should not be fixed; >= 3.12
106134
# =============================================================

stdlib/@tests/stubtest_allowlists/py313.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# New errors in Python 3.13
33
# =========================
44

5-
65
# ====================================
76
# Pre-existing errors from Python 3.12
87
# ====================================
@@ -54,6 +53,35 @@ _?hashlib.scrypt # Raises TypeError if salt, n, r or p are None
5453
typing_extensions.TypeAliasType.__call__
5554

5655

56+
# =====
57+
# <3.15
58+
# =====
59+
60+
tkinter.simpledialog.[A-Z_]+
61+
tkinter.simpledialog.TclVersion
62+
tkinter.simpledialog.TkVersion
63+
64+
65+
# =============================================================
66+
# Allowlist entries that cannot or should not be fixed; <3.15
67+
# =============================================================
68+
69+
# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
70+
# to mark these as positional-only for compatibility with existing sub-classes.
71+
typing(_extensions)?\.BinaryIO\.write
72+
typing(_extensions)?\.IO\.read
73+
typing(_extensions)?\.IO\.readline
74+
typing(_extensions)?\.IO\.readlines
75+
typing(_extensions)?\.IO\.seek
76+
typing(_extensions)?\.IO\.truncate
77+
typing(_extensions)?\.IO\.write
78+
typing(_extensions)?\.IO\.writelines
79+
80+
# These have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
81+
posixpath.join
82+
ntpath.join
83+
84+
5785
# =============================================================
5886
# Allowlist entries that cannot or should not be fixed; >= 3.13
5987
# =============================================================

0 commit comments

Comments
 (0)