Skip to content

Re export AirflowPlugin to fix mypy errors in plugins#65132

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

Re export AirflowPlugin to fix mypy errors in plugins#65132
amoghrajesh merged 1 commit into
apache: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

potiuk commented Apr 13, 2026

Copy link
Copy Markdown
Member

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

potiuk commented Apr 13, 2026

Copy link
Copy Markdown
Member

Ah TIL

@potiuk

potiuk commented Apr 13, 2026

Copy link
Copy Markdown
Member

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

potiuk commented Apr 13, 2026

Copy link
Copy Markdown
Member

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

@jscheffl jscheffl left a comment

Copy link
Copy Markdown
Contributor

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

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
@potiuk

potiuk commented Apr 13, 2026

Copy link
Copy Markdown
Member

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
dandanseo123 pushed a commit to dandanseo123/airflow that referenced this pull request Apr 13, 2026
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants