Skip to content

Commit 9967f27

Browse files
committed
Merge remote-tracking branch 'upstream/master' into bugfix/st-synthetic-named-expr-in-match
2 parents 01b92c9 + f44a60d commit 9967f27

File tree

133 files changed

+5230
-2124
lines changed

Some content is hidden

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

133 files changed

+5230
-2124
lines changed

.github/workflows/mypy_primer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
persist-credentials: false
4040
- uses: actions/setup-python@v5
4141
with:
42-
python-version: "3.12"
42+
python-version: "3.13"
4343
- name: Install dependencies
4444
run: |
4545
python -m pip install -U pip

.github/workflows/test.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,57 +33,49 @@ jobs:
3333
# the oldest and newest supported Python versions
3434
- name: Test suite with py39-ubuntu, mypyc-compiled
3535
python: '3.9'
36-
arch: x64
37-
os: ubuntu-latest
36+
os: ubuntu-24.04-arm
3837
toxenv: py
3938
tox_extra_args: "-n 4"
4039
test_mypyc: true
4140
- name: Test suite with py39-windows-64
4241
python: '3.9'
43-
arch: x64
4442
os: windows-latest
4543
toxenv: py39
4644
tox_extra_args: "-n 4"
4745
- name: Test suite with py310-ubuntu
4846
python: '3.10'
49-
arch: x64
50-
os: ubuntu-latest
47+
os: ubuntu-24.04-arm
5148
toxenv: py
5249
tox_extra_args: "-n 4"
5350
- name: Test suite with py311-ubuntu, mypyc-compiled
5451
python: '3.11'
55-
arch: x64
56-
os: ubuntu-latest
52+
os: ubuntu-24.04-arm
5753
toxenv: py
5854
tox_extra_args: "-n 4"
5955
test_mypyc: true
6056
- name: Test suite with py312-ubuntu, mypyc-compiled
6157
python: '3.12'
62-
arch: x64
63-
os: ubuntu-latest
58+
os: ubuntu-24.04-arm
6459
toxenv: py
6560
tox_extra_args: "-n 4"
6661
test_mypyc: true
6762
- name: Test suite with py313-ubuntu, mypyc-compiled
6863
python: '3.13'
69-
arch: x64
70-
os: ubuntu-latest
64+
os: ubuntu-24.04-arm
7165
toxenv: py
7266
tox_extra_args: "-n 4"
7367
test_mypyc: true
7468

7569
# - name: Test suite with py314-dev-ubuntu
7670
# python: '3.14-dev'
77-
# arch: x64
78-
# os: ubuntu-latest
71+
# os: ubuntu-24.04-arm
7972
# toxenv: py
8073
# tox_extra_args: "-n 4"
8174
# allow_failure: true
8275
# test_mypyc: true
8376

8477
- name: mypyc runtime tests with py39-macos
8578
python: '3.9.21'
86-
arch: x64
8779
# TODO: macos-13 is the last one to support Python 3.9, change it to macos-latest when updating the Python version
8880
os: macos-13
8981
toxenv: py
@@ -93,20 +85,17 @@ jobs:
9385
# - https://github.com/python/mypy/pull/17822
9486
# - name: mypyc runtime tests with py38-debug-build-ubuntu
9587
# python: '3.9.21'
96-
# arch: x64
9788
# os: ubuntu-latest
9889
# toxenv: py
9990
# tox_extra_args: "-n 4 mypyc/test/test_run.py mypyc/test/test_external.py"
10091
# debug_build: true
10192

10293
- name: Type check our own code (py39-ubuntu)
10394
python: '3.9'
104-
arch: x64
10595
os: ubuntu-latest
10696
toxenv: type
10797
- name: Type check our own code (py39-windows-64)
10898
python: '3.9'
109-
arch: x64
11099
os: windows-latest
111100
toxenv: type
112101

@@ -115,7 +104,6 @@ jobs:
115104
# to ensure the tox env works as expected
116105
- name: Formatting and code style with Black + ruff
117106
python: '3.10'
118-
arch: x64
119107
os: ubuntu-latest
120108
toxenv: lint
121109

@@ -169,7 +157,6 @@ jobs:
169157
if: ${{ !(matrix.debug_build || endsWith(matrix.python, '-dev')) }}
170158
with:
171159
python-version: ${{ matrix.python }}
172-
architecture: ${{ matrix.arch }}
173160

