Repository navigation
Cleanup MyPy Ignores #53241
Copy link
Copy link
Closed
Labels
area:dev-envCI, pre-commit, pylint and other changes that do not change the behavior of the final codeCI, pre-commit, pylint and other changes that do not change the behavior of the final codekind:metaHigh-level information important to the communityHigh-level information important to the community
Description
Body
We have migrated mypy to 1.16.1, now we can cleanup type ignores where possible.
- airflow core @gopidesupavan Cleanup mypy ignore in airflow-core where possible #53289
- airflow-ctl @gopidesupavan Cleanup mypy ignore in airflow-ctl where possible and replace misc with prop-decorator #53310
- airbyte
- alibaba @mingdaoy Cleanup type ignores in alibaba provider #53299
- amazon @gopidesupavan - Cleanup type ignores in amazon provider where possible #53239
- beam @mingdaoy Cleanup type ignores in apache/beam provider #53303
- cassandra
- drill @mingdaoy Cleanup type ignores in apache/drill provider #53304 Clean up mypy ignores in drill provider #53320
- druid
- flink
- hdfs
- hive @mingdaoy Cleanup type ignores in apache/hive provider #53302
- iceberg
- impala
- kafka @mingdaoy Cleanup type ignores in apache/kafka provider #53300
- kylin @gopidesupavan Cleanup mypy ignore in apache/kylin provider where possible #53317
- livy
- pig
- pinot @kyungjunleeme Cleanup type ignores in apache/pinot provider #53311
- spark @mingdaoy Cleanup type ignores in apache/spark provider #53301
- tinkerpop @kyungjunleeme Cleanup type ignores in apache/tinkerpop provider #53305
- apprise
- arangodb
- asana
- atlassian @gopidesupavan Cleanup mypy ignores atlasian jira provider where possible #53263
- celery @gopidesupavan Cleanup mypy ignores in celery provider #53261
- cloudant
- cncf @gopidesupavan Cleanup mypy ignores cncf provider where possible #53264
- cohere
- common.sql @mingdaoy Cleanup type ignores in common/sql provider #53297
- common.io @mingdaoy Cleanup type ignores in common/io provider #53298
- common.messaging @mingdaoy (checked no changes needed)
- common/io @mingdaoy Cleanup type ignores in common/io provider #53298
- databricks @gopidesupavan Cleanup mypy ignores in databricks provider where possible #53265
- datadog @gopidesupavan Cleanup mypy ignore in datadog provider where possible #53268
- dbt @gopidesupavan Cleanup mypy ignore in dbt provider where possible #53270
- dingding @gopidesupavan Cleanup mypy ignores in dingding provider #53259
- discord
- docker @Cleanup mypy ignore in docker provider where possible #53273
- edge3 @jscheffl Cleanup type ignores in edge3 provider where possible #53248
- elasticsearch @gopidesupavan Cleanup mypy ignore in elasticsearch provider where possible #53277
- exasol @gopidesupavan Cleanup mypy ignore in exasol provider where possible #53278
- fab @gopidesupavan Cleanup mypy ignore in fab provider where possible #53282
- ftp @mingdaoy Cleanup type ignores in ftp provider #53296
- git
- github @mingdaoy Cleanup type ignores in github provider where possible #53291
- google @gopidesupavan - Clean up mypy ignores in google provider #53249
- grpc @mingdaoy Cleanup type ignores in grpc provider #53293
- hashicorp
- http @mingdaoy Cleanup type ignores in http provider #53294
- imap
- influxdb @mingdaoy Cleanup type ignores in influxdb provider #53295
- jdbc
- jenkins @mingdaoy Cleanup type ignores in jenkins provider where possible #53292
- keycloak
- microsoft @jscheffl - Cleanup type ignores in 4 microsoft providers where possible #53312
- mongo
- mysql @jscheffl - Cleanup type ignores in mysql provider where possible #53288
- neo4j @jscheffl - Cleanup type ignores in neo4j provider where possible #53287
- odbc
- openai @jscheffl - Cleanup type ignores in openai provider where possible #53285
- openfaas
- openlineage @jscheffl - Cleanup type ignores in openlineage provider where possible #53284
- opensearch @jscheffl - Cleanup type ignores in opensearch provider where possible #53283
- opsgenie @jscheffl - Cleanup type ignores in opsgenie provider where possible #53281
- oracle @jscheffl - Cleanup type ignores in oracle provider where possible #53280
- pagerduty
- papermill @jscheffl - Cleanup type ignores in papermill provider where possible #53279
- pgvector
- pinecone @jscheffl - Cleanup type ignores in pinecone provider where possible #53276
- postgres @jscheffl - Cleanup type ignores in postgres provider where possible #53275
- presto @jscheffl - Cleanup type ignores in presto provider where possible #53274
- qdrant
- redis @jscheffl - Cleanup type ignores in redis provider where possible #53272
- salesforce @jscheffl - Cleanup type ignores in salesforce provider where possible #53271
- samba @jscheffl - Cleanup type ignores in samba provider where possible #53269
- segment @jscheffl - Cleanup type ignores in segment provider where possible #53267
- sendgrid
- sftp @jscheffl - Cleanup type ignores in sftp provider where possible #53266
- singularity @jscheffl - Cleanup type ignores in singularity provider where possible #53262
- slack - all included in Remove type ignore across codebase after mypy upgrade #53243
- smtp @jscheffl - Cleanup type ignores in smtp provider where possible #53260
- snowflake @jscheffl - Cleanup type ignores in snowflake provider where possible #53258
- sqlite - all included in Remove type ignore across codebase after mypy upgrade #53243
- ssh @jscheffl - Cleanup type ignores in ssh provider where possible #53257
- standard @gopidesupavan Cleanup mypy ignore in standard provider where possible #53308
- tableau @jscheffl - Cleanup type ignores in tableau provider where possible #53256
- telegram @jscheffl - Cleanup type ignores in telegram provider where possible #53255
- teradata @jscheffl - Cleanup type ignores in teradata provider where possible #53254
- trino @jscheffl - Cleanup type ignores in trino provider where possible #53253
- vertica @jscheffl - Cleanup type ignores in vertica provider where possible #53252
- weaviate - all included in Remove type ignore across codebase after mypy upgrade #53243
- yandex @jscheffl - Cleanup type ignores in yandex provider where possible #53251
- ydb @jscheffl - Cleanup type ignores in ydb provider where possible #53250
- zendesk - all included in Remove type ignore across codebase after mypy upgrade #53243
- dev breeze @gopidesupavan Cleanup mypy ignore in dev where possible #53313
- devel-common @gopidesupavan Cleanup mypy ignore in devel-common where possible #53314
Follow the below steps
- Build lates ci image with
breeze build ci-imgae --python 3.10 - export SHOW_UNUSED_MYPY_WARNINGS=true
- Run the ./scripts/ci/pre_commit/mypy_folder.py {Provider Name}
This will show what are all possible type ignores we can remove.
An example output looks like this.
Remove all the unused type ignores and run it again see if anything breaks
Raise a PR with title Cleanup type ignores in <provider> provider where possible
ref PR: #53239
Committer
- I acknowledge that I am a maintainer/committer of the Apache Airflow project.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:dev-envCI, pre-commit, pylint and other changes that do not change the behavior of the final codeCI, pre-commit, pylint and other changes that do not change the behavior of the final codekind:metaHigh-level information important to the communityHigh-level information important to the community
Activity
[-][NOT READY] Cleanup MyPy Ignores[/-][+]Cleanup MyPy Ignores[/+]potiuk commentedon Jul 12, 2025
👍
kyungjunleeme commentedon Jul 13, 2025
Some parts of the code still produce mypy errors even after my changes. Is it okay to leave them as is, or should I fix those as well?
kyungjunleeme commentedon Jul 13, 2025
@mingdaoy I noticed there’s some overlap between our work. I’ll cherry-pick your changes and clean up the duplicated parts on my side. Thanks for working on it first!
mingdaoy commentedon Jul 13, 2025
@kyungjunleeme I had apache folder PR already. What are you trying to work on?
kyungjunleeme commentedon Jul 13, 2025
@mingdaoy
There are many providers under the apache folder, so I’ll focus on ones you didn’t include in your PR — specifically pinot and tinkerpop, if that works for you.
mingdaoy commentedon Jul 13, 2025
@kyungjunleeme Sure. Go ahead. Did you follow the steps described in this issue? I checked and it seems that nothing needs to be removed in pinot
gopidesupavan commentedon Jul 13, 2025
no, if you see any errors apart from the
type unusedplease put it back those ignores :)gopidesupavan commentedon Jul 13, 2025
I have updated with apache providers list please pickup individual providers
kyungjunleeme commentedon Jul 13, 2025
@gopidesupavan Yes, fortunately, I worked on it that way.
@mingdaoy
Thanks to you, I was able to finish my work as well.
Would you mind taking a look at my PR?
kyungjunleeme commentedon Jul 13, 2025
@mingdaoy um. yes. I will re-check right away. just a moment
mingdaoy commentedon Jul 13, 2025
@kyungjunleeme I checked the rest of the Apache folder as well and it seems "no issues found". You can check again. I might be wrong. cc. @gopidesupavan
mingdaoy commentedon Jul 13, 2025
@gopidesupavan I checked the rest of all the unassigned and unchecked providers. I got "Success: no issues found in X source files"
I checked three other providers in common as well.
7 remaining items
gopidesupavan commentedon Jul 13, 2025
oh these are coming only when we run full providers , if we are running individual providers these are getting suppressed.
kyungjunleeme commentedon Jul 13, 2025
um...
I think that this result caused by
1) scripts/ci/pre_commit/mypy_folder.pyand 2) mypy internal judgement logic issue.
Um. Its only my guess. If I find exactly cause. Share it.
kyungjunleeme commentedon Jul 14, 2025
@gopidesupavan Colud I have a question about clenaup check process?
This will show what are all possible type ignores we can remove.
I think that, between 2 and 3,
3. breeze shell python=3.10 --mount-sources allthis command shoud be added? am I right?actually, Im not familiar with breeze development. plz understand quality of my question
gopidesupavan commentedon Jul 14, 2025
hey @kyungjunleeme no those commands should execute outside of breeze, the mypy runs inside breeze, when you run
scripts/ci/pre_commit/mypy_folder.pythis spins up breeze and executes all the mypy checks, so basically you no need to go inside breeze shell.if your interested running mypy inside breeze shell manually . you can do like this.
eg:
kyungjunleeme commentedon Jul 14, 2025
Thank you — I wasn’t aware of that. I’ll take this opportunity to dig a bit deeper into how mypy is used in Airflow.
As for #53330, it might not actually be a bug after all…
gopidesupavan commentedon Jul 14, 2025
cool, i did some investigation,
I think mypy getting confused with module namespace, eg: google provider, in airflow we have google.cloud, but gcs cloudstorage library also has
from google.cloud import storage, so mypy might treating this is not available in airflow repo google.cloud , will workout something later.kyungjunleeme commentedon Jul 14, 2025
FYI
I got help from ai. but. I have checked all link and about contents.
it can be helpful to have a intresting about type hinting.
🧩 Namespace Resolution Issues Across Type Checkers
providers/google/cloud/...overlaps withgoogle-cloud-*libraries in site-packages.google.cloud.loggingdue to namespace conflicts; only the first path is used.providers/google/cloudmay shadow installedgoogle-cloud-*modules.google.cloud.firestoredue to resolution issues or missing stubs.google.cloudmodules.mypyfails to detect type mismatches due to misinterpreted namespace packages.gopidesupavan commentedon Jul 14, 2025
yes exactly it conflicts the namespaces :) , have modified the imports to use full path #53338. will see probably we can go with alias technique thats the simplest one.
mingdaoy commentedon Jul 14, 2025
#53241 (comment)
@kyungjunleeme When I ran
./scripts/ci/pre_commit/mypy_folder.py providers/apache/pinotandtinkerpop, it showed "0 issues found". However, your PR #53311 actually removed some type ignores.Maybe step 3 does not show all possible type ignores we can remove.
kyungjunleeme commentedon Jul 15, 2025
@mingdaoy I guess that ur breeze development enviornment is something wrong
mingdaoy commentedon Jul 15, 2025
@gopidesupavan @jscheffl
Do we need to run <step 1>
breeze ci-image build --python 3.10every time before running mypy checks on each provider./scripts/ci/pre_commit/mypy_folder.py providers/{NAME}? Building the image can take a while.gopidesupavan commentedon Jul 15, 2025
not required image build is only onetime activity , if any deps changed you may need to build.
gopidesupavan commentedon Jul 15, 2025
might be it related to cache, mypy cache what it runs, if you dont want to use cache when running mypy command i think you can add this
--no-incrementalgopidesupavan commentedon Jul 15, 2025
Thank you everyone this is completed now :), appreciate your time and effort.