Skip to content

Support FORCE_COLOR in addition to MYPY_FORCE_COLOR #13806

Closed
@hugovk

Description

@hugovk

Feature

Force colour when the FORCE_COLOR environment variable is set.

Pitch

Mypy automatically adds colour to output for TTYs, or if the env var MYPY_FORCE_COLOR is set.

For example, GitHub Actions is not a tty but it's good to add colour to help read the logs.

FORCE_COLOR is used by many CLI tools and libraries.

It would be good if mypy forced colour output if either FORCE_COLOR or MYPY_FORCE_COLOR is set.

This helps avoid adding lots of separate env vars for each tool/CLI, for example:

env:
  FORCE_COLOR: 1 # Request colored output from CLI tools supporting it
  MYPY_FORCE_COLOR: 1 # MyPy's color enforcement
  PIP_DISABLE_PIP_VERSION_CHECK: 1
  PIP_NO_PYTHON_VERSION_WARNING: 1
  PIP_NO_WARN_SCRIPT_LOCATION: 1
  PY_COLORS: 1 # Recognized by the `py` package, dependency of `pytest`
  TOX_PARALLEL_NO_SPINNER: 1
  TOX_TESTENV_PASSENV: >-
    FORCE_COLOR
    MYPY_FORCE_COLOR
    NO_COLOR
    PY_COLORS
    PYTEST_THEME
    PYTEST_THEME_MODE

For reference:

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions