Skip to content
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

Drop support for running with Python 3.8 #17492

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
28 changes: 11 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,18 @@ jobs:
include:
# Make sure to run mypyc compiled unit tests for both
# the oldest and newest supported Python versions
- name: Test suite with py38-ubuntu, mypyc-compiled
python: '3.8'
- name: Test suite with py39-ubuntu, mypyc-compiled
python: '3.9'
arch: x64
os: ubuntu-latest
toxenv: py
tox_extra_args: "-n 4"
test_mypyc: true
- name: Test suite with py38-windows-64
python: '3.8'
arch: x64
os: windows-latest
toxenv: py38
tox_extra_args: "-n 4"
- name: Test suite with py39-ubuntu
- name: Test suite with py39-windows-64
python: '3.9'
arch: x64
os: ubuntu-latest
toxenv: py
os: windows-latest
toxenv: py39
tox_extra_args: "-n 4"
- name: Test suite with py310-ubuntu
python: '3.10'
Expand Down Expand Up @@ -88,7 +82,7 @@ jobs:
# test_mypyc: true

- name: mypyc runtime tests with py39-macos
python: '3.9.18'
python: '3.9.20'
arch: x64
# TODO: macos-13 is the last one to support Python 3.9, change it to macos-latest when updating the Python version
os: macos-13
Expand All @@ -98,20 +92,20 @@ jobs:
# - https://github.com/python/mypy/issues/17819
# - https://github.com/python/mypy/pull/17822
# - name: mypyc runtime tests with py38-debug-build-ubuntu
# python: '3.8.17'
# python: '3.9.20'
# arch: x64
# os: ubuntu-latest
# toxenv: py
# tox_extra_args: "-n 4 mypyc/test/test_run.py mypyc/test/test_external.py"
# debug_build: true

- name: Type check our own code (py38-ubuntu)
python: '3.8'
- name: Type check our own code (py39-ubuntu)
python: '3.9'
arch: x64
os: ubuntu-latest
toxenv: type
- name: Type check our own code (py38-windows-64)
python: '3.8'
- name: Type check our own code (py39-windows-64)
python: '3.9'
arch: x64
os: windows-latest
toxenv: type
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_stubgenc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:

- uses: actions/checkout@v4

- name: Setup 🐍 3.8
- name: Setup 🐍 3.9
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9

