Deprecate Python 2 formatting support#2523
Conversation
|
Just tagging this as a "do not merge" as all of this is very much up for debate. |
cooperlees
left a comment
There was a problem hiding this comment.
You don’t own me. I can merge if I want to. 😂
In seriousness, I +1 … there is enough support with the current version for Python 2 syntax. It ain’t changing.
felix-hilden
left a comment
There was a problem hiding this comment.
Big +1 for this and the whole timeline 👍
src/black/__init__.py
Outdated
| # TODO: fully drop support and this code by December 1st, 2021. | ||
| if TargetVersion.PY27 in mode.target_versions or versions == {TargetVersion.PY27}: | ||
| err( | ||
| "DEPRECATION: Python 2 support will be removed after December 1st, 2021", |
There was a problem hiding this comment.
| "DEPRECATION: Python 2 support will be removed after December 1st, 2021", | |
| "DEPRECATION: Python 2 support will be removed by December 1st, 2021", |
The warning doesn't match the comment
There was a problem hiding this comment.
Perhaps something like" versions after black 22b0 will no longer support formatting python 2 code, pin to <21 for Python 2 support"
|
In #2529 I suggest dropping support together with the other process changes proposed there, in January of 2022. |
947142d to
04b2b26
Compare
|
The current structure of the commits require that this is merged via a rebase so the split ends up being useful :)
|
|
*Gentle nudge* |
|
lgtm. |
graingert
left a comment
There was a problem hiding this comment.
The comments aren't consistent
01cbded to
07ff8f9
Compare
|
One potential problem I do want to bring up is that right now each call to format_str with Python 2 warns ... that may be too noisy. |
JelleZijlstra
left a comment
There was a problem hiding this comment.
Noticed one typo.
I'm also still thinking about the feature detection stuff here and brought it up on Discord.
|
Printing for each file might be noisy, but properly doing it only once might require communication across asyncio workers, which I don't really want to have to deal with. |
- Use BlackRunner and .stdout in command line test So the next commit won't break this test. This is in its own commit so we can just revert the depreciation commit when dropping Python 2 support completely.
a8e9370 to
979be64
Compare
* Prepare for Python 2 depreciation - Use BlackRunner and .stdout in command line test So the next commit won't break this test. This is in its own commit so we can just revert the depreciation commit when dropping Python 2 support completely. * Deprecate Python 2 formatting support
Description
It's 2021. See also #2251.
Checklist - did you ...