leinardi / mypy-pycharm

A plugin providing both real-time and on-demand scanning of Python files with Mypy from within PyCharm/IDEA.
Apache License 2.0
194 stars 31 forks source link

Mypy executable is reported missing despite successful test #98

Open fralik opened 2 years ago

fralik commented 2 years ago

Step 1: Are you in the right place?

Step 2: Describe your environment

Step 3: Describe the problem:

Steps to reproduce:

  1. I am using mypy from a different venv than the one I run my code with.
  2. Configure mypy executable
  3. Verify it works by clicking Test button.
  4. Click Check current button

Observed Results:

Expected Results:

Relevant Code:

11:07   Mypy Plugin: Success: executable found!

11:08   Mypy Plugin (Mypy missing)
    The project interpreter is missing Mypy, which is needed to properly check the imports.
    Install Mypy
intgr commented 2 years ago

I am using mypy from a different venv than the one I run my code with.

Yep, sorry, this is a use case that is not supported by the plugin currently.

You coud probably make it work with some hacks -- like creating a wrapper script named mypy in your project virtualenv bin directory, which deactivates the project venv and invokes mypy in the other virtualenv. But I haven't tried this.

fralik commented 2 years ago

I dug into the code. Looks like the initial issue is in the way how availability is checked, see here. When files are being added for scanning that function is called with showNotifications == true resulting in returning false even if path to mypy is set via plugin configuration.

fralik commented 2 years ago

I am observing another issue, which I am unsure if it is related or not. I now managed to run mypy, I see in the code that it returns 14 issues, but they are not displayed in the UI. UI indicates A scan is in progress and then Mypy found no problems.