Skip to content

Commit 2d6b521

Browse files
cdce8phamdanal
andauthored
Drop support for running with Python 3.8 (#17492)
Similar to last year (#15566), start by dropping support for running mypy with Python 3.8. Users will still be able to type check 3.8 code with `--python-version 3.8` until typeshed drops the support for it. It's a bit early as the EOL for Python 3.8 is in ~3 months. However, since the branch for `1.11.0` has been cut already, we'd only drop the support with `1.12.0` which isn't due for another 1-2 months. Additionally dropping `3.8` now will make it easier to support `3.13` with its C-API changes and also give us enough time to cleanup the remaining 3.8 code blocks and documentation references. --------- Co-authored-by: Ali Hamdan <ali.hamdan.dev@gmail.com>
1 parent 9ff9946 commit 2d6b521

21 files changed

+42
-45
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,18 @@ jobs:
3131
include:
3232
# Make sure to run mypyc compiled unit tests for both
3333
# the oldest and newest supported Python versions
34-
- name: Test suite with py38-ubuntu, mypyc-compiled
35-
python: '3.8'
34+
- name: Test suite with py39-ubuntu, mypyc-compiled
35+
python: '3.9'
3636
arch: x64
3737
os: ubuntu-latest
3838
toxenv: py
3939
tox_extra_args: "-n 4"
4040
test_mypyc: true
41-
- name: Test suite with py38-windows-64
42-
python: '3.8'
43-
arch: x64
44-
os: windows-latest
45-
toxenv: py38
46-
tox_extra_args: "-n 4"
47-
- name: Test suite with py39-ubuntu
41+
- name: Test suite with py39-windows-64
4842
python: '3.9'
4943
arch: x64
50-
os: ubuntu-latest
51-
toxenv: py
44+
os: windows-latest
45+
toxenv: py39
5246
tox_extra_args: "-n 4"
5347
- name: Test suite with py310-ubuntu
5448
python: '3.10'
@@ -88,7 +82,7 @@ jobs:
8882
# test_mypyc: true
8983

9084
- name: mypyc runtime tests with py39-macos
91-
python: '3.9.18'
85+
python: '3.9.21'
9286
arch: x64
9387
# TODO: macos-13 is the last one to support Python 3.9, change it to macos-latest when updating the Python version
9488
os: macos-13
@@ -98,20 +92,20 @@ jobs:
9892
# - https://github.com/python/mypy/issues/17819
9993
# - https://github.com/python/mypy/pull/17822
10094
# - name: mypyc runtime tests with py38-debug-build-ubuntu
101-
# python: '3.8.17'
95+
# python: '3.9.21'
10296
# arch: x64
10397
# os: ubuntu-latest
10498
# toxenv: py
10599
# tox_extra_args: "-n 4 mypyc/test/test_run.py mypyc/test/test_external.py"
106100
# debug_build: true
107101

108-
- name: Type check our own code (py38-ubuntu)
109-
python: '3.8'
102+
- name: Type check our own code (py39-ubuntu)
103+
python: '3.9'
110104
arch: x64
111105
os: ubuntu-latest
112106
toxenv: type
113-
- name: Type check our own code (py38-windows-64)
114-
python: '3.8'
107+
- name: Type check our own code (py39-windows-64)
108+
python: '3.9'
115109
arch: x64
116110
os: windows-latest
117111
toxenv: type

.github/workflows/test_stubgenc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ jobs:
3030

3131
- uses: actions/checkout@v4
3232

33-
- name: Setup 🐍 3.8
33+
- name: Setup 🐍 3.9
3434
uses: actions/setup-python@v5
3535
with:
36-
python-version: 3.8
36+
python-version: 3.9
3737

3838
- name: Test stubgenc
3939
run: misc/test-stubgenc.sh

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ hash -r # This resets shell PATH cache, not necessary on Windows
5151
```
5252

5353
> **Note**
54-
> You'll need Python 3.8 or higher to install all requirements listed in
54+
> You'll need Python 3.9 or higher to install all requirements listed in
5555
> test-requirements.txt
5656
5757
### Running tests

docs/source/getting_started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ may not make much sense otherwise.
1616
Installing and running mypy
1717
***************************
1818

19-
Mypy requires Python 3.8 or later to run. You can install mypy using pip:
19+
Mypy requires Python 3.9 or later to run. You can install mypy using pip:
2020

2121
.. code-block:: shell
2222

mypy/defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Earliest fully supported Python 3.x version. Used as the default Python
77
# version in tests. Mypy wheels should be built starting with this version,
88
# and CI tests should be run on this version (and later versions).
9-
PYTHON3_VERSION: Final = (3, 8)
9+
PYTHON3_VERSION: Final = (3, 9)
1010

1111
# Earliest Python 3.x version supported via --python-version 3.x. To run
1212
# mypy, at least version PYTHON3_VERSION is needed.

mypy/test/meta/test_parse_data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ def test_bad_ge_version_check(self) -> None:
5050
"""
5151
[case abc]
5252
s: str
53-
[out version>=3.8]
53+
[out version>=3.9]
5454
abc
5555
"""
5656
)
5757

5858
# Assert
59-
assert "version>=3.8 always true since minimum runtime version is (3, 8)" in actual.stdout
59+
assert "version>=3.9 always true since minimum runtime version is (3, 9)" in actual.stdout
6060

6161
def test_bad_eq_version_check(self) -> None:
6262
# Act
@@ -70,4 +70,4 @@ def test_bad_eq_version_check(self) -> None:
7070
)
7171

7272
# Assert
73-
assert "version==3.7 always false since minimum runtime version is (3, 8)" in actual.stdout
73+
assert "version==3.7 always false since minimum runtime version is (3, 9)" in actual.stdout

mypy/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,10 @@ def get_unique_redefinition_name(name: str, existing: Container[str]) -> str:
490490
def check_python_version(program: str) -> None:
491491
"""Report issues with the Python used to run mypy, dmypy, or stubgen"""
492492
# Check for known bad Python versions.
493-
if sys.version_info[:2] < (3, 8): # noqa: UP036
493+
if sys.version_info[:2] < (3, 9):
494494
sys.exit(
495-
"Running {name} with Python 3.7 or lower is not supported; "
496-
"please upgrade to 3.8 or newer".format(name=program)
495+
"Running {name} with Python 3.8 or lower is not supported; "
496+
"please upgrade to 3.9 or newer".format(name=program)
497497
)
498498

499499

mypy_self_check.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ show_traceback = True
66
pretty = True
77
always_false = MYPYC
88
plugins = mypy.plugins.proper_plugin
9-
python_version = 3.8
9+
python_version = 3.9
1010
exclude = mypy/typeshed/|mypyc/test-data/|mypyc/lib-rt/
1111
enable_error_code = ignore-without-code,redundant-expr
1212
enable_incomplete_feature = PreciseTupleTypes

mypyc/doc/getting_started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Installation
3838
------------
3939

4040
Mypyc is shipped as part of the mypy distribution. Install mypy like
41-
this (you need Python 3.8 or later):
41+
this (you need Python 3.9 or later):
4242

4343
.. code-block::
4444

mypyc/test/test_run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ def run_case_step(self, testcase: DataDrivenTestCase, incremental_step: int) ->
320320
# TODO: testDecorators1 hangs on 3.12, remove this once fixed
321321
proc.wait(timeout=30)
322322
output = proc.communicate()[0].decode("utf8")
323+
output = output.replace(f' File "{os.getcwd()}{os.sep}', ' File "')
323324
outlines = output.splitlines()
324325

325326
if testcase.config.getoption("--mypyc-showc"):

0 commit comments

Comments
 (0)