Skip to content

Support more output formats #10816

Description

@Timmmm

Feature

Mypy should support JSON output to stdout. Pyright has this already via --outputjson so it might be a decent idea to copy their schema as much as possible.

Pitch

Programmatic access to the errors is needed for:

  • CI integration
  • IDE integration

Parsing the current output is a bad idea because:

  • It's error prone and difficult to get right - especially for things like multi-line errors, filenames containing spaces or colons and so on.
  • It's easy to accidentally break it. The current output does not like it is intended to be machine readable and is therefore likely to be accidentally changed in subtle ways, breaking parsers.
  • It's way more effort to actually implement a Mypy error parser than a JSON parser.
  • It can only include a small amount of information. For example column numbers and error codes are not shown.

For example consider the hacky regex used here for Mypy vs the simple JSON parsing used here for Pyright.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions