Skip to content

Cannot set output in mypy.ini #21376

@AA-Turner

Description

@AA-Turner

Bug Report

The following config is not respected:

[mypy]
output = json

I believe this is as mypy.config_parser.parse_section() does dv = getattr(template, key, None); if dv is None: ..., but the default of Options.output is intentionally None. I don't know if excluding None default values is intentional here or not, so I haven't yet put up a PR until someone can confirm.

To Reproduce
Use the above config, observe output is not JSON.

Expected Behavior

To be able to configure the output format via JSON.

Actual Behavior

No JSON.

Your Environment

  • Mypy version used: 1.20.2
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): As above
  • Python version used: 3.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions