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

"Mypy found no problems" after adding "[plugins]" part in mypy.ini

Open HappyCthulhu opened this issue 1 year ago • 5 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.15.0
  • PyCharm/IDEA version: 2022.3.3
  • Mypy version: 1.2.0

Step 3: Describe the problem:

I know, that similar problem was described in this issue. But nobody told, how to reproduce it. So, i will)

Steps to reproduce:

  1. install lib django-stubs[compatible-mypy] to your project with pip install django-stubs[compatible-mypy]
  2. add it in plugins part like this:
[mypy]
mypy_path = stubs/

plugins =
    mypy_django_plugin.main

Observed Results:

  • Mypy found no problems

So, after adding plugins part mypy pycharm plugin cant find any problems. But, if u with run mypy throung terminal, its finds problems.

Expected Results:

  • Mypy plugin shows same errors as in terminal (mypy binary)

Before adding plugins part: image

After adding plugins part: image

Mypy binary: image

My config:

[mypy]
mypy_path = stubs/
plugins =
    mypy_django_plugin.main


    [mypy.plugins.django-stubs]
    django_settings_module = "config.settings"

HappyCthulhu avatar Apr 26 '23 20:04 HappyCthulhu

I want to like pycharm, because I use Rider for C#, and Rider is awesome. But without mypy support, pycharm is dead on arrival...

hughperkins avatar Jun 21 '23 23:06 hughperkins

Does this help you?

millsks avatar Jul 05 '23 18:07 millsks

No. There are actually multiple different issues. But that was not one of them. mypy works perfectly for me. But pycharm doesn't appear to use mypy, which is the root of the issues. One issue is that pycharm treats a parameter written as someparam: str = None as implicitly typed to Optional[str], rather than as a syntax error. The current pycharm behavior was deprecated in mypy a year or two ago. There are additional errors that mypy detects, but pycharm does not. I've gone back to using vscode for now, whilst for Unity/C#, Rider is pretty good.

hughperkins avatar Jul 05 '23 18:07 hughperkins

Hi! I'm experiencing the same issue. Is there any workarounds about it?

pingvincible avatar Oct 06 '23 11:10 pingvincible

Hi! I'm experiencing the same issue. Is there any workarounds about it?

Nope... I solved it by moving to VsCode. Its very shitty for python, but u can set up mypy pretty nicelly. And mypy is very important. Also have in plans find out, how mypy works in emacs

HappyCthulhu avatar Oct 06 '23 14:10 HappyCthulhu