wyuenho / emacs-pet

Tracks down the correct Python tooling executables from your virtualenvs so you can glue the binaries to Emacs and delete code in init.el
GNU General Public License v3.0
105 stars 13 forks source link

Support flymake? #28

Closed publicimageltd closed 9 months ago

publicimageltd commented 9 months ago

Description

I use eglot in a virtual environment. Everything works fine except that mypy does not load the stubs for typechecking imported modules. I'm using flymake, and it reports an error that mypy cannot find the stubs. Except that the stubs are installed in the venv.

If I switch to flycheck, the mypy error goes away. Thus I believe that flymake somehow does not fully recognize the environemt set by PET.

If I can test this, I'd welcome some pointers how to investigate this issue. It might, of course, also be due to eglot, but I have no idea how to test it (and I do not want to install lsp-mode).

** Setup

wyuenho commented 9 months ago

Which LSP server are you using?

publicimageltd commented 9 months ago

Spyder pyhon lsp and ruff as a linter

wyuenho commented 9 months ago

Please tell me about your directory structure and how you normally run mypy, and what configuration you have so mypy can pick up your stubs.

publicimageltd commented 9 months ago

I have a .venv file in the python project folder. Mypy is installed globally (I'm on arch, it is installed as a pacman package). I don't run mypy manually, but delegate that to Emacs.

I just called mypy manually, same reply (no stub installed etc.). To check, I Just installed it in the activated venv (pip install mypy + pip install of the stub library), but no change.

But as to how mypy communicates with Emacs: no idea. I thought it is done by eglot.

Actually it seems to be a problem with mypy and not with PET, but I would be glad about any help how to further investigate the issue.

wyuenho commented 9 months ago

In this case I would suggest you play around with mypy's configuration before jumping to the conclusion of this being a bug of PET. If it doesn't run in your terminal, it's not going to run in Emacs.

publicimageltd commented 9 months ago

Yes, sorry for the noise. Will check on that. Thanks for the fast reply!