Skip to content

Split tool.stubtest.platforms metadata key #13746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 31, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/main' into split-platform
  • Loading branch information
srittau committed May 28, 2025
commit 365d36872f91b8c88b6dfae3efb9770ca6b500c3
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# F821: Typeshed is a testing ground for flake8-pyi, which monkeypatches F821
select = Y, F821
# Ignore rules normally excluded by default
extend-ignore = Y090
extend-ignore = Y090,Y091
per-file-ignores =
# Generated protobuf files:
# Y021: Include docstrings
Expand Down
35 changes: 0 additions & 35 deletions .github/renovate.json

This file was deleted.

39 changes: 39 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"dependencyDashboard": true,
"suppressNotifications": ["prEditedNotification"],
"extends": ["config:recommended"],
"labels": ["bot: dependencies"],
"semanticCommits": "disabled",
"separateMajorMinor": false,
"prHourlyLimit": 10,
// This package rule disables updates for `actions/setup-python` Python versions:
// it's better to do these manually as there's often a reason why we can't use
// the latest Python version in CI for a specific job
ignoreDeps: ["python"],
"pre-commit": {
"enabled": true
},
"packageRules": [
{
groupName: "GitHub Actions",
matchManagers: ["github-actions"],
description: "Quarterly update of GitHub Action dependencies",
schedule: ["every 3 months on the first day of the month"]
},
{
groupName: "most test/lint dependencies",
matchManagers: ["pip_requirements", "pre-commit"],
matchPackageNames: ["!pytype", "!pyright"],
description: "Quarterly update of most test dependencies",
schedule: ["every 3 months on the first day of the month"]
},
{
"groupName": "pytype and pyright",
"matchManagers": ["pip_requirements"],
"matchPackageNames": ["pytype", "pyright"],
"description": "Daily update of pyright and pytype",
"schedule": ["before 4am"]
}
]
}
4 changes: 2 additions & 2 deletions .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 Expand Up @@ -116,7 +116,7 @@ jobs:
with:
# Keep in sync with stub_uploader's check_scripts.yml workflow.
python-version: "3.13"
- uses: astral-sh/setup-uv@v5
- uses: astral-sh/setup-uv@v6
- name: Run tests
run: |
cd stub_uploader
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
40 changes: 34 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
with:
# Max supported Python version as of pytype 2024.10.11
python-version: "3.12"
- uses: astral-sh/setup-uv@v5
- uses: astral-sh/setup-uv@v6
- run: uv pip install -r requirements-tests.txt --system
- name: Install external dependencies for 3rd-party stubs
run: |
Expand All @@ -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 @@ -70,7 +71,26 @@ jobs:
python-version: ${{ matrix.python-version }}
- 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=${{ matrix.python-version }}
- name: Install required APT packages
run: |
sudo apt-get update -qy
DEPENDENCIES=$( python tests/get_external_apt_dependencies.py )
if [ -n "$DEPENDENCIES" ]; then
printf "Installing APT packages:\n $(echo $DEPENDENCIES | sed 's/ /\n /g')\n"
sudo apt-get install -qy $DEPENDENCIES
fi
- 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:
name: "mypy: Run test cases"
Expand All @@ -92,17 +112,25 @@ 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
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- uses: astral-sh/setup-uv@v5
- uses: astral-sh/setup-uv@v6
- name: Install typeshed test-suite requirements
# Install these so we can run `get_external_stub_requirements.py`
run: uv pip install -r requirements-tests.txt --system
- name: Install required APT packages
run: |
sudo apt-get update -qy
DEPENDENCIES=$( python tests/get_external_apt_dependencies.py )
if [ -n "$DEPENDENCIES" ]; then
printf "Installing APT packages:\n $(echo $DEPENDENCIES | sed 's/ /\n /g')\n"
sudo apt-get install -qy $DEPENDENCIES
fi
- name: Create an isolated venv for testing
run: uv venv .venv
- name: Install 3rd-party stub dependencies
Expand Down Expand Up @@ -157,7 +185,7 @@ jobs:
with:
# Keep in sync with stub_uploader's check_scripts.yml workflow.
python-version: "3.13"
- uses: astral-sh/setup-uv@v5
- uses: astral-sh/setup-uv@v6
- name: Run tests
run: |
cd stub_uploader
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
args: [--fix=lf]
- id: check-case-conflict
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.3 # must match requirements-tests.txt
rev: v0.11.4 # must match requirements-tests.txt
hooks:
- id: ruff
name: Run ruff on stubs, tests and scripts
Expand All @@ -22,7 +22,7 @@ repos:
name: Run ruff on the test cases
args:
- "--exit-non-zero-on-fix"
- "--select=FA,I,RUF100"
- "--select=FA,I,ICN001,RUF100"
- "--no-force-exclude"
- "--unsafe-fixes"
files: '.*test_cases/.+\.py$'
Expand All @@ -31,12 +31,12 @@ repos:
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.1.2
rev: 7.2.0
hooks:
- id: flake8
language: python
additional_dependencies:
- "flake8-pyi==24.9.0"
- "flake8-pyi==25.5.0"
types: [file]
types_or: [python, pyi]
- repo: meta
Expand Down
55 changes: 29 additions & 26 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ are important to the project's success.

