Repository navigation
Document mypy daemon and the dmypy utility - #4983
Conversation
Also discuss how to use remote caching with the mypy daemon.
|
|
||
| .. note:: | ||
|
|
||
| The mypy daemon currently supports macOS and Linux only. |
There was a problem hiding this comment.
Maybe also add a note explaining that the daemon only processes one request at a time? The mention of "server" may cause people to think this could be a shared service (if that was true it would be even more amazing!).
| Caching with mypy daemon | ||
| ======================== | ||
|
|
||
| You can use the :ref:`mypy daemon <mypy_daemon>` for faster |
There was a problem hiding this comment.
This sounds like a bit of a non-sequitur after all the detailed instructions about tarballs and wrapper scripts. Maybe start with "If you are using the mypy_daemon, it also supports remote caching." or perhaps even "The mypy_daemon supports remote caching too."
| The mypy daemon requires extra fine-grained dependency data in | ||
| the cache files which aren't included by default. To use caching with | ||
| the mypy daemon, use the ``--cache-fine-grained`` option in your CI | ||
| build:: |
There was a problem hiding this comment.
Explain what this flag does (it writes extra information for the daemon to the cache).
There was a problem hiding this comment.
Added an explanation.
|
|
||
| $ mypy --cache-fine-grained <args...> | ||
|
|
||
| You will also need to use the ``--use-fine-grained-cache`` option |
There was a problem hiding this comment.
"In order to use the extra information written in the previous step, ..."
|
|
||
| Instead of running mypy as a command-line tool, you can also run it as | ||
| a long-running daemon (server) process and use a command-line client to | ||
| control the server. This way mypy can perform type checking much faster, |
There was a problem hiding this comment.
control -> send type-checking requests to
| ``--follow-imports=error`` option with dmypy. | ||
| See :ref:`follow-imports` for details on how these work. | ||
|
|
||
| The daemon will not type check anything after the start command. |
There was a problem hiding this comment.
after the start command -> when it is started
| dmypy check prog.py pkg1/ pkg2/ | ||
|
|
||
| You need to provide all files or directories you want to type check | ||
| (other than stubs) as arguments. |
There was a problem hiding this comment.
Again this seems an odd limitation -- perhaps hint at the reason?
|
|
||
| The initial run will process all the code and may take a while to | ||
| finish, but subsequent runs will be quick, especially if you've only | ||
| changed a few files. |
There was a problem hiding this comment.
Cross-link to the remote caching discussion, as that can make the initial run faster.
|
|
||
| * Use ``dmypy start --timeout SECONDS -- <flags>`` (or | ||
| ``dmypy restart --timeout SECONDS -- <flags>``) to automatically | ||
| shut down the daemon after inactivity. |
There was a problem hiding this comment.
By default it lives until explicitly stopped.
|
|
||
| * ``dymypy stop`` stops the daemon. | ||
|
|
||
| * ``dmypy restart -- <flags>`` restarts the daemon. The flags are the same |
There was a problem hiding this comment.
Since you're not listing all subcommands, maybe omit restart? There's nothing it can do that start + stop can't do.
There was a problem hiding this comment.
I decided to keep this since the restart command was a little confusing when I first used since it doesn't remember the flags.
|
I've addressed all comments. |
| it's better to instead reuse the existing local cache data. | ||
|
|
||
| * If you use the mypy daemon, you may want to restart the daemon each time | ||
| after the merge base has changed to avoid processing a potentially large |
gvanrossum
left a comment
There was a problem hiding this comment.
I took the liberty to reflow two paragraphs -- while I normally appreciate not reflowing paragraphs to minimize diffs, since this will be squashed anyways I prefer the reflowed versions. I'll merge once the tests pass (unless you merge first :-).
|
I also took the liberty of fixing an ancient reference to the "Optional types and the None type" section from revision_history.rst. This gave a warning in "make html" and would produce a bad link -- I presume at some point the label was renamed from "optional" to "strict_optional" and the reference wasn't updated. See commit 8248a68. I cherry-picked this too. |
Also discuss how to use remote caching with the mypy daemon.