-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Drop support for running with Python 3.9 #20156
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
|
I can take updating ruff to get rid of the UP038 thing (edit: #20158 ) |
1937838 to
088c00a
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR would be ready now. I'd recommend to look at the commits individually to make the review easier.
| if "--no-force-union-syntax" not in mypy_cmdline: | ||
| mypy_cmdline.append("--force-union-syntax") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this here temporarily. Without it the output of a lot of pythoneval test would change now that these are run with 3.10 by default.
I plan to update the test outputs to use the PEP 604 union syntax in separate PRs later.
| ### Drop Support for Python 3.9 | ||
|
|
||
| Mypy no longer supports running with Python 3.9, which has reached end-of-life. | ||
| When running mypy with Python 3.10+, it is still possible to type check code | ||
| that needs to support Python 3.9 with the `--python-version 3.9` argument. | ||
| Support for this will be dropped in the first half of 2026! | ||
|
|
||
| Contributed by Marc Mueller (PR [20156](https://github.com/python/mypy/pull/20156)). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reused the changelog entry from dropping Python 3.8 here. Just adjusted the numbers :)
| filelock>=3.3.0,<3.20.0 # latest version is not available on 3.9 that we still support | ||
| filelock>=3.3.0 | ||
| lxml>=5.3.0; python_version<'3.15' | ||
| psutil>=4.0 | ||
| 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.9 | ||
| tomli>=1.1.0 # needed even on py311+ so the self check passes with --python-version 3.10 | ||
| pre_commit>=3.5.0 | ||
| platformdirs<4.5.0 # latest version is not available on 3.9 that we still support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pins for filelock and platformdirs were added in #20031. This change just reverse it now that Python 3.9 will be dropped.
|
I removed the ruff |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
| os: ubuntu-24.04-arm | ||
| toxenv: py | ||
| tox_extra_args: "-n 4" | ||
| - name: Test suite with py312-ubuntu, mypyc-compiled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be removed, is there a reason to do so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far we've tested a subset of versions with mypyc-compiled and without. In particular
- The oldest and latest supported versions with mypyc
- Often the second and third oldest without => that's what I'm doing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should also change the test_mypyc: true
This comment has been minimized.
This comment has been minimized.
|
Huzzah! You could cleanup diff --git a/tox.ini b/tox.ini
index 65f67aba4..8e97590b0 100644
--- a/tox.ini
+++ b/tox.ini
@@ -2,8 +2,6 @@
minversion = 4.4.4
skip_missing_interpreters = {env:TOX_SKIP_MISSING_INTERPRETERS:True}
envlist =
- py38,
- py39,
py310,
py311,
py312, |
|
Also, for the follow-up PR with the |
I just looked through the suggestions. A lot of them do look good to me though my experience so far has been that this is a deeply personal matter. It's probably best to leave it up to the individual developer where to use it and as such I'd suggest we don't change existing code just for the sake of it. |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
|
As I mentioned in the issue, I would prefer that this is merged after 1.19 is out. |
Similar to last year (#17492), start by dropping support for running mypy with Python 3.9.
Users will still be able to type check 3.9 code with
--python-version 3.9until typeshed drops the support for it.Refs #20154