8000 Bump mypy to 1.5.1 by AlexWaygood · Pull Request #10559 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Bump my 8000 py to 1.5.1 #10559

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 13 commits into from
Aug 16, 2023
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
12 changes: 1 addition & 11 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,18 @@ jobs:
matrix:
# tkinter doesn't import on macOS-12
os: ["ubuntu-latest", "windows-latest", "macos-11"]
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@v3
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
if: ${{ matrix.os != 'macos-11' || matrix.python-version != '3.7' }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements-tests.txt
allow-prereleases: true
# Handle the py37 run on macos differently,
# to workaround https://github.com/actions/setup-python/issues/682
- name: Setup Python 3.7.16 on macos
if: ${{ matrix.os == 'macos-11' && matrix.python-version == '3.7' }}
uses: actions/setup-python@v4
with:
python-version: "3.7.16"
cache: pip
cache-dependency-path: requirements-tests.txt
- name: Install dependencies
run: pip install -r requirements-tests.txt
- name: Run stubtest
Expand Down
12 changes: 1 addition & 11 deletions .github/workflows/stubtest_stdlib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,18 @@ jobs:
matrix:
# tkinter doesn't import on macOS 12
os: ["ubuntu-latest", "windows-latest", "macos-11"]
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@v3
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
if: ${{ matrix.os != 'macos-11' || matrix.python-version != '3.7' }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements-tests.txt
allow-prereleases: true
# Handle the py37 run on macos differently,
# to workaround https://github.com/actions/setup-python/issues/682
- name: Setup Python 3.7.16 on macos
if: ${{ matrix.os == 'macos-11' && matrix.python-version == '3.7' }}
uses: actions/setup-python@v4
with:
python-version: "3.7.16"
cache: pip
cache-dependency-path: requirements-tests.txt
- name: Install dependencies
run: pip install -r requirements-tests.txt
- name: Run stubtest
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
strategy:
matrix:
platform: ["linux", "win32", "darwin"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand All @@ -98,8 +98,7 @@ jobs:
- run: python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=${{ matrix.python-version }}

# Run mypy slightly differently on the py312 stubs,
# as mypyc doesn't work on Python 3.12 yet
# (and various non-types dependencies can't be installed on Python 3.12 yet)
# as at least one non-types dependency (greenlet) can't be installed on Python 3.12 yet
mypy-312:
name: Run mypy against the stubs (3.12)
runs-on: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions .vscode/settings.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@
"mypy-type-checker.importStrategy": "fromEnvironment",
"mypy-type-checker.args": [
"--custom-typeshed-dir=${workspaceFolder}",
"--python-version=3.7",
"--strict"
// Needed because a library stubbed in typeshed won't necessarily be installed inthe dev's environment
// Currentyl broken in dmypy: https://github.com/python/mypy/issues/10709
// "--ignore-missing-imports"
// We only guarantee all of our tests can be run if you're on Python 3.9 or higher
"--python-version=3.9",
"--strict",
// Needed because a library stubbed in typeshed won't necessarily be installed in the dev's environment
"--ignore-missing-imports"
],
// Ensure typeshed's configs are used, and not user's VSCode settings
"flake8.args": [
Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ flake8-bugbear==23.7.10; python_version >= "3.8" # must match .pre-commit-confi
flake8-noqa==1.3.2; python_version >= "3.8" # must match .pre-commit-config.yaml
flake8-pyi==23.6.0; python_version >= "3.8" # must match .pre-commit-config.yaml
isort==5.12.0; python_version >= "3.8" # must match .pre-commit-config.yaml
mypy==1.4.1
mypy==1.5.1
pre-commit-hooks==4.4.0 # must match .pre-commit-config.yaml
pytype==2023.8.14; platform_system != "Windows" and python_version >= "3.8" and python_version < "3.11"
ruff==0.0.280 # must match .pre-commit-config.yaml
Expand Down
7 changes: 6 additions & 1 deletion test_cases/stdlib/check_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,9 @@ def check_other_isdataclass_overloads(x: type, y: object) -> None:
assert_type(dc.fields(y), Tuple[dc.Field[Any], ...])
assert_type(dc.asdict(y), Dict[str, Any])
assert_type(dc.astuple(y), Tuple[Any, ...])
dc.replace(y)

# No longer passes with mypy 1.5.0
# now that mypy gives a tailored signature for dataclasses.replace()
# (https://github.com/python/mypy/issues/15843):
#
# dc.replace(y)
18 changes: 1 addition & 17 deletions tests/mypy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import tempfile
import time
from collections import defaultdict
from collections.abc import Sequence
from dataclasses import dataclass
from itertools import product
from pathlib import Path
Expand Down Expand Up @@ -47,7 +46,7 @@
print_error("Cannot import mypy. Did you install it?")
sys.exit(1)

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"]
SUPPORTED_PLATFORMS = ("linux", "win32", "darwin")
DIRECTORIES_TO_TEST = [Path("stdlib"), Path("stubs")]

Expand Down Expand Up @@ -86,21 +85,6 @@ def remove_dev_suffix(version: str) -> str:
parser = argparse.ArgumentParser(
description="Typecheck typeshed's stubs with mypy. Patterns are unanchored regexps on the full path."
)
if sys.version_info < (3, 8):

class ExtendAction(argparse.Action):
def __call__(
self,
parser: argparse.ArgumentParser,
namespace: argparse.Namespace,
values: Sequence[str],
option_string: object = None,
) -> None:
items = getattr(namespace, self.dest) or []
items.extend(values)
setattr(namespace, self.dest, items)

parser.register("action", "extend", ExtendAction)
parser.add_argument(
"filter",
type=valid_path,
Expand Down
8 changes: 0 additions & 8 deletions tests/stubtest_allowlists/darwin-py37.txt

This file was deleted.

8 changes: 0 additions & 8 deletions tests/stubtest_allowlists/linux-py37.txt

This file was deleted.

186 changes: 0 additions & 186 deletions tests/stubtest_allowlists/py37.txt

This file was deleted.

20 changes: 0 additions & 20 deletions tests/stubtest_allowlists/win32-py37.txt

This file was deleted.

2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def colored(text: str, color: str | None = None, **kwargs: Any) -> str: # type:


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


Expand Down
0