Skip to content

Fix output config option in mypy.ini#21465

Open
mitre88 wants to merge 1 commit into
python:masterfrom
mitre88:fix/output-config-ini-with-test
Open

Fix output config option in mypy.ini#21465
mitre88 wants to merge 1 commit into
python:masterfrom
mitre88:fix/output-config-ini-with-test

Conversation

@mitre88
Copy link
Copy Markdown

@mitre88 mitre88 commented May 11, 2026

Fixes #21376

This makes output = json in mypy.ini take effect by registering output as a string-valued config option. Options.output defaults to None, so without an explicit config parser type entry it was treated as unrecognized and ignored.

This is intentionally the narrow version of the fix: it does not change the general handling of all None-default options.

I also added a config parser unit test that parses a temporary mypy.ini with output = json and verifies Options.output is set without stderr output.

Validation:

  • .venv/bin/python -m pytest mypy/test/test_config_parser.py
  • .venv/bin/python -m black --check mypy/config_parser.py mypy/test/test_config_parser.py
  • .venv/bin/python -m ruff check mypy/config_parser.py mypy/test/test_config_parser.py
  • git diff --check

Note: this replaces #21416, which I could not reopen after cleaning up the branch history.

@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot set output in mypy.ini

1 participant