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

Plugin hook for preprocessing annotations #7758

Open
jtrakk opened this issue Oct 20, 2019 · 1 comment
Open

Plugin hook for preprocessing annotations #7758

jtrakk opened this issue Oct 20, 2019 · 1 comment
Labels
feature priority-2-low topic-plugins The plugin API and ideas for new plugins

Comments

@jtrakk
Copy link

jtrakk commented Oct 20, 2019

I want to add some custom annotations on my variables. For example,

def idiv(left: int, right: int | right != 0) -> int:
    return left // right

Mypy accepts only PEP 484 type hints, so I'd like to provide a plugin to pre-process this annotation and return a PEP 484-compatible hint before Mypy checks it. Could Mypy provide a preprocessing hook for such transformations?

@ilevkivskyi
Copy link
Member

This is a reasonable request, but probably not very high priority taking into account how many issues we have now.

The implementation will require adding a new plugin hook somewhere in mypy/fastparse.py.

@ilevkivskyi ilevkivskyi added feature priority-2-low topic-plugins The plugin API and ideas for new plugins labels Oct 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature priority-2-low topic-plugins The plugin API and ideas for new plugins
Projects
None yet
Development

No branches or pull requests

2 participants