Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 0 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -309,21 +304,13 @@ 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)
- `Self` (new in Python 3.11)
- `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
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 0 additions & 1 deletion stubs/gevent/METADATA.toml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion stubs/jsonschema/METADATA.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion stubs/pyinstaller/METADATA.toml
Original file line number Diff line number Diff line change
@@ -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"]
8 changes: 4 additions & 4 deletions test_cases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
22 changes: 0 additions & 22 deletions tests/check_new_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion tests/regr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down