Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semi-verbose flag that shows which files mypy analyzes #7672

Open
gvanrossum opened this issue Oct 9, 2019 · 5 comments
Open

Semi-verbose flag that shows which files mypy analyzes #7672

gvanrossum opened this issue Oct 9, 2019 · 5 comments
Labels

Comments

@gvanrossum
Copy link
Member

Sometimes (example: #6385) it's useful to be able to see exactly which files mypy is processing. Currently the only way is to use -v and grep stderr for the word "Parsing".

Maybe this is common enough that we could spare a new command-line flag? It would print all the files for which a BuildSource object is created, and all the files that are reached by following imports (with some indicator of which is which).

The order in which files are printed should reflect the order in which they are processed (not the order in which they are specified).

I wouldn't mind adding extra info for each file (e.g. whether its cache entry is used), as long as it remains a single line per file.

Presumably there's also value in printing certain failures, e.g. modules which can't be found but for which no error message is printed (e.g. through --follow-imports=silent). But I would stop here.

@JukkaL JukkaL added needs discussion topic-developer Issues relevant to mypy developers topic-usability labels Oct 10, 2019
@JukkaL
Copy link
Collaborator

JukkaL commented Oct 10, 2019

I can see how this could be useful. One option would be to switch -v to this mode, and move the existing verbose flag to -vv or something.

@forrestchang
Copy link

Maybe add a progress bar?

# test.py

from hello_world import hello_world

hello_world(10)
$ mypy --progress test.py
Checking test.py ...................................................... 100%
test.py:5: error: Argument 1 to "hello_world" has incompatible type "int"; expected "str"

Checking hello_world.py .......................................... 100%  SUCCESS!

Found 1 error in 1 file (checked 1 source file)

@gvanrossum
Copy link
Member Author

I’m okay with overloading -v for this.

A progress bar would be a separate issue, please file one.

hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Oct 31, 2020
With the changes I've been making to mypy's import handling, I think
this would be a useful thing to add preemptively.

Note that I would have found this very useful at points, and I think
others would too, eg python#7672 and python#8584

The existing logging ignores source_modules and source_text and won't
help with determining what mypy things the module name for a given file
is, which is useful for namespace package issues as in the complaint in python#8584.
@hauntsaninja
Copy link
Collaborator

#9672 does the first part of this

hauntsaninja added a commit that referenced this issue Oct 31, 2020
With the changes I've been making to mypy's import handling, I think
this would be a useful thing to add preemptively.

Note that I would have found this very useful at points, and I think
others would too, eg #7672 and #8584

The existing logging ignores source_modules and source_text and won't
help with determining what mypy things the module name for a given file
is, which is useful for namespace package issues as in the complaint in #8584.

Co-authored-by: hauntsaninja <>
@JakeSummers
Copy link

In the short term, you can use:

mypy  <your-args>.              2> >(grep "Found source") | sed "s_.*path='\(.*\)py'.*_\1py_"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants