tomv564 / pyls-mypy

Mypy plugin for the Python Language Server
MIT License
110 stars 62 forks source link

Configuration to point out a .mypy.ini #48

Open Hi-Angel opened 3 years ago

Hi-Angel commented 3 years ago

Excuse me if it already exists, by from my searching and reading the README I come to conclusion it isn't.

The usecase I'm trying to solve is that I have a file hierarchy as follows:

my_module.py
.mypy.ini
subdir/sub_module.py

When I open sub_module.py which imports my_module.py, I get many Cannot find implementation or library stub for module named 'my_module' for all modules that are in the parent dir. As I understand, the problem comes down to pyls-mypy needing some config with the list of files, which is probably .mypy.ini. So probably some option is needed, so users could point out pyls-mypy to that configuration file.

haplo commented 3 years ago

I'm facing the same issue, I think pyls-mypy should:

  1. Allow mypy config file to be specified in pyls config.
  2. If config is not provided try to autodetect a mypy config file relative to the file being parsed.
  3. In other cases continue as today.

I'm going to work on this, I will probably implement 2 before 1, as the valid mypy config files are well specified in their documentation: mypy.ini, .mypy.ini, setup.cfg.

Hi-Angel commented 3 years ago

I'm facing the same issue, I think pyls-mypy should:

  1. Allow mypy config file to be specified in pyls config.
  2. If config is not provided try to autodetect a mypy config file relative to the file being parsed.
  3. In other cases continue as today.

I'm going to work on this, I will probably implement 2 before 1, as the valid mypy config files are well specified in their documentation: mypy.ini, .mypy.ini, setup.cfg.

Hi! Turned out, loading a .mypy.ini was implemented in 2019 in this PR. Unfortunately, the repo is apparently unmaintained, there's no one around to merge a PR.

haplo commented 3 years ago

Hi! Turned out, loading a .mypy.ini was implemented in 2019 in this PR. Unfortunately, the repo is apparently unmaintained, there's no one around to merge a PR.

Thanks for letting me know! I was just getting started with this. I will take that PR as a starting point and test it locally.

@tomv564 would you have enough time for PR merges and PyPI releases? If not would you consider transferring ownership of the package in PyPI so we can issue new releases?

asford commented 3 years ago

@haplo @Hi-Angel This repo has been forked and is maintained with this feature at https://github.com/Richardk2n/mypy-ls