Overlapping modules overloads in `pyproject.toml` result in undefined behavior
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
It's unclear from the docs and runtime what the expected behavior is if you define multiple [[tool.mypy.overrides]] with overlapping modules.
To Reproduce
[[tool.mypy.overrides]]
module = [
"openstack._log",
"openstack.cloud._baremetal",
"openstack.common",
"openstack.common.*",
"openstack.config",
"openstack.config.*",
"openstack.connection",
"openstack.exceptions",
"openstack.fields",
"openstack.format",
"openstack.proxy",
"openstack.utils",
"openstack.version",
"openstack.warnings",
]
warn_return_any = true
disallow_untyped_decorators = true
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
no_implicit_reexport = true
[[tool.mypy.overrides]]
module = [
"openstack.cloud._baremetal",
]
# unset 'warn_return_any' since we need to type the proxy classes first
warn_return_any = false
Expected Behavior
I would expect the configuration to layer, with later (in the file) configuration overriding earlier configuration.
Actual Behavior
In my instance, later configuration related to unit tests was ignored. I have no investigated what's happening here though.
Your Environment
- Mypy version used: mypy 1.16.1
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini(and other config files): per above - Python version used: python 3.13.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the two overlapping [[tool.mypy.overrides]] blocks in pyproject.toml using mypy 1.16.1, then trace how overlapping module patterns are interpreted. Done means the precedence behavior is defined and matches the expected later-configuration override, with coverage for overlapping modules.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100