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

Make Python 2 support an "extra" (removed the dependency on typed-ast) #2044

Closed
KotlinIsland opened this issue Mar 15, 2021 · 4 comments
Closed
Labels
C: dependencies C: packaging Installation and packaging of Black T: enhancement New feature or request

Comments

@KotlinIsland
Copy link
Contributor

python/mypy#10124
https://github.com/python/mypy/pull/10183/files

typed-ast is a pain and not required for py >= 3.8

Can something similar to mypy be implemented where python 2 support is extra?

@KotlinIsland KotlinIsland added the T: enhancement New feature or request label Mar 15, 2021
@ichard26 ichard26 added the C: packaging Installation and packaging of Black label Mar 15, 2021
@ichard26
Copy link
Collaborator

I'm personally +1 for this but it would have to quite well managed and well signalled to reduce breakage and breakage duration. Right now we informally tell users that Python 2 support won't be removed for the foreseeable future and this change would break that.

@cooperlees @JelleZijlstra initial thoughts?

@JelleZijlstra
Copy link
Collaborator

Maybe we can eventually remove Python 2 support? I personally don't use it, but clearly some people still do.

I wonder if making typed-ast an extra could also break some Python 3 use cases, like formatting Python 3.9-only code with Black running under 3.6.

@cooperlees
Copy link
Collaborator

I feel we just copy mypy here and add the version gate + extra install to typed-ast.

E.g.: Adding ; python_version<'3.8' should fix most things.
https://github.com/psf/black/blob/master/setup.py#L74

  • We can also copy the extra install:
extras_require={'python2': 'typed-ast>=1.4.2'},

I have no idea with poetry tho. I am sure we'd need changes there too. but I'd totally accept this PR.

@ichard26
Copy link
Collaborator

ichard26 commented Apr 2, 2021

Closing as this was implemented by GH-2053. If there's any issues, either comment them here or create a new issue. Thanks @KotlinIsland for the request!

@ichard26 ichard26 closed this as completed Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: dependencies C: packaging Installation and packaging of Black T: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants