python / python/mypy

Dmypy ignoring aditional section names on config file

Open
#10,612 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug Report

Running dmypy as

python -m mypy.dmypy --status-file '...' run  -- src/ --show-column-numbers --no-error-summary --no-pretty --no-color-output --config-file mypy.ini --python-executable

with a mypy.ini with the following config:

[mypy]
files = sales_register/
python_version = 3.9
ignore_missing_imports = True
follow_imports = skip
plugins = pydantic.mypy
local_partial_types = False


[mypy-adapters.repositories.postgres.migrations.*]
ignore_errors = True

are not ignoring errors in src/adapters/repositories/postgres/migrations/ files. Running just mypy --config-file=mypy.ini works fine.

To Reproduce

  1. Create a src folder, and a src/a folder inside
  2. Create a test.py file inside src/a with the following code:
def a(x: str) -> str:
    return x

b: int = a('1') # Obviously mypy should raise something here
  1. Create a mypy.ini file with ignore_errors=True in [mypy-a.*] to skip error in the src/a/test.py file
  2. Runs python -m mypy.dmypy --status-file '...' run -- src/ --show-column-numbers --no-error-summary --no-pretty --no-color-output --config-file mypy.ini --python-executable

Expected Behavior

Shouldnt raise any error

Actual Behavior

Raising TypeError

Your Environment

  • Mypy version used: 0.812
  • Python version used: 3.9
  • Operating system and version: macOS 11.3.1

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 by reproducing the issue with python -m mypy.dmypy, the shown mypy.ini, and the src/a/test.py example, then compare it with mypy --config-file=mypy.ini. Trace how the dmypy entry point handles additional config sections; done means the [mypy-a.*] setting suppresses the reported error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.