Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit15c3753

Browse files
authored
Only support the latest Mypy version (#11832)
Simplify test code, update support policy, update CI. Bump mypy to 1.15.Require uv>=0.7.2, as the lockfile format was updated.
1 parent103f64d commit15c3753

File tree

39 files changed

+1555
-1630
lines changed

39 files changed

+1555
-1630
lines changed

‎.github/workflows/ci.yml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -180,52 +180,30 @@ jobs:
180180
TEST_PLUGIN:1
181181

182182
test-mypy:
183-
name:mypy ${{ matrix.mypy-version }} / ${{ matrix.python-version }}
183+
name:Mypy typechecking tests
184184
runs-on:ubuntu-latest
185-
strategy:
186-
fail-fast:false
187-
matrix:
188-
# test the latest version on all supported Python versions and the rest on 3.12
189-
mypy-version:['1.10.1', '1.11.2']
190-
python-version:['3.12']
191-
include:
192-
-mypy-version:'1.12.0'
193-
python-version:'3.9'
194-
-mypy-version:'1.12.0'
195-
python-version:'3.10'
196-
-mypy-version:'1.12.0'
197-
python-version:'3.11'
198-
-mypy-version:'1.12.0'
199-
python-version:'3.12'
200-
-mypy-version:'1.12.0'
201-
python-version:'3.13'
202-
203185
steps:
204186
-uses:actions/checkout@v4
205187

206188
-uses:astral-sh/setup-uv@v6
207189
with:
208-
python-version:${{ matrix.python-version }}
190+
python-version:'3.13'
209191

210192
-name:Install dependencies
211193
run:uv sync --group typechecking --all-extras
212194

213-
-name:Install mypy
214-
if:steps.cache.outputs.cache-hit != 'true'
215-
run:uv pip install 'mypy==${{ matrix.mypy-version }}'
216-
217195
-run:mkdir coverage
218196

219197
-name:Run mypy tests
220198
run:uv run coverage run -m pytest tests/mypy --test-mypy
221199
env:
222-
COVERAGE_FILE:coverage/.coverage.linux-py${{ matrix.python-version }}-mypy${{ matrix.mypy-version }}
223-
CONTEXT:linux-py${{ matrix.python-version }}-mypy${{ matrix.mypy-version }}
200+
COVERAGE_FILE:coverage/.coverage.linux-mypy
201+
CONTEXT:linux-mypy
224202

225203
-name:Store coverage files
226204
uses:actions/upload-artifact@v4
227205
with:
228-
name:coverage-${{ matrix.python-version }}-mypy${{ matrix.mypy-version }}
206+
name:coverage-mypy
229207
path:coverage
230208
include-hidden-files:true
231209

‎Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@ test-mypy: .uv
4646
test-mypy-update: .uv
4747
uv run coverage run -m pytest tests/mypy --test-mypy --update-mypy
4848

49-
.PHONY: test-mypy-update-all## Update the mypy integration tests for all mypy versions
50-
test-mypy-update-all: .uv
51-
rm -rf tests/mypy/outputs
52-
uv pip install mypy==1.10.1&& make test-mypy-update
53-
uv pip install mypy==1.11.2&& make test-mypy-update
54-
uv pip install mypy==1.12.0&& make test-mypy-update
55-
5649
.PHONY: test-typechecking-pyright## Typechecking integration tests (Pyright)
5750
test-typechecking-pyright: .uv
5851
uv run bash -c'cd tests/typechecking && pyright --version && pyright -p pyproject.toml'

‎docs/integrations/mypy.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Note that mypy already supports some features without using the Pydantic plugin,
5252
method for Pydantic models and dataclasses. See the[mypy plugin capabilities](#mypy-plugin-capabilities) for a list
5353
of additional features.
5454

55+
The Pydantic mypy plugin is tested against the latest mypy version. Older versions might work but won't be tested.
56+
5557
##Enabling the Plugin
5658

5759
To enable the plugin, just add`pydantic.mypy` to the list of plugins in your
@@ -77,12 +79,6 @@ To enable the plugin, just add `pydantic.mypy` to the list of plugins in your
7779

7880
See the[plugin configuration](#configuring-the-plugin) for more details.
7981

80-
##Supported mypy versions
81-
82-
Pydantic supports the mypy versions released less than 6 months ago. Older versions may still work with the plugin
83-
but won't be tested. The list of released mypy versions can be found[here](https://mypy-lang.org/news.html). Note
84-
that the version support policy is subject to change at discretion of contributors.
85-
8682
##Mypy plugin capabilities
8783

8884
###Generate a`__init__` signature for Pydantic models

‎pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ markers = [
182182

183183
[tool.uv]
184184
default-groups = ['dev']
185+
required-version ='>=0.7.2'
185186

186187
# configuring https://github.com/pydantic/hooky
187188
[tool.hooky]

‎tests/mypy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ model = Model(a=1, b=2)
6767
]
6868
```
6969

70-
3. Run`make test-mypy-update-all`. It should create a new outputwith your newfile.
70+
3. Run`make test-mypy-update`. It should create a new outputwith your newfile.
7171

7272
4. Make sure the output contains the expected Mypy error message/code.
7373

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp