diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fb7b893d4d7f..ec840a821d43 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -125,7 +125,7 @@ jobs: strategy: matrix: python-platform: ["Linux", "Windows", "Darwin"] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] fail-fast: false steps: - uses: actions/checkout@v4 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5800360dfd0c..5779fce3cfa1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -279,11 +279,6 @@ new features to the Python type system. In general, new features can be used in typeshed as soon as the PEP has been accepted and implemented and most type checkers support the new feature. -Accepted features that *cannot* yet be used in typeshed include: -- [PEP 570](https://www.python.org/dev/peps/pep-0570/) (positional-only - arguments): see [#4972](https://github.com/python/typeshed/issues/4972), - use argument names prefixed with `__` instead - The following features are partially supported: - [PEP 702](https://peps.python.org/pep-0702/) (`@deprecated()`) - For now, cannot be used in combination with other decorators @@ -309,10 +304,6 @@ Features from the `typing` module that are not present in all supported Python 3 versions must be imported from `typing_extensions` instead in typeshed stubs. This currently affects: -- `Final` and `@final` (new in Python 3.8) -- `Literal` (new in Python 3.8) -- `SupportsIndex` (new in Python 3.8) -- `TypedDict` (new in Python 3.8) - `Concatenate` (new in Python 3.10) - `ParamSpec` (new in Python 3.10) - `TypeGuard` (new in Python 3.10) @@ -320,10 +311,6 @@ instead in typeshed stubs. This currently affects: - `LiteralString` (new in Python 3.11) - `@deprecated` (new in Python 3.13; in the `warnings` module) -Two exceptions are `Protocol` and `runtime_checkable`: although -these were added in Python 3.8, they can be used in stubs regardless -of Python version. - Some type checkers implicitly promote the `bytearray` and `memoryview` types to `bytes`. [PEP 688](https://www.python.org/dev/peps/pep-0688/) removes diff --git a/README.md b/README.md index d679eedf3930..e4d718097044 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,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 fully supports Python versions 3.8 and up. Support for Python 3.7 -is limited: see https://github.com/python/typeshed/issues/10113 -for details. +Typeshed supports Python versions 3.8 and up. ## Using diff --git a/pyproject.toml b/pyproject.toml index c3a965984573..fb42a5023fd6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,4 +95,4 @@ known-first-party = ["parse_metadata", "utils"] [tool.typeshed] pyright_version = "1.1.342" -oldest_supported_python = "3.7" +oldest_supported_python = "3.8" diff --git a/stubs/gevent/METADATA.toml b/stubs/gevent/METADATA.toml index d3aea63af7d4..ea9119a65e59 100644 --- a/stubs/gevent/METADATA.toml +++ b/stubs/gevent/METADATA.toml @@ -1,7 +1,6 @@ version = "23.9.*" upstream_repository = "https://github.com/gevent/gevent" requires = ["types-greenlet", "types-psutil"] -requires_python = ">=3.8" [tool.stubtest] # Run stubtest on all platforms, since there is some platform specific stuff diff --git a/stubs/jsonschema/METADATA.toml b/stubs/jsonschema/METADATA.toml index eae3a4e3ad1a..971a088d551c 100644 --- a/stubs/jsonschema/METADATA.toml +++ b/stubs/jsonschema/METADATA.toml @@ -2,7 +2,6 @@ version = "4.20.*" upstream_repository = "https://github.com/python-jsonschema/jsonschema" requires = ["referencing"] partial_stub = true -requires_python = ">=3.8" [tool.stubtest] ignore_missing_stub = true diff --git a/stubs/pyinstaller/METADATA.toml b/stubs/pyinstaller/METADATA.toml index c48aa14aed3c..5a0b186fbe6b 100644 --- a/stubs/pyinstaller/METADATA.toml +++ b/stubs/pyinstaller/METADATA.toml @@ -1,7 +1,6 @@ version = "6.3.*" upstream_repository = "https://github.com/pyinstaller/pyinstaller" requires = ["types-setuptools"] -requires_python = ">=3.8" [tool.stubtest] extras = ["completion"] diff --git a/test_cases/README.md b/test_cases/README.md index 5624290a56df..437ae4552bcb 100644 --- a/test_cases/README.md +++ b/test_cases/README.md @@ -113,12 +113,12 @@ Some tests will only pass on mypy with a specific Python version passed on the command line to the `tests/regr_test.py` script. To mark a test-case file as being skippable on lower versions of Python, append `-py3*` to the filename. -For example, if `foo` is a stdlib feature that's new in Python 3.9, -test cases for `foo` should be put in a file named `test_cases/stdlib/check_foo-py39.py`. +For example, if `foo` is a stdlib feature that's new in Python 3.11, +test cases for `foo` should be put in a file named `test_cases/stdlib/check_foo-py311.py`. This means that mypy will only run the test case -if `--python-version 3.9`, `--python-version 3.10` or `--python-version 3.11` +if `--python-version 3.11`, `--python-version 3.12`, etc. is passed on the command line to `tests/regr_test.py`, -but it *won't* run the test case if `--python-version 3.7` or `--python-version 3.8` +but it _won't_ run the test case if e.g. `--python-version 3.9` is passed on the command line. However, `if sys.version_info >= (3, target):` is still required for `pyright` diff --git a/tests/check_new_syntax.py b/tests/check_new_syntax.py index e0564362c9af..830d1f2e5e2f 100755 --- a/tests/check_new_syntax.py +++ b/tests/check_new_syntax.py @@ -26,29 +26,7 @@ def visit_If(self, node: ast.If) -> None: ) self.generic_visit(node) - class PEP570Finder(ast.NodeVisitor): - def __init__(self) -> None: - self.lineno: int | None = None - - def _visit_function(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None: - old_lineno = self.lineno - self.lineno = node.lineno - self.generic_visit(node) - self.lineno = old_lineno - - visit_FunctionDef = visit_AsyncFunctionDef = _visit_function - - def visit_arguments(self, node: ast.arguments) -> None: - if node.posonlyargs: - assert isinstance(self.lineno, int) - errors.append( - f"{path}:{self.lineno}: PEP-570 syntax cannot be used in typeshed yet. " - f"Prefix parameter names with `__` to indicate positional-only parameters" - ) - self.generic_visit(node) - IfFinder().visit(tree) - PEP570Finder().visit(tree) return errors diff --git a/tests/regr_test.py b/tests/regr_test.py index cc7ede290b9a..3d50aec406ea 100755 --- a/tests/regr_test.py +++ b/tests/regr_test.py @@ -41,7 +41,7 @@ TYPESHED = "typeshed" SUPPORTED_PLATFORMS = ["linux", "darwin", "win32"] -SUPPORTED_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8", "3.7"] +SUPPORTED_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8"] def package_with_test_cases(package_name: str) -> PackageInfo: