mypy-pycharm icon indicating copy to clipboard operation
mypy-pycharm copied to clipboard

Mypy executable is reported missing despite successful test

Open fralik opened this issue 2 years ago • 3 comments

Step 1: Are you in the right place?

  • [x] I have verified there are no duplicate active or recent bugs, questions, or requests
  • [x] I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.14.0
  • PyCharm/IDEA version: 2021.3.1
  • Mypy version: 0.780

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:

  • Scan results say Mypy found no problems
  • Event log reports that the executable can not be found, i.e. mypy missing.

Expected Results:

  • successful mypy check.

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

fralik avatar Mar 11 '22 10:03 fralik

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.

intgr avatar Mar 11 '22 10:03 intgr

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 avatar Mar 11 '22 12:03 fralik

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.

fralik avatar Mar 11 '22 13:03 fralik