Cannot override `disallow_subclassing_any` for `matplotlib.*` in `pyproject.toml`
Open
Nobody has claimed this yet.
bug
topic-configuration
topic-disallow-any
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
I cannot override disallow_subclassing_any for matplotlib.* in pyproject.toml
To Reproduce
"""False-positive 'Class cannot subclass'."""
from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg
class Class(FigureCanvasQTAgg):
"""Class."""
Expected Behavior
No error
Actual Behavior
bug.py:4: error: Class cannot subclass "FigureCanvasQTAgg" (has type "Any") [misc]
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: mypy 1.3.0 (compiled: yes)
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini(and other config files): see below - Python version used: 3.11.3
pyproject.toml
[tool.mypy]
ignore_missing_imports = false # this works
disallow_subclassing_any = true # this works
[[tool.mypy.overrides]]
module = "matplotlib.*"
ignore_missing_imports = true # this works
disallow_subclassing_any = false # this does not
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 false positive from the Python snippet and the shown pyproject.toml configuration using mypy 1.3.0. Trace how tool.mypy.overrides applies module-specific settings, then verify that disallow_subclassing_any = false for matplotlib.* suppresses the reported error while the global setting remains enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100