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

Support for .pyi files #51

Closed bdelanghe closed 1 year ago

bdelanghe commented 4 years ago

Step 1: Are you in the right place?

Step 2: Describe your environment

Step 3: Describe the problem:

Steps to reproduce:

  1. create new package
  2. add foo.py with no annotations
  3. add foo.py with annotations

Observed Results:

Expected Results:

I'm fairly new to mypy and to the plugin. This might just be something that I'm doing inccorectly

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had activity in the last 60 days.

fgblomqvist commented 4 years ago

You can see how the command that this plugin is constructed here: https://github.com/leinardi/mypy-pycharm/blob/b37d3b2fcdb5b819f383a5a77ebdfbe18f6f686c/src/main/java/com/leinardi/pycharm/mypy/mpapi/MypyRunner.java#L269-L301

Generally, it will run this: mypy --show-column-numbers --follow-imports silent <files separated by spaces> (and might also include a config flag). If you run this command in your situation, does mypy pick up the pyi? If not, try passing the pyi file as well. Curious about the results. Shouldn't be hard to solve this one.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had activity in the last 60 days.

LecrisUT commented 3 months ago

What exactly was the resolution here?

I am encountering this issue because:

Maybe a solution for this is that if both .pyi and .py are present, do not run the plugin on the .py file. Would be a nightmare to figure out if it's a namespace package though. The most compatible solution would be to check the fullyqualified module name and run mypy -m