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

Convert Python 2 type hints to Python 3 #8233

Closed
ewhauser opened this issue Jan 2, 2020 · 2 comments
Closed

Convert Python 2 type hints to Python 3 #8233

ewhauser opened this issue Jan 2, 2020 · 2 comments
Labels

Comments

@ewhauser
Copy link

@ewhauser ewhauser commented Jan 2, 2020

Is there a feature available in mypy or elsewhere to convert Python 2 Type Hint comments to Python 3 syntax? With Python 2 going EOL, there should be something available to help users convert their code to the cleaner syntax.

Thanks.

@TH3CHARLie

This comment has been minimized.

Copy link
Contributor

@TH3CHARLie TH3CHARLie commented Jan 3, 2020

A possible approach would be using misc/fix_annotate.py with lib2to3 to generate Python3 code. However, I haven't practiced it yet

@ethanhs

This comment has been minimized.

Copy link
Collaborator

@ethanhs ethanhs commented Jan 3, 2020

The best tool I know of is com2ann (https://github.com/ilevkivskyi/com2ann) which was written by Ivan.

@ethanhs ethanhs added the question label Jan 3, 2020
@ethanhs ethanhs closed this Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.