python-lsp / pylsp-mypy

Mypy plugin for the Python LSP Server.
MIT License
118 stars 35 forks source link

How to install Django stubs to python-lsp-server mypy plugin #56

Closed jhartum closed 1 year ago

jhartum commented 1 year ago

I install Django-stubs in venv but I still got mypy errors about Django

image
Richardk2n commented 1 year ago

Related to #50 I assume? Do not close Issues just to open new ones about the same problem!

This is not a stubs not found error. Seems like a normal mypy report in relation to your code? (Assuming models.py is your code and contains these untyped parameters) this works as intended. If this assumption is wrong please elaborate.

jhartum commented 1 year ago

thank you for your answer sorry for duplicate issue, I just think it's not the same problems. In #50 issue I just trying to configure mypy installed from mason, but now I wanna use mypy as plugin to python-lsp-server I get this error, and I found this stackoverflow question and they say install Django-stubs, so I install it in my venv but still got this errors I think mypy just not configured to use Django-stubs, is it possible to configure mypy from pyproject.toml file?

image
jhartum commented 1 year ago

@Richardk2n I need to continue this issue in #50 ?

Richardk2n commented 1 year ago

If the issue is not related, creating a new one is fine. pylsp-mypy is just a bridge between the python-lsp-server and mypy. As far as I can tell your issue is not with pylsp-mypy.

pylsp-mypy does some of its own handling of config files but as far as i know it supports all files/locations specified by mypy. pyproject.toml is also supported. How to configure mypy correctly for django-stubs is outside of the scope of this project (and I don't know).

jhartum commented 1 year ago

is it possible to explicitly specify path to config file for pylsp-mypy?

Richardk2n commented 1 year ago

Config files are searched from the workspace upwards through the directory tree. For the mypy config file, you can request that subdirectories are searched on each step as well through the config_sub_paths option (see Readme). There are also some default locations for the mypy config file (see mypy doc, i think i implemented all of them)