MyPy defaults to ANY if the import path is bad
- Dominant language
- Python
- Stars
- 46.9k
- Forks
- 17.8k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 483
Description
### Body
If you have an import in an if TYPE_CHECKING, mypy may decide to treat it as type(ANY) if it has a problem.
**To reproduce:**
If you look in [pyproject.toml](https://github.com/apache/airflow/blob/main/pyproject.toml) you can see (currently on L930, but that may change)
```
[tool.mypy]
ignore_missing_imports = true
```
If you swap that to `false` and run mypy you'll find over a thousand new errors that should be fixed.
**Task:**
These can be broken into small bites and fixed in batches, but they should be done and then flip that option to false in pyproject.toml to prevent regression.
For some more context and discussion, see the slack thread [here](https://apache-airflow.slack.com/archives/C015SLQF059/p1743790446753629).
### Committer
- [x] I acknowledge that I am a maintainer/committer of the Apache Airflow project.
Contributor guide
Research direction
Start in pyproject.toml at the [tool.mypy] configuration around the mentioned ignore_missing_imports setting, then run mypy with that option set to false to inspect the reported errors. Work through a bounded batch of those import-related errors; done means the batch is resolved and the configuration can eventually be changed to prevent regressions.
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
- 35/100