python / python/mypy

Cannot set `output` in `mypy.ini`

Open Beginner friendly
#21,376 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-configuration topic-error-reporting
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mypy.config_parser.parse_section() and inspect how it handles the None default of Options.output. Reproduce the issue using the shown mypy.ini configuration, then verify that configuring output produces JSON as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.