You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python 2 feature freeze (and removal of support) #12237
Since Python 2 reached its EOL Jan 1 2020 (over two years ago), I think that it's time to not actively improve Python 2 support any more.
Details:
We won't accept new PRs that improve Python 2 support, unless they fix a significant regression.
We won't drop or degrade existing support for Python 2, for now. Python 2 will become unsupported at some point, but at least not until the second half of 2022 (details TBD).
Existing open Python 2 PRs can still be merged if they seem useful and low risk.
We can remove some Python 2 specific test cases if they are hard to maintain (e.g. require runtime access to Python 2).
cc @sobolevn who has done some recent work on Python 2 features.
Worth noting that mypy appears to be the last type checker to still support Python 2. Pyre and pyright never supported it; pytype and pyanalyze dropped support last year. We also stopped updating the typing backport for Python 2. Once mypy drops Python 2 support, we should also remove the Python 2 stubs from typeshed.
Reacted by DevilXD, Ellis Breen and Michael Scott Asato Cuthbert
Reacted by Sebastian Rittau, Ellis Breen, Alex Waygood and John Hagen
Worth noting that mypy appears to be the last type checker to still support Python 2.
I think that PyCharm still supports Python 2.
There are also quite a few downloads of the typing backport for Python 2 (on the order of 150k-200k downloads per day): https://pypistats.org/packages/typing
I closed existing Python 2 specific issues (thanks @AlexWaygood for tagging them!). We don't need to keep open any new issues that only affect Python 2, unless it is a regression in a recent mypy release.
Reacted by Alex Waygood and Michael Scott Asato Cuthbert
I found out that there is a regression in typeshed that makes type checking Python 2 code impossible in 0.950 python/typeshed#7367 (comment)
It seems that no one else has Python 2 installed, so all the relevant tests were getting skipped, including in CI.
Since we effectively haven't been testing Python 2 support, I think we should just drop support in the next release. I don't think there is much to be gained from fixing this issue, and I don't really want to ask anyone who maintains typeshed to fix it :)
Perhaps we can post on the blog that we are considering dropping support for Python 2 in 0.960 in a blog post prior to the release so that if anyone has a problem with it they can open an issue (or better yet comment on this one).
Also to clarify: I am not worried about this specific issue, more that we aren't really checking Python 2 in CI anymore, so I think we shouldn't claim to support it.
Since we don't normally report errors from typeshed stubs, the issue seems benign. I'll prepare a typeshed PR that ignores the errors in the Python 2 stubs as well.
I think you need to add a new version to the readthedocs config now that is also pinned to an older version so that people can still easily get the needed docs when they're dealing with legacy Python 2 stuff?
Use of the Python 2 options with new mypy has a nice error message which should be enough documentation.
Not planning on more readthedocs config for this. Python 2 is dead. I assume if people still have Python 2 codebases they have bigger problems than tweaking their mypy config. And git is always forever. If you feel strongly, open another issue and see if it gets upvotes.
@hauntsaninja It would be really great if you could re upload the last documentation with Python 2 support on readthedocs as an additional version. Right now, it has become nearly impossible to find online useful information regarding type hints for Python 2.
Activity
hauntsaninja commentedon Feb 23, 2022
#12202 was a pretty significant Python 2 regression and we've only gotten the one report from it :-)
JelleZijlstra commentedon Feb 23, 2022
Worth noting that mypy appears to be the last type checker to still support Python 2. Pyre and pyright never supported it; pytype and pyanalyze dropped support last year. We also stopped updating the
typingbackport for Python 2. Once mypy drops Python 2 support, we should also remove the Python 2 stubs from typeshed.hauntsaninja commentedon Feb 23, 2022
Is Python 2 support still important for Dropbox?
JukkaL commentedon Feb 23, 2022
No.
JukkaL commentedon Feb 23, 2022
I think that PyCharm still supports Python 2.
There are also quite a few downloads of the
typingbackport for Python 2 (on the order of 150k-200k downloads per day): https://pypistats.org/packages/typingJukkaL commentedon Mar 31, 2022
I closed existing Python 2 specific issues (thanks @AlexWaygood for tagging them!). We don't need to keep open any new issues that only affect Python 2, unless it is a regression in a recent mypy release.
emmatyping commentedon May 19, 2022
I found out that there is a regression in typeshed that makes type checking Python 2 code impossible in 0.950 python/typeshed#7367 (comment)
It seems that no one else has Python 2 installed, so all the relevant tests were getting skipped, including in CI.
Since we effectively haven't been testing Python 2 support, I think we should just drop support in the next release. I don't think there is much to be gained from fixing this issue, and I don't really want to ask anyone who maintains typeshed to fix it :)
Perhaps we can post on the blog that we are considering dropping support for Python 2 in 0.960 in a blog post prior to the release so that if anyone has a problem with it they can open an issue (or better yet comment on this one).
Also to clarify: I am not worried about this specific issue, more that we aren't really checking Python 2 in CI anymore, so I think we shouldn't claim to support it.
JukkaL commentedon May 19, 2022
Does the Python 2 issue cause serious problems outside tests? I was able to type check simple Python 2 code examples without problems, at least.
emmatyping commentedon May 19, 2022
I think anything using set, mutable set or anything that inherits from AbstractSet will probably be broken.
JukkaL commentedon May 20, 2022
The Python 3 stubs apparently generate similar errors, but they are ignored. Example:
Since we don't normally report errors from typeshed stubs, the issue seems benign. I'll prepare a typeshed PR that ignores the errors in the Python 2 stubs as well.
JukkaL commentedon May 20, 2022
Suggested fix to the Python 2 issues: python/typeshed#7894
3 remaining items
AlexWaygood commentedon Jul 12, 2022
Typeshed has now removed all its Python 2 stubs: python/typeshed#8272.
No longer support checking Python 2
Drop need for virtualenv
Drop need for virtualenv (#13136)
No longer support checking Python 2 (#13135)
Delete fastparse2.py (#13251)
sobolevn commentedon Aug 31, 2022
I also propose to drop
six/ similar libraries support, since python2 is no longer supported.#13567
emmatyping commentedon Aug 31, 2022
Won't some Python 3 code that was ported from Python 2 still have
sixusage in it?ilevkivskyi commentedon Sep 1, 2022
Yeah, I can add +1 to @ethanhs comment. There is some code that runs on Python 3, but is still being cleaned up from all the
sixthings.[-]Python 2 feature freeze[/-][+]Python 2 feature freeze (and removal of support)[/+]SamB commentedon Sep 28, 2022
I think you need to add a new version to the readthedocs config now that is also pinned to an older version so that people can still easily get the needed docs when they're dealing with legacy Python 2 stuff?
SamB commentedon Sep 28, 2022
(It might also be worth adding something somewhere to the documentation about the removed support?)
hauntsaninja commentedon Oct 10, 2022
Closing, since this is done.
Use of the Python 2 options with new mypy has a nice error message which should be enough documentation.
Not planning on more readthedocs config for this. Python 2 is dead. I assume if people still have Python 2 codebases they have bigger problems than tweaking their mypy config. And git is always forever. If you feel strongly, open another issue and see if it gets upvotes.
schlamar commentedon Nov 15, 2022
@hauntsaninja It would be really great if you could re upload the last documentation with Python 2 support on readthedocs as an additional version. Right now, it has become nearly impossible to find online useful information regarding type hints for Python 2.