question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use `com2ann` to translate type comments into type annotations

See original GitHub issue

Related 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
bigbird555commented, Jun 29, 2020

If translation of type annotation can be automated programmatically, that seems great!

0reactions
harupycommented, Jul 2, 2020

I added a comment on #711 that explains how to use and install com2ann so I’ll close this issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found