- name: Test stubgenc
run: misc/test-stubgenc.sh
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ hash -r # This resets shell PATH cache, not necessary on Windows
```

> **Note**
> You'll need Python 3.8 or higher to install all requirements listed in
> You'll need Python 3.9 or higher to install all requirements listed in
> test-requirements.txt

### Running tests
Expand Down
2 changes: 1 addition & 1 deletion docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ may not make much sense otherwise.
Installing and running mypy
***************************

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

.. code-block:: shell

Expand Down
2 changes: 1 addition & 1 deletion mypy/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Earliest fully supported Python 3.x version. Used as the default Python
# version in tests. Mypy wheels should be built starting with this version,
# and CI tests should be run on this version (and later versions).
PYTHON3_VERSION: Final = (3, 8)
PYTHON3_VERSION: Final = (3, 9)

# Earliest Python 3.x version supported via --python-version 3.x. To run
# mypy, at least version PYTHON3_VERSION is needed.
Expand Down
6 changes: 3 additions & 3 deletions mypy/test/meta/test_parse_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ def test_bad_ge_version_check(self) -> None:
"""
[case abc]
s: str
[out version>=3.8]
[out version>=3.9]
abc
"""
)

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

def test_bad_eq_version_check(self) -> None:
# Act
Expand All @@ -70,4 +70,4 @@ def test_bad_eq_version_check(self) -> None:
)

# Assert
assert "version==3.7 always false since minimum runtime version is (3, 8)" in actual.stdout
assert "version==3.7 always false since minimum runtime version is (3, 9)" in actual.stdout
6 changes: 3 additions & 3 deletions mypy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,10 @@ def get_unique_redefinition_name(name: str, existing: Container[str]) -> str:
def check_python_version(program: str) -> None:
"""Report issues with the Python used to run mypy, dmypy, or stubgen"""
# Check for known bad Python versions.
if sys.version_info[:2] < (3, 8): # noqa: UP036
if sys.version_info[:2] < (3, 9):
sys.exit(
"Running {name} with Python 3.7 or lower is not supported; "
"please upgrade to 3.8 or newer".format(name=program)
"Running {name} with Python 3.8 or lower is not supported; "
"please upgrade to 3.9 or newer".format(name=program)
)


Expand Down
2 changes: 1 addition & 1 deletion mypy_self_check.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ show_traceback = True
pretty = True
always_false = MYPYC
plugins = mypy.plugins.proper_plugin
python_version = 3.8
python_version = 3.9
exclude = mypy/typeshed/|mypyc/test-data/|mypyc/lib-rt/
enable_error_code = ignore-without-code,redundant-expr
enable_incomplete_feature = PreciseTupleTypes
Expand Down
2 changes: 1 addition & 1 deletion mypyc/doc/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Installation
------------

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

.. code-block::

Expand Down
1 change: 1 addition & 0 deletions mypyc/test/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def run_case_step(self, testcase: DataDrivenTestCase, incremental_step: int) ->
# TODO: testDecorators1 hangs on 3.12, remove this once fixed
proc.wait(timeout=30)
output = proc.communicate()[0].decode("utf8")
output = output.replace(f' File "{os.getcwd()}{os.sep}', ' File "')
outlines = output.splitlines()

if testcase.config.getoption("--mypyc-showc"):
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -45,7 +44,7 @@ classifiers = [
"Topic :: Software Development",
"Typing :: Typed",
]
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
# When changing this, also update build-system.requires and mypy-requirements.txt
"typing_extensions>=4.6.0",
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import sys
from typing import TYPE_CHECKING, Any

if sys.version_info < (3, 8, 0): # noqa: UP036
sys.stderr.write("ERROR: You need Python 3.8 or later to use mypy.\n")
if sys.version_info < (3, 9, 0):
sys.stderr.write("ERROR: You need Python 3.9 or later to use mypy.\n")
exit(1)

# we'll import stuff from the source tree, let's ensure is on the sys path
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/check-columns.test
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class D(A):
# N:5: def f(self) -> None

[case testColumnMissingTypeParameters]
# flags: --disallow-any-generics
# flags: --python-version 3.8 --disallow-any-generics
from typing import List, Callable
def f(x: List) -> None: pass # E:10: Missing type parameters for generic type "List"
def g(x: list) -> None: pass # E:10: Implicit generic "Any". Use "typing.List" and specify generic parameters
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/check-errorcodes.test
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ a: A
a.x = '' # E: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]

[case testErrorCodeMissingTypeArg]
# flags: --disallow-any-generics
# flags: --python-version 3.8 --disallow-any-generics
from typing import List, TypeVar
x: List # E: Missing type parameters for generic type "List" [type-arg]
y: list # E: Implicit generic "Any". Use "typing.List" and specify generic parameters [type-arg]
Expand Down
1 change: 1 addition & 0 deletions test-data/unit/check-functools.test
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ p1("a", "b") # TODO: false negative
[builtins fixtures/dict.pyi]

[case testFunctoolsPartialTypeGuard]
# flags: --python-version 3.8
import functools
from typing_extensions import TypeGuard

Expand Down
2 changes: 2 additions & 0 deletions test-data/unit/check-generics.test
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ Alias[int]("a") # E: Argument 1 to "Node" has incompatible type "str"; expected
[out]

[case testTypeApplicationCrash]
# flags: --python-version 3.8
import types
type[int] # this was crashing, see #2302 (comment) # E: The type "Type[type]" is not generic and not indexable
[builtins fixtures/tuple.pyi]
Expand Down Expand Up @@ -1130,6 +1131,7 @@ reveal_type(Bad) # N: Revealed type is "Any"
[out]

[case testNoSubscriptionOfBuiltinAliases]
# flags: --python-version 3.8
from typing import List, TypeVar

list[int]() # E: "list" is not subscriptable
Expand Down
4 changes: 2 additions & 2 deletions test-data/unit/check-incremental.test
Original file line number Diff line number Diff line change
Expand Up @@ -3753,7 +3753,7 @@ import b
[file b.py]
-- This is a heinous hack, but we simulate having a invalid cache by clobbering
-- the proto deps file with something with mtime mismatches.
[file ../.mypy_cache/3.8/@deps.meta.json.2]
[file ../.mypy_cache/3.9/@deps.meta.json.2]
{"snapshot": {"__main__": "a7c958b001a45bd6a2a320f4e53c4c16", "a": "d41d8cd98f00b204e9800998ecf8427e", "b": "d41d8cd98f00b204e9800998ecf8427e", "builtins": "c532c89da517a4b779bcf7a964478d67"}, "deps_meta": {"@root": {"path": "@root.deps.json", "mtime": 0}, "__main__": {"path": "__main__.deps.json", "mtime": 0}, "a": {"path": "a.deps.json", "mtime": 0}, "b": {"path": "b.deps.json", "mtime": 0}, "builtins": {"path": "builtins.deps.json", "mtime": 0}}}
[file ../.mypy_cache/.gitignore]
# Another hack to not trigger a .gitignore creation failure "false positive"
Expand Down Expand Up @@ -3788,7 +3788,7 @@ import b
[file b.py]
-- This is a heinous hack, but we simulate having a invalid cache by deleting
-- the proto deps file.
[delete ../.mypy_cache/3.8/@deps.meta.json.2]
[delete ../.mypy_cache/3.9/@deps.meta.json.2]
[file b.py.2]
# uh
-- Every file should get reloaded, since the cache was invalidated
Expand Down
6 changes: 3 additions & 3 deletions test-data/unit/fine-grained-cache-incremental.test
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ a.py:8: note: x: expected "int", got "str"
[file b.py]
-- This is a heinous hack, but we simulate having a invalid cache by clobbering
-- the proto deps file with something with mtime mismatches.
[file ../.mypy_cache/3.8/@deps.meta.json.2]
[file ../.mypy_cache/3.9/@deps.meta.json.2]
{"snapshot": {"__main__": "a7c958b001a45bd6a2a320f4e53c4c16", "a": "d41d8cd98f00b204e9800998ecf8427e", "b": "d41d8cd98f00b204e9800998ecf8427e", "builtins": "c532c89da517a4b779bcf7a964478d67"}, "deps_meta": {"@root": {"path": "@root.deps.json", "mtime": 0}, "__main__": {"path": "__main__.deps.json", "mtime": 0}, "a": {"path": "a.deps.json", "mtime": 0}, "b": {"path": "b.deps.json", "mtime": 0}, "builtins": {"path": "builtins.deps.json", "mtime": 0}}}

[file b.py.2]
Expand Down Expand Up @@ -234,8 +234,8 @@ x = 10
[file p/c.py]
class C: pass

[delete ../.mypy_cache/3.8/b.meta.json.2]
[delete ../.mypy_cache/3.8/p/c.meta.json.2]
[delete ../.mypy_cache/3.9/b.meta.json.2]
[delete ../.mypy_cache/3.9/p/c.meta.json.2]

[out]
==
2 changes: 1 addition & 1 deletion test-data/unit/fine-grained.test
Original file line number Diff line number Diff line change
Expand Up @@ -10228,7 +10228,7 @@ class Base(Protocol):
main:5: error: Call to abstract method "meth" of "Base" with trivial body via super() is unsafe

[case testPrettyMessageSorting]
# flags: --pretty
# flags: --python-version 3.8 --pretty
import a

[file a.py]
Expand Down
4 changes: 2 additions & 2 deletions test-data/unit/parse-errors.test
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ file:1: error: invalid syntax
[case testUnexpectedEof]
if 1:
[out]
file:1: error: unexpected EOF while parsing
file:1: error: expected an indented block

[case testInvalidKeywordArguments1]
f(x=y, z)
Expand Down Expand Up @@ -434,7 +434,7 @@ file:1: error: invalid syntax
[case testSmartQuotes]
foo = ‘bar’
[out]
file:1: error: invalid character in identifier
file:1: error: invalid character '‘' (U+2018)

[case testExceptCommaInPython3]
try:
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ pytest>=8.1.0
pytest-xdist>=1.34.0
pytest-cov>=2.10.0
setuptools>=75.1.0
tomli>=1.1.0 # needed even on py311+ so the self check passes with --python-version 3.8
tomli>=1.1.0 # needed even on py311+ so the self check passes with --python-version 3.9
pre_commit>=3.5.0
Loading