Mypy support #2352
fergusq
started this conversation in
Show and tell
Mypy support
#2352
Replies: 1 comment
-
Yeah, if type-checking Hy with Mypy is something you're interested in, I'd suggest filing an issue with them to not require the extension |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
To kill time, I experimented modifying Mypy to allow type-checking of Hy.
I came up with the following code that monkey-patches mypy. It can be used for type-checking singular Hy f, but it cannot find imports since patching Mypy's module finding algorithm is significantly more complicated. Particularly, Mypy expects that all Python files have the .py extension and all other files are compiled files.
To make monkey-patching possible, Mypy must be installed as interpreted version instead of compiler:
In principle there is nothing preventing forking Mypy and changing the file extension related code. That should be a fine project for someone interested. I'm not interested in maintaining such a fork. Even better would be to lobby the Mypy team to change their api so that adding support for new languages is easier, but I'm not sure if they are interested.
Beta Was this translation helpful? Give feedback.
All reactions