Skip to content

Add option to force color output #7771

Closed
@chadrik

Description

@chadrik

mypy ignores color_output=true if there is no tty, but in a CI context color is often supported and desired even though there's no tty. pytest solves this with a tri-state flag: --color=yes/no/auto, where color=auto is equivalent to mypy's color_output=true, and color=yes forces color on.

chad$ pytest --help | grep color
  --color=color         color terminal output (yes/no/auto).

I'm happy to submit a PR for this if you think it makes sense.

There is the issue of backward compatibility. We have a few options

  • introduce a new flag --color=yes/no/auto and deprecate the old boolean one. This would let us maintain backward compatibility for a few versions while people switch over
  • change the type of --color-output/--no-color-output to enum string. This would break backward compatibility, at least for the CLI. We might be able to hack something to work for config files.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions