Skip to content

Commit

Permalink
Drop support for running with Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Jul 5, 2024
1 parent 6069718 commit 90bbd62
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.9'
- name: Install tox
run: pip install --upgrade 'setuptools!=50' tox==4.11.0
- name: Setup tox environment
Expand Down
30 changes: 12 additions & 18 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 All @@ -72,27 +66,27 @@ jobs:
test_mypyc: true

- name: mypyc runtime tests with py39-macos
python: '3.9.18'
python: '3.9.19'
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
toxenv: py
tox_extra_args: "-n 3 mypyc/test/test_run.py mypyc/test/test_external.py"
- name: mypyc runtime tests with py38-debug-build-ubuntu
python: '3.8.17'
- name: mypyc runtime tests with py39-debug-build-ubuntu
python: '3.9.19'
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 @@ -29,10 +29,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 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 @@ -451,10 +451,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
7 changes: 3 additions & 4 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 Expand Up @@ -185,7 +185,6 @@ def run(self):
"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 Down Expand Up @@ -232,7 +231,7 @@ def run(self):
"reports": "lxml",
"install-types": "pip",
},
python_requires=">=3.8",
python_requires=">=3.9",
include_package_data=True,
project_urls={
"Documentation": "https://mypy.readthedocs.io/en/stable/index.html",
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 @@ -10192,7 +10192,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
2 changes: 1 addition & 1 deletion test-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ pytest-xdist>=1.34.0
pytest-cov>=2.10.0
ruff==0.2.0 # must match version in .pre-commit-config.yaml
setuptools>=65.5.1
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

0 comments on commit 90bbd62

Please sign in to comment.