Skip to content

Commit e3478f6

Browse files
committed
Merge remote-tracking branch 'upstream/main' into codex/pr-2008-merge-main
# Conflicts: # conformance/results/mypy/version.toml # conformance/results/pyre/generics_type_erasure.toml # conformance/results/pyre/version.toml # conformance/results/pytype/generics_type_erasure.toml # conformance/results/pytype/version.toml # conformance/results/results.html
2 parents a2eb418 + 691e9e4 commit e3478f6

1,128 files changed

Lines changed: 16596 additions & 16975 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
conformance/results/results.html linguist-generated

.github/workflows/build-docs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v7
1717
- name: Set up Python
18-
uses: actions/setup-python@v5
18+
uses: actions/setup-python@v7
1919
with:
20-
python-version: 3.9
20+
python-version: "3.14"
2121
- name: Install dependencies
2222
run: |
2323
pip install --upgrade pip
24-
pip install -r docs/requirements.txt
24+
pip install --group docs
2525
- name: Build the documentation
2626
run: make -C docs html

.github/workflows/ci.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v4
18-
- name: Set up Python 3
19-
uses: actions/setup-python@v5
17+
- uses: actions/checkout@v7
18+
- uses: actions/setup-python@v7
2019
with:
21-
python-version: 3
20+
python-version: "3.14"
2221
cache: "pip"
23-
cache-dependency-path: "test-requirements.txt"
2422

2523
- name: Install dependencies
2624
run: |
2725
pip install --upgrade pip
28-
pip install -r test-requirements.txt
26+
pip install --group test
2927
3028
- name: Lint implementation
3129
run: flake8

.github/workflows/conformance.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Conformance
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
conformance:
12+
name: Run conformance suite
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v7
17+
18+
- name: Set up Python 3.12
19+
uses: actions/setup-python@v7
20+
with:
21+
python-version: "3.12"
22+
cache: "pip"
23+
24+
- name: Install uv
25+
run: |
26+
python -m pip install --upgrade pip
27+
python -m pip install uv
28+
29+
- name: Run conformance suite
30+
working-directory: conformance
31+
run: |
32+
uv sync --python 3.12 --frozen
33+
uv run --python 3.12 --frozen python src/main.py
34+
35+
- name: Validate conformance invariants
36+
working-directory: conformance
37+
run: |
38+
uv run --python 3.12 --frozen python src/validate_results.py
39+
40+
- name: Assert conformance results are up to date
41+
run: |
42+
if [ -n "$(git status --porcelain -- conformance/results)" ]; then
43+
git status --short conformance/results
44+
git diff -- conformance/results
45+
echo "Conformance results are out of date. Run conformance/src/main.py and commit updated results."
46+
exit 1
47+
fi

.readthedocs.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
version: 2
55

66
build:
7-
os: ubuntu-22.04
7+
os: ubuntu-26.04
88
tools:
99
python: "3"
10+
jobs:
11+
install:
12+
- uv sync --group docs
1013

1114
sphinx:
1215
configuration: docs/conf.py
1316

1417
python:
1518
install:
16-
- requirements: docs/requirements.txt
19+
- method: uv
20+
command: sync

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repository.
1414
For conversations that are more suitable to a chat platform, you can use one of the following:
1515

