Would be great if we could output MyPy info in JSO...
# general
h
Would be great if we could output MyPy info in JSON format for reporting in CI: https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-O Or, more generally, have pants redirect tool output to some reporting folder.
b
I think there may be a way to pass custom flags to mypy. I’m on mobile right now so cannot confirm but it’s likely an “args” option or similar within the mypy subsystem reference docs. If you point that to a file within reports/, there’s a chance it may work…? I can help look more tomorrow
h
Thanks, Huon. So yes I can pass mypy flags. But for some reason, mypy puts the json output on stdout, not in a file.
So we need to somehow capture that output.
b
Does a shell redirect like
pants check :: > output.json
work for you?
h
My main issue would be that it would mangle the pants and mypy output, making it hard to json-parse reliably.
b
I think most pants output should end up on stderr, and so only redirecting stdout (as that does) should be fine… I may be wrong, though.
h
Okay I will have to try that out when I have time.