174161
- name: Install tox
175162
run: |

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repos:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
88
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 24.10.0
9+
rev: 25.1.0
1010
hooks:
1111
- id: black
1212
exclude: '^(test-data/)'
@@ -22,7 +22,7 @@ repos:
2222
- id: check-github-actions
2323
- id: check-readthedocs
2424
- repo: https://github.com/rhysd/actionlint
25-
rev: v1.7.6
25+
rev: v1.7.7
2626
hooks:
2727
- id: actionlint
2828
args: [

CHANGELOG.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,16 @@ garbage collector.
99

1010
Contributed by Jukka Lehtosalo (PR [18306](https://github.com/python/mypy/pull/18306)).
1111

12-
### Drop Support for Python 3.8
13-
14-
Mypy no longer supports running with Python 3.8, which has reached end-of-life.
15-
When running mypy with Python 3.9+, it is still possible to type check code
16-
that needs to support Python 3.8 with the `--python-version 3.8` argument.
17-
Support for this will be dropped in the first half of 2025!
18-
19-
Contributed by Marc Mueller (PR [17492](https://github.com/python/mypy/pull/17492)).
20-
2112
### Mypyc accelerated mypy wheels for aarch64
2213

2314
Mypy can compile itself to C extension modules using mypyc. This makes mypy 3-5x faster
2415
than if mypy is interpreted with pure Python. We now build and upload mypyc accelerated
2516
mypy wheels for `manylinux_aarch64` to PyPI, making it easy for users on such platforms
2617
to realise this speedup.
2718

28-
Contributed by Christian Bundy (PR [mypy_mypyc-wheels#76](https://github.com/mypyc/mypy_mypyc-wheels/pull/76))
19+
Contributed by Christian Bundy and Marc Mueller
20+
(PR [mypy_mypyc-wheels#76](https://github.com/mypyc/mypy_mypyc-wheels/pull/76),
21+
PR [mypy_mypyc-wheels#89](https://github.com/mypyc/mypy_mypyc-wheels/pull/89)).
2922

3023
### `--strict-bytes`
3124

@@ -48,6 +41,16 @@ Contributed by Christoph Tyralla (PR [18180](https://github.com/python/mypy/pull
4841
(Speaking of partial types, another reminder that mypy plans on enabling `--local-partial-types`
4942
by default in **mypy 2.0**).
5043

44+
### Better discovery of configuration files
45+
46+
Mypy will now walk up the filesystem (up until a repository or file system root) to discover
47+
configuration files. See the
48+
[mypy configuration file documentation](https://mypy.readthedocs.io/en/stable/config_file.html)
49+
for more details.
50+
51+
Contributed by Mikhail Shiryaev and Shantanu Jain
52+
(PR [16965](https://github.com/python/mypy/pull/16965), PR [18482](https://github.com/python/mypy/pull/18482)
53+
5154
### Better line numbers for decorators and slice expressions
5255

5356
Mypy now uses more correct line numbers for decorators and slice expressions. In some cases, this
@@ -56,6 +59,15 @@ may necessitate changing the location of a `# type: ignore` comment.
5659
Contributed by Shantanu Jain (PR [18392](https://github.com/python/mypy/pull/18392),
5760
PR [18397](https://github.com/python/mypy/pull/18397)).
5861

62+
### Drop Support for Python 3.8
63+
64+
Mypy no longer supports running with Python 3.8, which has reached end-of-life.
65+
When running mypy with Python 3.9+, it is still possible to type check code
66+
that needs to support Python 3.8 with the `--python-version 3.8` argument.
67+
Support for this will be dropped in the first half of 2025!
68+
69+
Contributed by Marc Mueller (PR [17492](https://github.com/python/mypy/pull/17492)).
70+
5971
## Mypy 1.14
6072

6173
We’ve just uploaded mypy 1.14 to the Python Package Index ([PyPI](https://pypi.org/project/mypy/)).

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ graft test-data
4242
graft mypy/test
4343
include conftest.py
4444
include runtests.py
45-
include pytest.ini
4645
include tox.ini
4746

4847
include LICENSE mypyc/README.md CHANGELOG.md

docs/source/command_line.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,8 @@ of the above sections.
692692
.. option:: --extra-checks
693693

694694
This flag enables additional checks that are technically correct but may be
695-
impractical in real code. In particular, it prohibits partial overlap in
696-
``TypedDict`` updates, and makes arguments prepended via ``Concatenate``
697-
positional-only. For example:
695+
impractical. In particular, it prohibits partial overlap in ``TypedDict`` updates,
696+
and makes arguments prepended via ``Concatenate`` positional-only. For example:
698697

699698
.. code-block:: python
700699
@@ -717,6 +716,13 @@ of the above sections.
717716
bad: Bad = {"a": 0, "b": "no"}
718717
test(bad, bar)
719718
719+
In future more checks may be added to this flag if:
720+
721+
* The corresponding use cases are rare, thus not justifying a dedicated
722+
strictness flag.
723+
724+
* The new check cannot be supported as an opt-in error code.
725+
720726
.. option:: --strict
721727

722728
This flag mode enables all optional error checking flags. You can see the

docs/source/config_file.rst

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,30 @@ Mypy is very configurable. This is most useful when introducing typing to
77
an existing codebase. See :ref:`existing-code` for concrete advice for
88
that situation.
99

10-
Mypy supports reading configuration settings from a file with the following precedence order:
10+
Mypy supports reading configuration settings from a file. By default, mypy will
11+
discover configuration files by walking up the file system (up until the root of
12+
a repository or the root of the filesystem). In each directory, it will look for
13+
the following configuration files (in this order):
1114

12-
1. ``./mypy.ini``
13-
2. ``./.mypy.ini``
14-
3. ``./pyproject.toml``
15-
4. ``./setup.cfg``
16-
5. ``$XDG_CONFIG_HOME/mypy/config``
17-
6. ``~/.config/mypy/config``
18-
7. ``~/.mypy.ini``
15+
1. ``mypy.ini``
16+
2. ``.mypy.ini``
17+
3. ``pyproject.toml`` (containing a ``[tool.mypy]`` section)
18+
4. ``setup.cfg`` (containing a ``[mypy]`` section)
19+
20+
If no configuration file is found by this method, mypy will then look for
21+
configuration files in the following locations (in this order):
22+
23+
1. ``$XDG_CONFIG_HOME/mypy/config``
24+
2. ``~/.config/mypy/config``
25+
3. ``~/.mypy.ini``
26+
27+
The :option:`--config-file <mypy --config-file>` command-line flag has the
28+
highest precedence and must point towards a valid configuration file;
29+
otherwise mypy will report an error and exit. Without the command line option,
30+
mypy will look for configuration files in the precedence order above.
1931

2032
It is important to understand that there is no merging of configuration
21-
files, as it would lead to ambiguity. The :option:`--config-file <mypy --config-file>`
22-
command-line flag has the highest precedence and
23-
must be correct; otherwise mypy will report an error and exit. Without the
24-
command line option, mypy will look for configuration files in the
25-
precedence order above.
33+
files, as it would lead to ambiguity.
2634

2735
Most flags correspond closely to :ref:`command-line flags
2836
<command-line>` but there are some differences in flag names and some
@@ -740,7 +748,7 @@ section of the command line docs.
740748
:type: boolean
741749
:default: False
742750

743-
This flag enables additional checks that are technically correct but may be impractical in real code.
751+
This flag enables additional checks that are technically correct but may be impractical.
744752
See :option:`mypy --extra-checks` for more info.
745753

746754
.. confval:: implicit_reexport
@@ -763,13 +771,6 @@ section of the command line docs.
763771
from foo import bar
764772
__all__ = ['bar']
765773
766-
.. confval:: strict_concatenate
767-
768-
:type: boolean
769-
:default: False
770-
771-
Make arguments prepended via ``Concatenate`` be truly positional-only.
772-
773774
.. confval:: strict_equality
774775

775776
:type: boolean

docs/source/existing_code.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,8 @@ The following config is equivalent to ``--strict`` (as of mypy 1.0):
199199
warn_redundant_casts = True
200200
warn_unused_ignores = True
201201
202-
# Getting these passing should be easy
202+
# Getting this passing should be easy
203203
strict_equality = True
204-
strict_concatenate = True
205204
206205
# Strongly recommend enabling this one as soon as you can
207206
check_untyped_defs = True
@@ -223,6 +222,10 @@ The following config is equivalent to ``--strict`` (as of mypy 1.0):
223222
# This one can be tricky to get passing if you use a lot of untyped libraries
224223
warn_return_any = True
225224
225+
# This one is a catch-all flag for the rest of strict checks that are technically
226+
# correct but may not be practical
227+
extra_checks = True
228+
226229
Note that you can also start with ``--strict`` and subtract, for instance:
227230

228231
.. code-block:: text

0 commit comments

Comments
 (0)