Skip to content

Re export AirflowPlugin to fix mypy errors in plugins#65132

Merged
amoghrajesh merged 1 commit intoapache:mainfrom
astronomer:mypy-pm
Apr 13, 2026
Merged

Re export AirflowPlugin to fix mypy errors in plugins#65132
amoghrajesh merged 1 commit intoapache:mainfrom
astronomer:mypy-pm

Conversation

@amoghrajesh
Copy link
Copy Markdown
Contributor


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Custom plugins written with AirflowPlugin face mypy errors:

mypackage/src/mypackage/plugins/mymodule.py:27: error: Module "airflow.plugins_manager" does not explicitly export attribute "AirflowPlugin"  [attr-defined]

The best way to do this is to re export them from the packages that are public API for it.


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@potiuk
Copy link
Copy Markdown
Member

potiuk commented Apr 13, 2026

Interesting - is that enough ? That does not sound like this should have such effect ? Is it A Typing/MyPy specific thing that you have to do 'X as X' to be visible in MyPy as explicitly exposed ?

@potiuk
Copy link
Copy Markdown
Member

potiuk commented Apr 13, 2026

Ah TIL

@potiuk
Copy link
Copy Markdown
Member

potiuk commented Apr 13, 2026

import - In Python, what's the purpose of giving an alias with the same name as the imported lib? - Stack Overflow https://share.google/7zvymClHaTqQuUHiA

@potiuk
Copy link
Copy Markdown
Member

potiuk commented Apr 13, 2026

I personally prefer all but this works too :)

@amoghrajesh
Copy link
Copy Markdown
Contributor Author

import - In Python, what's the purpose of giving an alias with the same name as the imported lib? - Stack Overflow https://share.google/7zvymClHaTqQuUHiA

Yeah :D

I do not have a strong preference but I like re importing with same name, makes it a bit explicit / more "re export" like.

@amoghrajesh amoghrajesh merged commit 521d525 into apache:main Apr 13, 2026
112 checks passed
@amoghrajesh amoghrajesh deleted the mypy-pm branch April 13, 2026 14:14
Copy link
Copy Markdown
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for the quick fix!

@jscheffl jscheffl added the backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch label Apr 13, 2026
@jscheffl jscheffl added this to the Airflow 3.2.1 milestone Apr 13, 2026
@jscheffl
Copy link
Copy Markdown
Contributor

Can we get this into 3.2.1?

jscheffl pushed a commit to jscheffl/airflow that referenced this pull request Apr 13, 2026
…ache#65132)

(cherry picked from commit 521d525)

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
@potiuk
Copy link
Copy Markdown
Member

potiuk commented Apr 13, 2026

Can we get this into 3.2.1?

I believe everything in v3-2-test goes to 3.2.1 now :)

jscheffl added a commit that referenced this pull request Apr 13, 2026
…5132) (#65163)

(cherry picked from commit 521d525)

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
dandanseo123 pushed a commit to dandanseo123/airflow that referenced this pull request Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:plugins area:task-sdk backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants