Drop support for Python 3.7 (#11234)

This commit is contained in:
Sebastian Rittau
2024-01-04 14:48:44 +01:00
committed by GitHub
parent 262d73c90c
commit 4e5f7a7142
10 changed files with 8 additions and 48 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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"]

View File

@@ -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`

View File

@@ -26,29 +26,7 @@ def check_new_syntax(tree: ast.AST, path: Path, stub: str) -> list[str]:
)
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

View File

@@ -41,7 +41,7 @@ VENV_DIR = ".venv"
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: