Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
cec788a
Support Python 3.14
srittau May 7, 2025
84ebc7e
Fix Python version for pyright
srittau May 7, 2025
ab49c93
Don't install stubdefault on Python 3.14
srittau May 7, 2025
6682785
Force beta 1
srittau May 7, 2025
29cf5f5
Message Python version before passing it to mypy
srittau May 8, 2025
285b323
Merge branch 'main' into py3.14
srittau May 9, 2025
4192ec7
Don't install grpcio-tools on Python 3.14
srittau May 9, 2025
adf01ee
Extend comment
srittau May 9, 2025
2e38de5
[geopandas] Add apt_dependencies
srittau May 9, 2025
8fdd476
[geopandas] Add proj-bin to apt_dependencies
srittau May 9, 2025
a8f3f20
[CI] Install apt dependencies when running test cases with pyright
srittau May 9, 2025
551da4d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 9, 2025
ba810f2
sudo
srittau May 9, 2025
dd6dc1d
Don't install aiohttp on Windows 3.14
srittau May 9, 2025
4daf3d7
Fix undefined fields in Python 3.14
srittau May 9, 2025
f73ae65
Shut up flake8
srittau May 9, 2025
bbf45d8
I now understand what flake8 wants from me
srittau May 9, 2025
2ffcedb
Fix __replace__ in ast.pyi
srittau May 9, 2025
ebd3f94
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 9, 2025
753cb3d
Move unused allowlist entries
srittau May 9, 2025
8f19658
Copy entries from old allowlists
srittau May 9, 2025
d3082f4
Remove some new unused allowlist entries
srittau May 9, 2025
a447974
Add allowlist entries for local errors
srittau May 9, 2025
c582190
[CI] Also install apt packages when running mypy_test
srittau May 9, 2025
6f0c627
Update stubtest allowlist from CI run
srittau May 9, 2025
0a4b0e1
Split platform-specific allowlists
srittau May 9, 2025
deb3612
Stubtest allowlist fixes
srittau May 9, 2025
7b482f1
Stubtest allowlist fixes
srittau May 9, 2025
77b1c9c
Switch to 3.14-dev
srittau May 9, 2025
ac49bd6
Merge branch 'main' into py3.14
srittau May 9, 2025
8783206
Fix ast.pyi
srittau May 9, 2025
cb6eb42
Run mypy_test for 3.14 on Python 3.13 for now
srittau May 10, 2025
0528c4a
Fix
srittau May 10, 2025
5611cdb
Fix
srittau May 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev"]
fail-fast: false

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stubtest_stdlib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev"]
fail-fast: false

