Skip to content

Document mypy daemon and the dmypy utility - #4983

Merged
gvanrossum merged 5 commits into
masterfrom
doc-dmypy
Apr 30, 2018
Merged

gvanrossum merged 5 commits into
masterfrom
doc-dmypy

Conversation

@JukkaL

@JukkaL JukkaL commented Apr 27, 2018

Copy link
Copy Markdown
Collaborator

Also discuss how to use remote caching with the mypy daemon.

Also discuss how to use remote caching with the mypy daemon.
@JukkaL
JukkaL requested review from gvanrossum and msullivan April 27, 2018 12:16
@JukkaL JukkaL mentioned this pull request Apr 27, 2018

.. note::

The mypy daemon currently supports macOS and Linux only.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added note.

Comment thread docs/source/additional_features.rst Outdated
Caching with mypy daemon
========================

You can use the :ref:`mypy daemon <mypy_daemon>` for faster

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain what this flag does (it writes extra information for the daemon to the cache).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an explanation.

Comment thread docs/source/additional_features.rst Outdated

$ mypy --cache-fine-grained <args...>

You will also need to use the ``--use-fine-grained-cache`` option

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"In order to use the extra information written in the previous step, ..."

Comment thread docs/source/mypy_daemon.rst Outdated

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,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

control -> send type-checking requests to

Comment thread docs/source/mypy_daemon.rst Outdated
``--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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after the start command -> when it is started

Comment thread docs/source/mypy_daemon.rst Outdated
dmypy check prog.py pkg1/ pkg2/

You need to provide all files or directories you want to type check
(other than stubs) as arguments.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again this seems an odd limitation -- perhaps hint at the reason?

Comment thread docs/source/mypy_daemon.rst Outdated

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cross-link to the remote caching discussion, as that can make the initial run faster.

Comment thread docs/source/mypy_daemon.rst Outdated

* Use ``dmypy start --timeout SECONDS -- <flags>`` (or
``dmypy restart --timeout SECONDS -- <flags>``) to automatically
shut down the daemon after inactivity.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default it lives until explicitly stopped.


* ``dymypy stop`` stops the daemon.

* ``dmypy restart -- <flags>`` restarts the daemon. The flags are the same

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're not listing all subcommands, maybe omit restart? There's nothing it can do that start + stop can't do.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to keep this since the restart command was a little confusing when I first used since it doesn't remember the flags.

@JukkaL

JukkaL commented Apr 30, 2018

Copy link
Copy Markdown
Collaborator Author

I've addressed all comments.

Comment thread docs/source/additional_features.rst Outdated
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also branch?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :-).

@gvanrossum
gvanrossum merged commit e636eeb into master Apr 30, 2018
@gvanrossum
gvanrossum deleted the doc-dmypy branch April 30, 2018 19:29
@gvanrossum

gvanrossum commented Apr 30, 2018 •

Copy link
Copy Markdown
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants