Is there a way to get PyCharm to support python 2 interpeters with PEP 484 annonations when # coding: mypy is provided in the header?

As part of MyPy there is this library:

https://github.com/python/mypy/tree/master/mypy/codec

 

I checked this thing locally and it seems to work fine on my test code, but pyCharm obviously hates this code unless i change the interpreter to python3.

The problem with that method is that the code is python 2 so some pyCharm analysis will be wrong.

I tried to search for a way to get pyCharm to use the the custom codec as well, but found no way in google, i assume that it might require a change in pyCharm or creating a plugin, but i do hope to be wrong.

If there is no way to do that without changin pyCharm, is it possible to make this work in the future? (Assuming that the codec code moves to be a seperate model with an install script and a pip package). I know that a plugin can be built, but the syntax is so close that it will be a shame to duplicate existing pyCharm coloring code just to make this work.

Please sign in to leave a comment.