python / mypy

Optional static typing for Python
https://www.mypy-lang.org/
Other
18.13k stars 2.76k forks source link

Daemon UX improvements #4348

Open gvanrossum opened 6 years ago

gvanrossum commented 6 years ago
ethanhs commented 5 years ago

For not requiring -- perhaps we could conditionally include the daemon argparse flags in process_options then call process_options on the client side? (Happy to work on a PoC if you want).

gvanrossum commented 5 years ago

I assume there's an option to argparse to make it stop parsing at a specific point? I'm too lazy to look it up.

ethanhs commented 5 years ago

Ah, I think argparse.REMAINDER is exactly what we need.

JukkaL commented 5 years ago

I wonder if there's a reasonable way to additionally make the run argument optional. This would make simple dmypy command lines equivalent to mypy command lines, expect for replacing mypy with dmypy (once the above ideas and following imports have been implemented).

One way to do this would be to insert an implicit run argument if there is no recognized command. These three command lines would then work in similar ways:

$ mypy main.py
$ dmypy main.py
$ dmypy run main.py
gvanrossum commented 5 years ago

Alternatively, could we make it so that mypy --daemon <args> invokes the daemon?

(I worry a bit about the default run command in that it means you have to resort to tricks if the file you intend to type-check corresponds to any of the dmypy subcommands.)