1. [Prepare your environment](#preparing-the-environment).
2. Find out [where to make your changes](#where-to-make-changes).
3. [Prepare your changes](#preparing-changes):
3. [Making your changes](#making-changes):
* Small fixes and additions can be submitted directly as pull requests,
but [contact us](README.md#discussion) before starting significant work.
* Create your stubs, considering [what to include](#what-to-include) and
Expand Down Expand Up @@ -112,29 +112,6 @@ as it's currently excluded from the requirements file:
</tr>
</table>

## Code formatting

The code is formatted using [`Black`](https://github.com/psf/black).
Various other autofixes and lint rules are
also performed by [`Ruff`](https://github.com/astral-sh/ruff) and
[`Flake8`](https://github.com/pycqa/flake8),
with plugin [`flake8-pyi`](https://github.com/pycqa/flake8-pyi).

The repository is equipped with a [pre-commit.ci](https://pre-commit.ci/)
configuration file. This means that you don't *need* to do anything yourself to
run the code formatters or linters. When you push a commit, a bot will run
those for you right away and add any autofixes to your PR. Anything
that can't be autofixed will show up as a CI failure, hopefully with an error
message that will make it clear what's gone wrong.

That being said, if you *want* to run the formatters and linters locally
when you commit, you're free to do so. To use the same configuration as we use
in CI, we recommend doing this via pre-commit:

```bash
(.venv)$ pre-commit run --all-files
```

## Where to make changes

### Standard library stubs
Expand Down Expand Up @@ -257,6 +234,11 @@ This has the following keys:
`win32`, `linux`, and `darwin` values. If not specified, stubtest is run
only on `linux`. Only add extra OSes to the test if there are
platform-specific branches in a stubs package.
* `mypy_plugins` (default: `[]`): A list of Python modules to use as mypy plugins
when running stubtest. For example: `mypy_plugins = ["mypy_django_plugin.main"]`
* `mypy_plugins_config` (default: `{}`): A dictionary mapping plugin names to their
configuration dictionaries for use by mypy plugins. For example:
`mypy_plugins_config = {"django-stubs" = {"django_settings_module" = "@tests.django_settings"}}`

`*_dependencies` are usually packages needed to `pip install` the implementation
distribution.
Expand All @@ -265,7 +247,7 @@ The format of all `METADATA.toml` files can be checked by running
`python3 ./tests/check_typeshed_structure.py`.


## Preparing Changes
## Making Changes

### Before you begin

Expand All @@ -280,6 +262,27 @@ Each Python module is represented by a .pyi "stub file". This is a syntactically

Typeshed follows the standard type system guidelines for [stub content](https://typing.readthedocs.io/en/latest/guides/writing_stubs.html#stub-content) and [coding style](https://typing.readthedocs.io/en/latest/guides/writing_stubs.html#style-guide).

The code is formatted using [`Black`](https://github.com/psf/black).
Various other autofixes and lint rules are
also performed by [`Ruff`](https://github.com/astral-sh/ruff) and
[`Flake8`](https://github.com/pycqa/flake8),
with plugin [`flake8-pyi`](https://github.com/pycqa/flake8-pyi).

The repository is equipped with a [pre-commit.ci](https://pre-commit.ci/)
configuration file. This means that you don't *need* to do anything yourself to
run the code formatters or linters. When you push a commit, a bot will run
those for you right away and add any autofixes to your PR. Anything
that can't be autofixed will show up as a CI failure, hopefully with an error
message that will make it clear what's gone wrong.

That being said, if you *want* to run the formatters and linters locally
when you commit, you're free to do so. To use the same configuration as we use
in CI, we recommend doing this via pre-commit:

```bash
(.venv)$ pre-commit run --all-files
```

### What to include

Stubs should include the complete interface (classes, functions,
Expand Down Expand Up @@ -313,7 +316,7 @@ def foo(x): ... # unannotated argument and return type
`Incomplete` can also be used for partially known types:

```python
def foo(x: Incomplete | None = None) -> list[Incomplete]: ...
def foo(x: Incomplete | None) -> list[Incomplete]: ...
```

### What to do when a project's documentation and implementation disagree
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
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy