msherry / flycheck-pycheckers

Multiple syntax checker for Python in Emacs, using Flycheck
GNU General Public License v3.0
63 stars 23 forks source link

Added support for MyPy daemon mode. #41

Closed efroemling closed 4 years ago

efroemling commented 4 years ago

We had briefly chatted about adding this feature a number of months back, and I finally had a bit time to take a whirl at it.

I added two arguments to pycheckers.py:

--mypy-use-daemon Enables daemon mode. It is disabled by default, in which case behavior remains unchanged from before.

--mypy-daemon-files-command A shell command to execute to provide the MyPy daemon with a list of files/dirs relative to the project root. Defaults to simply "echo ." The MyPy daemon isn't able to follow imports, so the whole working set of files has to be passed to it; not simply the one being inspected. Holler if you think there'd be a more preferable way to handle this.

One slight downside with daemon mode is that, since the process is persistent and shared, it doesn't see the temp flycheck_xxx files so only checks against what is saved to disk. (personally I've got flycheck set to run only on save so this isn't a problem, but could be annoying for others).

Anyway, hopefully this is useful.

msherry commented 4 years ago

This is really interesting, thank you!

I apologize for taking so long to look over it. On the face of it, it looks ok -- I don't see anything egregiously wrong or any suggestions I would make. I haven't yet had a chance to test it personally, though, so I'm hesitant to merge it so far. I'll patch it locally and run it soon, then should be able to either merge or give more constructive feedback -- I just didn't want you to think that this had fallen by the wayside.

msherry commented 4 years ago

Thanks for iterating on this! I'm willing to merge it and try it out to see what problems it causes, as long as it remains off by default for the time being.