Use `com2ann` to translate type comments into type annotations
See original GitHub issueRelated to https://github.com/optuna/optuna/issues/711.
I found this python package named com2ann
which translates type comments into type annotations:
https://github.com/ilevkivskyi/com2ann
I’m testing this package on my local and it seems to be working fine so far. One adjustment that I had to make was prevent com2ann
from translating type comments on variables into variable annotaions (introduced in Python 3.6) because Optuna still supports Pyhton 3.5. Here’s the fixed version which preserves type comments on variables.
https://github.com/harupy/com2ann/tree/disable-variable-annotation
Can I give this a try?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
ilevkivskyi/com2ann: Tool for translation type comments ...
Tool for translation of type comments to type annotations in Python. The tool requires Python 3.8 to run. But the supported target code...
Read more >com2ann
Tool for translation of type comments to type annotations in Python. This tool requires Python 3.8 to run. But the supported target code...
Read more >com2ann | translation type comments to type annotations - kandi
Tool for translation of type comments to type annotations in Python. The tool requires Python 3.8 to run. But the supported target code...
Read more >Type Comments
In this video, I'll show you about type comments. Up to this point, we've been talking about type hints and annotations, which are...
Read more >com2ann 0.3.0 on PyPI
Tool to translate type comments to annotations. - 0.3.0 - a Python package on PyPI - Libraries.io.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If translation of type annotation can be automated programmatically, that seems great!
I added a comment on #711 that explains how to use and install
com2ann
so I’ll close this issue.