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

Support for mypy using WSL interpreter #110

Open
wholmen opened this issue May 3, 2023 · 6 comments
Open

Support for mypy using WSL interpreter #110

wholmen opened this issue May 3, 2023 · 6 comments

Comments

@wholmen
Copy link

wholmen commented May 3, 2023

I have my repository and python interpreter set up in WSL 2. I would like to use Mypy in Pycharm, but I can't get it to work.

I have tried to use the mypy installation in the virtual environment installed in WSL and I have tried to install Mypy in Windows and use that on my WSL projects.

Neither work.

Would it be possible for the interpreter to find the mypy package in the project interpreter when that interpreter is set up on WSL?

Edit: It seems like the developer of Ruff plugin has found a good solution for this. Maybe there are possibilities of implementing the same logic? koxudaxi/ruff-pycharm-plugin#72

@aploium
Copy link

aploium commented Jul 2, 2023

If it's not feasible to support calling mypy under PyCharm's native WSL, then a fallback "mixed" solution could also be acceptable.
That is: installing an extra copy of python (and mypy) under the Windows environment, while the project interpreter is WSL, and then manually forcing the plugin to call mypy under Windows.
At present, in order to use mypy plugin, I am forced to set the project interpreter to Windows.

@wholmen
Copy link
Author

wholmen commented Jul 4, 2023

I think it's feasible to call mypy under PyChams native WSL. I got the impression that it wasn't a big problem to adjust the Ruff plugin

@aploium
Copy link

aploium commented Jul 4, 2023

I think it's feasible to call mypy under PyChams native WSL. I got the impression that it wasn't a big problem to adjust the Ruff plugin

Actually, as a user, I just want to express: oh please, I'm hungry to have mypy there lol.
There is an open pull request #99 which may be a temporary solution, but I don't know how to build it to working plugin

@leinardi
Copy link
Owner

@aploium to build the plugin you just have to checkout the PR code and run ./gradlew clean buildPlugin. It will generate a mypy-plugin-<version>.zip plugin somewhere inside the build directory (probably in build/distribution iirc).

@aploium
Copy link

aploium commented Jul 10, 2023

@aploium to build the plugin you just have to checkout the PR code and run ./gradlew clean buildPlugin. It will generate a mypy-plugin-<version>.zip plugin somewhere inside the build directory (probably in build/distribution iirc).

I've succeed to build the patched version, and manually set the correct mypy.exe path in native windows.
Sadly, it still shows error No Python interpreter configured for the project..
:(

@aploium
Copy link

aploium commented Jul 28, 2023

finally, I modified the MypyRunner.java, commented out the checkMypyAvailable(), force it return ture, and hardcoded my mypy.exe path in getMypyPath(), then rebuild the plugin.
which makes my mypy work by always reach the windows native mypy.exe, regardless what the project interpreter is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants