Skip to content

Commit 5020375

Browse files
committed
Document dmypy run (#5164)
1 parent ac31bce commit 5020375

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

docs/source/mypy_daemon.rst

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,23 @@ Basic usage
3636
***********
3737

3838
The client utility ``dmypy`` is used to control the mypy daemon.
39-
Use ``dmypy start -- <flags>`` to start the daemon. You can use almost
40-
arbitrary mypy flags after ``--``. The daemon will always run on the
41-
current host. Example::
39+
Use ``dmypy run -- <flags> <files>`` to typecheck a set of files
40+
(or directories). This will launch the daemon if it is not running.
41+
You can use almost arbitrary mypy flags after ``--``. The daemon
42+
will always run on the current host. Example::
4243

43-
dmypy start -- --follow-imports=skip
44+
dmypy run -- --follow-imports=error prog.py pkg1/ pkg2/
4445

4546
.. note::
46-
You'll need to use either the ``--follow-imports=skip`` or the
47-
``--follow-imports=error`` option with dmypy because the current
47+
You'll need to use either the ``--follow-imports=error`` or the
48+
``--follow-imports=skip`` option with dmypy because the current
4849
implementation can't follow imports.
4950
See :ref:`follow-imports` for details on how these work.
5051
You can also define these using a
5152
:ref:`configuration file <config-file>`.
5253

53-
The daemon will not type check anything when it's started.
54-
Use ``dmypy check <files>`` to check some files (or directories)::
55-
56-
dmypy check prog.py pkg1/ pkg2/
54+
``dmypy run`` will automatically restart the daemon if the
55+
configuration or mypy version changes.
5756

5857
You need to provide all files or directories you want to type check
5958
(other than stubs) as arguments. This is a result of the
@@ -68,28 +67,39 @@ you have a large codebase.
6867
Additional features
6968
*******************
7069

71-
You have precise control over the lifetime of the daemon process:
70+
While ``dmypy run`` is sufficient for most uses, some workflows
71+
(ones using :ref:`remote caching <remote-cache>`, perhaps),
72+
require more precise control over the lifetime of the daemon process:
7273

7374
* ``dmypy stop`` stops the daemon.
7475

76+
* ``dmypy start -- <flags>`` starts the daemon but does not check any files.
77+
You can use almost arbitrary mypy flags after ``--``.
78+
7579
* ``dmypy restart -- <flags>`` restarts the daemon. The flags are the same
7680
as with ``dmypy start``. This is equivalent to a stop command followed
7781
by a start.
7882

79-
* Use ``dmypy start --timeout SECONDS -- <flags>`` (or
80-
``dmypy restart --timeout SECONDS -- <flags>``) to automatically
83+
* Use ``dmypy run --timeout SECONDS -- <flags>`` (or
84+
``start`` or ``restart``) to automatically
8185
shut down the daemon after inactivity. By default, the daemon runs
8286
until it's explicitly stopped.
8387

88+
* ``dmypy check <files>`` checks a set of files using an already
89+
running daemon.
90+
91+
* ``dmypy status`` checks whether a daemon is running. It prints a
92+
diagnostic and exits with ``0`` if there is a running daemon.
93+
8494
Use ``dmypy --help`` for help on additional commands and command-line
8595
options not discussed here, and ``dmypy <command> --help`` for help on
8696
command-specific options.
8797

8898
Limitations
8999
***********
90100

91-
* You have to use either the ``--follow-imports=skip`` or
92-
the ``--follow-imports=error`` option because of an implementation
101+
* You have to use either the ``--follow-imports=error`` or
102+
the ``--follow-imports=skip`` option because of an implementation
93103
limitation. This can be defined
94104
through the command line or through a
95105
:ref:`configuration file <config-file>`.

0 commit comments

Comments
 (0)