khalidmammadov edited a comment on issue #19891:
URL: https://github.com/apache/airflow/issues/19891#issuecomment-1000340991


   > We fixed similar problems by introducing .pyi definition for operator 
which has the field marked as optional/having default:
   > 
   > Example: 
https://github.com/apache/airflow/pull/20422/files#diff-b203bbb3091d2f66173522a470009ba78c142564717c2168ad39d39ff7ed9a11R1
   > 
   > Not ideal. But it will do for now. We will likely have to implement a 
custom mypy plugin to allow passing non-optional parameters by DAG's 
default_args and we can do that later.
   
   @potiuk @josh-fell I am not sure if this method fully fixes the issue. I 
have applied similar changed inside airflow/providers/microsoft and when I run 
mypy for a folder then all good but when I run it for one file only it looks 
like it does not acknowledge existence of companion .pyi file in the same dir. 
   i.e. this is OK
   `mypy --namespace-packages airflow/providers/microsoft/azure/example_dags`
   but not this:
   `mypy --namespace-packages 
airflow/providers/microsoft/azure/example_dags/example_azure_blob_to_gcs.py`
   
   I checked `pre-commit` run approach as well it also runs on listed files and 
fails to detect .pyi when I replicate the command:
   `pre-commit run mypy --all-files --show-diff-on-failure --color always`
   
   Reference PR: https://github.com/apache/airflow/pull/20409  -- PS. I had to 
disable pre-commit to be able to push it (for discussion)...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to