8000 Bump mypy to 1.5.1 (#10559) · python/typeshed@ef758b6 · GitHub
[go: up one dir, main page]

Skip to content

Commit ef758b6

Browse files
authored
Bump mypy to 1.5.1 (#10559)
1 parent 695d41f commit ef758b6

File tree

12 files changed

+18
-272
lines changed

12 files changed

+18
-272
lines changed

.github/workflows/daily.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,18 @@ jobs:
3636
matrix:
3737
# tkinter doesn't import on macOS-12
3838
os: ["ubuntu-latest", "windows-latest", "macos-11"]
39-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
39+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
4040
fail-fast: false
4141

4242
steps:
4343
- uses: actions/checkout@v3
4444
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
45-
if: ${{ matrix.os != 'macos-11' || matrix.python-version != '3.7' }}
4645
uses: actions/setup-python@v4
4746
with:
4847
python-version: ${{ matrix.python-version }}
4948
cache: pip
5049
cache-dependency-path: requirements-tests.txt
5150
allow-prereleases: true
52-
# Handle the py37 run on macos differently,
53-
# to workaround https://github.com/actions/setup-python/issues/682
54-
- name: Setup Python 3.7.16 on macos
55-
if: ${{ matrix.os == 'macos-11' && matrix.python-version == '3.7' }}
56-
uses: actions/setup-python@v4
57-
with:
58-
python-version: "3.7.16"
59-
cache: pip
60-
cache-dependency-path: requirements-tests.txt
6151
- name: Install dependencies
6252
run: pip install -r requirements-tests.txt
6353
- name: Run stubtest

.github/workflows/stubtest_stdlib.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,18 @@ jobs:
3232
matrix:
3333
# tkinter doesn't import on macOS 12
3434
os: ["ubuntu-latest", "windows-latest", "macos-11"]
35-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
35+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
3636
fail-fast: false
3737

3838
steps:
3939
- uses: actions/checkout@v3
4040
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
41-
if: ${{ matrix.os != 'macos-11' || matrix.python-version != '3.7' }}
4241
uses: actions/setup-python@v4
4342
with:
4443
python-version: ${{ matrix.python-version }}
4544
cache: pip
4645
cache-dependency-path: requirements-tests.txt
4746
allow-prereleases: true
48-
# Handle the py37 run on macos differently,
49-
# to workaround https://github.com/actions/setup-python/issues/682
50-
- name: Setup Python 3.7.16 on macos
51-
if: ${{ matrix.os == 'macos-11' && matrix.python-version == '3.7' }}
52-
uses: actions/setup-python@v4
53-
with:
54-
python-version: "3.7.16"
55-
cache: pip
56-
cache-dependency-path: requirements-tests.txt
5747
- name: Install dependencies
5848
run: pip install -r requirements-tests.txt
5949
- name: Run stubtest

.github/workflows/tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
strategy:
8686
matrix:
8787
platform: ["linux", "win32", "darwin"]
88-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
88+
python-version: ["3.8", "3.9", "3.10", "3.11"]
8989
fail-fast: false
9090
steps:
9191
- uses: actions/checkout@v3
@@ -98,8 +98,7 @@ jobs:
9898
- run: python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=${{ matrix.python-version }}
9999

100100
# Run mypy slightly differently on the py312 stubs,
101-
# as mypyc doesn't work on Python 3.12 yet
102-
# (and various non-types dependencies can't be installed on Python 3.12 yet)
101+
# as at least one non-types dependency (greenlet) can't be installed on Python 3.12 yet
103102
mypy-312:
104103
name: Run mypy against the stubs (3.12)
105104
runs-on: ubuntu-latest

.vscode/settings.default.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@
9797
"mypy-type-checker.importStrategy": "fromEnvironment",
9898
"mypy-type-checker.args": [
9999
"--custom-typeshed-dir=${workspaceFolder}",
100-
"--python-version=3.7",
101-
"--strict"
102-
// Needed because a library stubbed in typeshed won't necessarily be installed inthe dev's environment
103-
// Currentyl broken in dmypy: https://github.com/python/mypy/issues/10709
104-
// "--ignore-missing-imports"
100+
// We only guarantee all of our tests can be run if you're on Python 3.9 or higher
101+
"--python-version=3.9",
102+
"--strict",
103+
// Needed because a library stubbed in typeshed won't necessarily be installed in the dev's environment
104+
"--ignore-missing-imports"
105105
],
106106
// Ensure typeshed's configs are used, and not user's VSCode settings
107107
"flake8.args": [

requirements-tests.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ flake8-bugbear==23.7.10; python_version >= "3.8" # must match .pre-commit-confi
77
flake8-noqa==1.3.2; python_version >= "3.8" # must match .pre-commit-config.yaml
88
flake8-pyi==23.6.0; python_version >= "3.8" # must match .pre-commit-config.yaml
99
isort==5.12.0; python_version >= "3.8" # must match .pre-commit-config.yaml
10-
mypy==1.4.1
10+
mypy==1.5.1
1111
pre-commit-hooks==4.4.0 # must match .pre-commit-config.yaml
1212
pytype==2023.8.14; platform_system != "Windows" and python_version >= "3.8" and python_version < "3.11"
1313
ruff==0.0.280 # must match .pre-commit-config.yaml

test_cases/stdlib/check_dataclasses.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,9 @@ def check_other_isdataclass_overloads(x: type, y: object) -> None:
8787
assert_type(dc.fields(y), Tuple[dc.Field[Any], ...])
8888
assert_type(dc.asdict(y), Dict[str, Any])
8989
assert_type(dc.astuple(y), Tuple[Any, ...])
90-
dc.replace(y)
90+
91+
# No longer passes with mypy 1.5.0
92+
# now that mypy gives a tailored signature for dataclasses.replace()
93+
# (https://github.com/python/mypy/issues/15843):
94+
#
95+
# dc.replace(y)

tests/mypy_test.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import tempfile
1313
import time
1414
from collections import defaultdict
15-
from collections.abc import Sequence
1615
from dataclasses import dataclass
1716
from itertools import product
1817
from pathlib import Path
@@ -47,7 +46,7 @@
4746
print_error("Cannot import mypy. Did you install it?")
4847
sys.exit(1)
4948

50-
SUPPORTED_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8", "3.7"]
49+
SUPPORTED_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8"]
5150
SUPPORTED_PLATFORMS = ("linux", "win32", "darwin")
5251
DIRECTORIES_TO_TEST = [Path("stdlib"), Path("stubs")]
5352

@@ -86,21 +85,6 @@ def remove_dev_suffix(version: str) -> str:
8685
parser = argparse.ArgumentParser(
8786
description="Typecheck typeshed's stubs with mypy. Patterns are unanchored regexps on the full path."
8887
)
89-
if sys.version_info < (3, 8):
90-
91-
class ExtendAction(argparse.Action):
92-
def __call__(
93-
self,
94-
parser: argparse.ArgumentParser,
95-
namespace: argparse.Namespace,
96-
values: Sequence[str],
97-
option_string: object = None,
98-
) -> None:
99-
items = getattr(namespace, self.dest) or []
100-
items.extend(values)
101-
setattr(namespace, self.dest, items)
102-
103-
parser.register("action", "extend", ExtendAction)
10488
parser.add_argument(
10589
"filter",
10690
type=valid_path,

tests/stubtest_allowlists/darwin-py37.txt

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

tests/stubtest_allowlists/linux-py37.txt

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

tests/stubtest_allowlists/py37.txt

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

tests/stubtest_allowlists/win32-py37.txt

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

tests/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def colored(text: str, color: str | None = None, **kwargs: Any) -> str: # type:
2323

2424

2525
# A backport of functools.cache for Python <3.9
26-
# This module is imported by mypy_test.py, which needs to run on 3.7 in CI
26+
# This module is imported by mypy_test.py, which needs to run on 3.8 in CI
2727
cache = lru_cache(None)
2828

2929

0 commit comments

Comments
 (0)
0