steps:
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ jobs:
strategy:
matrix:
platform: ["linux", "win32", "darwin"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
# TODO (2025-05-10) "3.13.2" should be "3.14-dev", see below.
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13.2"]
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand All @@ -77,10 +78,17 @@ jobs:
printf "Installing APT packages:\n $(echo $DEPENDENCIES | sed 's/ /\n /g')\n"
sudo apt-get install -qy $DEPENDENCIES
fi
- run: |
# python-version can sometimes be pinned to a specific version or to "-dev", but
# mypy understands only X.Y version numbers.
MYPY_PY_VERSION=$(echo ${{ matrix.python-version }} | cut -d - -f 1 | cut -d . -f 1-2)
- name: Run mypy_test.py
run: |
# TODO: (2025-05-10) This is a bad hack to work around mypy crashing
# when running on Python 3.14. See https://github.com/python/mypy/pull/19020.
if [[ "${{ matrix.python-version }}" == "3.13.2" ]]; then
MYPY_PY_VERSION="3.14"
else
# python-version can sometimes be pinned to a specific version or to "-dev", but
# mypy understands only X.Y version numbers.
MYPY_PY_VERSION=$(echo ${{ matrix.python-version }} | cut -d - -f 1 | cut -d . -f 1-2)
fi
python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=${MYPY_PY_VERSION}

regression-tests:
Expand All @@ -103,7 +111,7 @@ jobs:
strategy:
matrix:
python-platform: ["Linux", "Windows", "Darwin"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ the project the stubs are for, but instead report them here to typeshed.**
Further documentation on stub files, typeshed, and Python's typing system in
general, can also be found at https://typing.readthedocs.io/en/latest/.

Typeshed supports Python versions 3.9 to 3.13.
Typeshed supports Python versions 3.9 to 3.14.

## Using

Expand Down
11 changes: 8 additions & 3 deletions requirements-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@ pyright==1.1.400
pytype==2024.10.11; platform_system != "Windows" and python_version >= "3.10" and python_version < "3.13"

# Libraries used by our various scripts.
aiohttp==3.11.15
grpcio-tools>=1.66.2 # For grpc_tools.protoc
# TODO (2025-05-09): Installing this on Python 3.14 on Windows fails at
# the moment.
aiohttp==3.11.15; python_version < "3.14"
# TODO (2025-05-09): No wheels exist for Python 3.14 yet, slowing down CI
# considerably and prone to fail.
grpcio-tools>=1.66.2; python_version < "3.14" # For grpc_tools.protoc
mypy-protobuf==3.6.0
packaging==24.2
pathspec>=0.11.1
pre-commit
# Required by create_baseline_stubs.py. Must match .pre-commit-config.yaml.
ruff==0.11.4
stubdefaulter==0.1.0
# TODO (2025-05-07): Dependency libcst doesn't support Python 3.14 yet.
stubdefaulter==0.1.0; python_version < "3.14"
termcolor>=2.3
tomli==2.2.1
tomlkit==0.13.2
Expand Down
17 changes: 0 additions & 17 deletions stdlib/@tests/stubtest_allowlists/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,6 @@ _collections_abc.AsyncGenerator.__anext__
_collections_abc.AsyncGenerator.aclose
_collections_abc.AsyncIterator.__anext__

# Pretend typing.ByteString is a Union, to better match its documented semantics.
# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
# because it's not an ABC that makes any sense and was deprecated in 3.12
_collections_abc.ByteString

_collections_abc.Callable # Typing-related weirdness
_collections_abc.Mapping.get # Adding None to the Union messed up mypy
_collections_abc.Sequence.index # Supporting None in end is not mandatory
Expand Down Expand Up @@ -215,12 +210,7 @@ _?ast.stmt.__init__

_ast.ImportFrom.level # None on the class, but never None on instances

ast.Bytes.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Ellipsis.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.ImportFrom.level # None on the class, but never None on instances
ast.NameConstant.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Num.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Str.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.NodeVisitor.visit_\w+ # Methods are discovered dynamically, see #3796
_?asyncio.Future.__init__ # Usually initialized from c object
asyncio.futures.Future.__init__ # Usually initialized from c object
Expand Down Expand Up @@ -312,7 +302,6 @@ enum.auto.__xor__ # enum.auto is magic, see comments
functools._lru_cache_wrapper.cache_parameters # Cannot be detected statically
functools.cached_property.__set__ # doesn't exist, but cached_property is settable by another mechanism

_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None
hmac.new # Raises TypeError if optional argument digestmod is not provided
http.HTTPStatus.description # set in __new__; work-around for enum wierdness
http.HTTPStatus.phrase # set in __new__; work-around for enum wierdness
Expand All @@ -325,7 +314,6 @@ importlib._bootstrap_external.FileLoader.get_resource_reader
importlib._bootstrap_external.FileLoader.load_module
importlib.abc.FileLoader.get_filename
importlib.abc.FileLoader.load_module
importlib.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments.
importlib.machinery.ExtensionFileLoader.get_filename

# We can't distinguish not having a default value from having a default value of inspect.Parameter.empty
Expand Down Expand Up @@ -472,7 +460,6 @@ typing_extensions\.TypeVar.*
typing_extensions\._SpecialForm.*

# Special primitives
typing\.ByteString
typing(_extensions)?\.AbstractSet
typing(_extensions)?\.AsyncGenerator
typing(_extensions)?\.AsyncIterable
Expand Down Expand Up @@ -527,10 +514,6 @@ typing(_extensions)?\.(Async)?ContextManager
typing(_extensions)?\.IO\.__iter__
typing(_extensions)?\.IO\.__next__

# Will always raise. Not included to avoid type checkers inferring that
# TypeAliasType instances are callable.
typing_extensions.TypeAliasType.__call__

types.MethodType.__closure__ # read-only but not actually a property; stubtest thinks it doesn't exist.
types.MethodType.__code__ # read-only but not actually a property; stubtest thinks it doesn't exist.
types.MethodType.__defaults__ # read-only but not actually a property; stubtest thinks it doesn't exist.
Expand Down
23 changes: 23 additions & 0 deletions stdlib/@tests/stubtest_allowlists/darwin-py314.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ====================================================================
# TODO: New errors in Python 3.14 that need to be fixed or moved below
# ====================================================================

_curses.assume_default_colors
_posixsubprocess.fork_exec
asyncio.tools
asyncio.unix_events.__all__
asyncio.unix_events.DefaultEventLoopPolicy
asyncio.unix_events._DefaultEventLoopPolicy
ctypes.c_double_complex._type_
ctypes.c_float_complex._type_
ctypes.c_longdouble_complex._type_
multiprocessing.popen_fork.Popen.interrupt
multiprocessing.reduction.ACKNOWLEDGE
posix.readinto


# =======
# >= 3.13
# =======

(mmap.MAP_32BIT)? # Exists locally on MacOS but not on GitHub
36 changes: 36 additions & 0 deletions stdlib/@tests/stubtest_allowlists/linux-py314.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# ====================================================================
# TODO: New errors in Python 3.14 that need to be fixed or moved below
# ====================================================================

_curses.assume_default_colors
_posixsubprocess.fork_exec
_socket.CAN_RAW_ERR_FILTER
_socket.IPV6_RECVERR
_socket.IP_FREEBIND
_socket.IP_RECVERR
_socket.IP_RECVORIGDSTADDR
_socket.SO_ORIGINAL_DST
_socket.VMADDR_CID_LOCAL
asyncio.tools
asyncio.unix_events.__all__
asyncio.unix_events.DefaultEventLoopPolicy
asyncio.unix_events._DefaultEventLoopPolicy
ctypes.c_double_complex._type_
ctypes.c_float_complex._type_
ctypes.c_longdouble_complex._type_
errno.EHWPOISON
multiprocessing.popen_fork.Popen.interrupt
multiprocessing.reduction.ACKNOWLEDGE
os.SCHED_DEADLINE
os.SCHED_NORMAL
posix.SCHED_DEADLINE
posix.SCHED_NORMAL
posix.readinto
select.EPOLLWAKEUP
socket.CAN_RAW_ERR_FILTER
socket.IPV6_RECVERR
socket.IP_FREEBIND
socket.IP_RECVERR
socket.IP_RECVORIGDSTADDR
socket.SO_ORIGINAL_DST
socket.VMADDR_CID_LOCAL
26 changes: 26 additions & 0 deletions stdlib/@tests/stubtest_allowlists/py310.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,32 @@ tkinter.tix.TclVersion
tkinter.tix.TkVersion


# =======
# <= 3.13
# =======

# Pretend typing.ByteString is a Union, to better match its documented semantics.
# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
# because it's not an ABC that makes any sense and was deprecated in 3.12
_collections_abc.ByteString

ast.Bytes.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Ellipsis.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.NameConstant.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Num.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Str.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs

_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None

importlib.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments.

typing\.ByteString

# Will always raise. Not included to avoid type checkers inferring that
# TypeAliasType instances are callable.
typing_extensions.TypeAliasType.__call__


# =============================================================
# Allowlist entries that cannot or should not be fixed; >= 3.10
# =============================================================
Expand Down
26 changes: 26 additions & 0 deletions stdlib/@tests/stubtest_allowlists/py311.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,32 @@ tkinter.tix.TclVersion
tkinter.tix.TkVersion


# =======
# <= 3.13
# =======

# Pretend typing.ByteString is a Union, to better match its documented semantics.
# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
# because it's not an ABC that makes any sense and was deprecated in 3.12
_collections_abc.ByteString

ast.Bytes.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Ellipsis.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.NameConstant.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Num.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Str.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs

_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None

importlib.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments.

typing\.ByteString

# Will always raise. Not included to avoid type checkers inferring that
# TypeAliasType instances are callable.
typing_extensions.TypeAliasType.__call__


# =============================================================
# Allowlist entries that cannot or should not be fixed; >= 3.11
# =============================================================
Expand Down
26 changes: 26 additions & 0 deletions stdlib/@tests/stubtest_allowlists/py312.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,32 @@ tkinter.tix.TclVersion
tkinter.tix.TkVersion


# =======
# <= 3.13
# =======

# Pretend typing.ByteString is a Union, to better match its documented semantics.
# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
# because it's not an ABC that makes any sense and was deprecated in 3.12
_collections_abc.ByteString

ast.Bytes.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Ellipsis.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.NameConstant.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Num.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Str.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs

_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None

importlib.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments.

typing\.ByteString

# Will always raise. Not included to avoid type checkers inferring that
# TypeAliasType instances are callable.
typing_extensions.TypeAliasType.__call__


# =============================================================
# Allowlist entries that cannot or should not be fixed; >= 3.12
# =============================================================
Expand Down
26 changes: 26 additions & 0 deletions stdlib/@tests/stubtest_allowlists/py313.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,32 @@ typing(_extensions)?\.IO\.write
typing(_extensions)?\.IO\.writelines


# =======
# <= 3.13
# =======

# Pretend typing.ByteString is a Union, to better match its documented semantics.
# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
# because it's not an ABC that makes any sense and was deprecated in 3.12
_collections_abc.ByteString

ast.Bytes.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Ellipsis.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.NameConstant.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Num.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
ast.Str.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs

_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None

importlib.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments.

typing\.ByteString

# Will always raise. Not included to avoid type checkers inferring that
# TypeAliasType instances are callable.
typing_extensions.TypeAliasType.__call__


# =============================================================
# Allowlist entries that cannot or should not be fixed; >= 3.13
# =============================================================
Expand Down
Loading