mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-25 05:11:09 +08:00
Add 3.13 to our CI (#11926)
This commit is contained in:
28
.github/workflows/tests.yml
vendored
28
.github/workflows/tests.yml
vendored
@@ -73,6 +73,26 @@ jobs:
|
||||
- run: uv pip install -r requirements-tests.txt --system
|
||||
- run: python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=${{ matrix.python-version }}
|
||||
|
||||
# Run this as a separate job, as the other versions in the matrix are
|
||||
# (and should be) run *using* the Python version we're testing the stubs for,
|
||||
# but we can't install all our non-types dependencies on py313 yet
|
||||
mypy-313:
|
||||
name: Run mypy against the 3.13 stubs
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
platform: ["linux", "win32", "darwin"]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.12
|
||||
allow-prereleases: true
|
||||
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
- run: uv pip install -r requirements-tests.txt --system
|
||||
- run: python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=3.13
|
||||
|
||||
regression-tests:
|
||||
name: Run mypy on the test cases
|
||||
runs-on: ubuntu-latest
|
||||
@@ -93,7 +113,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
python-platform: ["Linux", "Windows", "Darwin"]
|
||||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
||||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -125,14 +145,14 @@ jobs:
|
||||
version: PATH
|
||||
python-platform: ${{ matrix.python-platform }}
|
||||
python-version: ${{ matrix.python-version }}
|
||||
annotate: ${{ matrix.python-version == '3.11' && matrix.python-platform == 'Linux' }} # Having each job create the same comment is too noisy.
|
||||
annotate: ${{ matrix.python-version == '3.12' && matrix.python-platform == 'Linux' }} # Having each job create the same comment is too noisy.
|
||||
- name: Run pyright with stricter settings on some of the stubs
|
||||
uses: jakebailey/pyright-action@v2
|
||||
with:
|
||||
version: PATH
|
||||
python-platform: ${{ matrix.python-platform }}
|
||||
python-version: ${{ matrix.python-version }}
|
||||
annotate: ${{ matrix.python-version == '3.11' && matrix.python-platform == 'Linux' }} # Having each job create the same comment is too noisy.
|
||||
annotate: ${{ matrix.python-version == '3.12' && matrix.python-platform == 'Linux' }} # Having each job create the same comment is too noisy.
|
||||
project: ./pyrightconfig.stricter.json
|
||||
- name: Run pyright on the test cases
|
||||
uses: jakebailey/pyright-action@v2
|
||||
@@ -140,7 +160,7 @@ jobs:
|
||||
version: PATH
|
||||
python-platform: ${{ matrix.python-platform }}
|
||||
python-version: ${{ matrix.python-version }}
|
||||
annotate: ${{ matrix.python-version == '3.11' && matrix.python-platform == 'Linux' }} # Having each job create the same comment is too noisy.
|
||||
annotate: ${{ matrix.python-version == '3.12' && matrix.python-platform == 'Linux' }} # Having each job create the same comment is too noisy.
|
||||
project: ./pyrightconfig.testcases.json
|
||||
|
||||
stub-uploader:
|
||||
|
||||
@@ -50,7 +50,6 @@ __all__ = [
|
||||
"makeLogRecord",
|
||||
"setLoggerClass",
|
||||
"shutdown",
|
||||
"warn",
|
||||
"warning",
|
||||
"getLogRecordFactory",
|
||||
"setLogRecordFactory",
|
||||
@@ -58,6 +57,8 @@ __all__ = [
|
||||
"raiseExceptions",
|
||||
]
|
||||
|
||||
if sys.version_info < (3, 13):
|
||||
__all__ += ["warn"]
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ += ["getLevelNamesMapping"]
|
||||
if sys.version_info >= (3, 12):
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import sys
|
||||
from _typeshed import SupportsItems, SupportsKeysAndGetItem
|
||||
from _typeshed.wsgi import WSGIEnvironment
|
||||
from cgi import FieldStorage
|
||||
from collections.abc import Collection, Iterable, Iterator, MutableMapping
|
||||
from typing import Any, Literal, TypeVar, overload
|
||||
from typing_extensions import Self
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
_FieldStorage: TypeAlias = Any
|
||||
else:
|
||||
from cgi import FieldStorage as _FieldStorage
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_KT = TypeVar("_KT")
|
||||
@@ -19,7 +24,7 @@ class MultiDict(MutableMapping[_KT, _VT]):
|
||||
@classmethod
|
||||
def view_list(cls, lst: list[tuple[_KT, _VT]]) -> MultiDict[_KT, _VT]: ...
|
||||
@classmethod
|
||||
def from_fieldstorage(cls, fs: FieldStorage) -> MultiDict[str, str | FieldStorage]: ...
|
||||
def from_fieldstorage(cls, fs: _FieldStorage) -> MultiDict[str, str | _FieldStorage]: ...
|
||||
def __getitem__(self, key: _KT) -> _VT: ...
|
||||
def __setitem__(self, key: _KT, value: _VT) -> None: ...
|
||||
def add(self, key: _KT, value: _VT) -> None: ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import datetime
|
||||
import io
|
||||
import sys
|
||||
from _typeshed import ExcInfo, ReadableBuffer, SupportsItems, SupportsKeysAndGetItem, SupportsNoArgReadline, SupportsRead
|
||||
from _typeshed.wsgi import WSGIApplication, WSGIEnvironment
|
||||
from cgi import FieldStorage
|
||||
from collections.abc import Iterable, Mapping
|
||||
from re import Pattern
|
||||
from tempfile import _TemporaryFileWrapper
|
||||
@@ -19,6 +19,11 @@ from webob.headers import EnvironHeaders
|
||||
from webob.multidict import GetDict, MultiDict, NestedMultiDict, NoVars
|
||||
from webob.response import Response, _HTTPHeader
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
_FieldStorage: TypeAlias = Any
|
||||
else:
|
||||
from cgi import FieldStorage as _FieldStorage
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_HTTPMethod: TypeAlias = Literal["GET", "HEAD", "POST", "PUT", "DELETE", "PATCH"]
|
||||
_ListOrTuple: TypeAlias = list[_T] | tuple[_T, ...]
|
||||
@@ -34,7 +39,9 @@ class _RequestCacheControlDict(TypedDict, total=False):
|
||||
no_transform: bool
|
||||
max_age: int
|
||||
|
||||
class _FieldStorageWithFile(FieldStorage):
|
||||
# On py313 this subclasses `Any`, hence the type: ignore.
|
||||
# This is needed for the regr_test.py script, which uses --disallow-subclassing-any
|
||||
class _FieldStorageWithFile(_FieldStorage): # type: ignore[misc]
|
||||
file: IO[bytes]
|
||||
filename: str
|
||||
|
||||
@@ -244,4 +251,4 @@ class Transcoder:
|
||||
errors: str
|
||||
def __init__(self, charset: str, errors: str = "strict") -> None: ...
|
||||
def transcode_query(self, q: str) -> str: ...
|
||||
def transcode_fs(self, fs: FieldStorage, content_type: str) -> io.BytesIO: ...
|
||||
def transcode_fs(self, fs: _FieldStorage, content_type: str) -> io.BytesIO: ...
|
||||
|
||||
@@ -48,7 +48,7 @@ except ImportError:
|
||||
print_error("Cannot import mypy. Did you install it?")
|
||||
sys.exit(1)
|
||||
|
||||
SUPPORTED_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8"]
|
||||
SUPPORTED_VERSIONS = ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]
|
||||
SUPPORTED_PLATFORMS = ("linux", "win32", "darwin")
|
||||
DIRECTORIES_TO_TEST = [Path("stdlib"), Path("stubs")]
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ VENV_DIR = ".venv"
|
||||
TYPESHED = "typeshed"
|
||||
|
||||
SUPPORTED_PLATFORMS = ["linux", "darwin", "win32"]
|
||||
SUPPORTED_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8"]
|
||||
SUPPORTED_VERSIONS = ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]
|
||||
|
||||
|
||||
def distribution_with_test_cases(distribution_name: str) -> DistributionTests:
|
||||
|
||||
@@ -62,7 +62,7 @@ def main() -> None:
|
||||
parser.add_argument(
|
||||
"--python-version",
|
||||
default=_PYTHON_VERSION,
|
||||
choices=("3.8", "3.9", "3.10", "3.11", "3.12"),
|
||||
choices=("3.8", "3.9", "3.10", "3.11", "3.12", "3.13"),
|
||||
help="Target Python version for the test (default: %(default)s).",
|
||||
)
|
||||
parser.add_argument("path", help="Path of the stub to test in format <folder>/<stub>, from the root of the project.")
|
||||
|
||||
@@ -13,7 +13,7 @@ from utils import colored, print_error
|
||||
ReturnCode: TypeAlias = int
|
||||
|
||||
SUPPORTED_PLATFORMS = ("linux", "darwin", "win32")
|
||||
SUPPORTED_VERSIONS = ("3.12", "3.11", "3.10", "3.9")
|
||||
SUPPORTED_VERSIONS = ("3.13", "3.12", "3.11", "3.10", "3.9")
|
||||
LOWEST_SUPPORTED_VERSION = min(SUPPORTED_VERSIONS, key=lambda x: int(x.split(".")[1]))
|
||||
DIRECTORIES_TO_TEST = ("scripts", "tests")
|
||||
EMPTY: list[str] = []
|
||||
|
||||
Reference in New Issue
Block a user