1616
- [gitter](https://gitter.im/python/typing)
17-
- [discord](https://discord.com/channels/267624335836053506/891788761371906108) `#type-hinting` channel
17+
- [discord](https://discord.com/invite/python) [#type-hinting](https://discord.com/channels/267624335836053506/891788761371906108) channel
1818

1919
## Repository Content
2020

conformance/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ MANIFEST
3232

3333
# Tools
3434
.mypy_cache
35-
.pyre_configuration
36-
.pyre
3735
.coverage
3836
htmlcov
3937

conformance/README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This project contains test cases for behaviors defined in the Python typing spec
1212

1313
* [concepts](https://typing.python.org/en/latest/spec/concepts.html)
1414
* [annotations](https://typing.python.org/en/latest/spec/annotations.html)
15+
* [typeforms](https://typing.python.org/en/latest/spec/type-forms.html)
1516
* [specialtypes](https://typing.python.org/en/latest/spec/special-types.html)
1617
* [generics](https://typing.python.org/en/latest/spec/generics.html)
1718
* [qualifiers](https://typing.python.org/en/latest/spec/qualifiers.html)
@@ -70,18 +71,17 @@ by the scoring system.
7071

7172
To run the conformance test suite:
7273
* Clone the https://github.com/python/typing repo.
73-
* Create and activate a Python 3.12 virtual environment.
74-
* Switch to the `conformance` subdirectory and install all dependencies (`pip install -r requirements.txt`).
75-
* Switch to the `src` subdirectory and run `python main.py`.
74+
* Install [uv](https://docs.astral.sh/uv/) and ensure Python 3.12 is available.
75+
* Switch to the `conformance` subdirectory and install locked dependencies (`uv sync --python 3.12 --frozen`).
76+
* Run the conformance tool (`uv run --python 3.12 --frozen python src/main.py`).
7677

7778
Note that some type checkers may not run on some platforms. If a type checker fails to install, tests will be skipped for that type checker.
78-
Currently, the only unsupported type checker is Pyre on Windows.
7979

8080
## Reporting Conformance Results
8181

8282
Different type checkers report errors in different ways (with different wording in error messages and different line numbers or character ranges for errors). This variation makes it difficult to fully automate test validation given that tests will want to check for both false positive and false negative type errors. Some level of manual inspection will therefore be needed to determine whether a type checker is fully conformant with all tests in any given test file. This "scoring" process is required only when the output of a test changes — e.g. when a new version of that type checker is released and the tests are rerun. We assume that the output of a type checker will be the same from one run to the next unless/until a new version is released that fixes or introduces a bug. In this case, the output will need to be manually inspected and the conformance results re-scored for those tests whose output has changed.
8383

84-
Conformance results are reported and summarized for each supported type checker. Currently, results are reported for mypy, pyre, pyright, and pytype. It is the goal and desire to add additional type checkers over time.
84+
[Conformance results](https://htmlpreview.github.io/?https://github.com/python/typing/blob/main/conformance/results/results.html) are reported and summarized for each supported type checker. Currently, results are reported for mypy, pyrefly, pyright, zuban, ty, and pycroscope. It is the goal and desire to add additional type checkers over time.
8585

8686
## Adding a New Test Case
8787

@@ -93,7 +93,22 @@ If a test is updated (augmented or fixed), the process is similar to when adding
9393

9494
## Updating a Type Checker
9595

96-
If a new version of a type checker is released, re-run the test tool with the new version. If the type checker output has changed for any test cases, the tool will supply the old and new outputs. Examine these to determine whether the conformance status has changed. Once the conformance status has been updated, re-run the test tool again to regenerate the summary report.
96+
Type checker versions are locked in `uv.lock`.
97+
98+
To bump all supported checkers to their latest released versions:
99+
100+
```bash
101+
python scripts/bump_type_checkers.py
102+
```
103+
104+
After bumping, install the new lockfile and rerun conformance:
105+
106+
```bash
107+
uv sync --python 3.12 --frozen
108+
uv run --python 3.12 --frozen python src/main.py
109+
```
110+
111+
If checker output changes for any test cases, examine those deltas to determine whether the conformance status has changed. Once the conformance status has been updated, rerun the tool to regenerate the summary report.
97112

98113
## Automated Conformance Checking
99114

conformance/pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[project]
2+
name = "typing-conformance"
3+
version = "0.1.0"
4+
requires-python = "==3.12.*"
5+
dependencies = [
6+
"jinja2",
7+
"markdown",
8+
"mypy",
9+
"pycroscope",
10+
"pyrefly==1.3.0.dev1",
11+
"pyright",
12+
"tomlkit",
13+
"ty",
14+
"types-markdown",
15+
"zuban",
16+
]
17+
18+
[tool.uv]
19+
package = false

conformance/requirements.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)