Skip to content

Fix mypy plugin loading after airflow_mypy distribution migration#65668

Merged
potiuk merged 1 commit intoapache:mainfrom
potiuk:fix-mypy-plugin-loading
Apr 22, 2026
Merged

Fix mypy plugin loading after airflow_mypy distribution migration#65668
potiuk merged 1 commit intoapache:mainfrom
potiuk:fix-mypy-plugin-loading

Conversation

@potiuk
Copy link
Copy Markdown
Member

@potiuk potiuk commented Apr 22, 2026

After #61422 ("Make Mypy plugins installable") two mypy hooks broke
because the plugin references were not migrated consistently:

  • devel-common's mypy extra did not depend on apache-airflow-mypy,
    so any hook that pulls apache-airflow-devel-common[mypy]
    (mypy-airflow-core, mypy-task-sdk, mypy-devel-common, …) failed
    with Error importing plugin "airflow_mypy.plugins.decorators": No module named 'airflow_mypy'.
  • dev/pyproject.toml referenced the plugins by file path with the
    wrong subpackage name (airflow_mypy/plugin/decorators.py — singular,
    path-style), so mypy-dev failed with Can't find plugin "dev/airflow_mypy/plugin/decorators.py".

Adding apache-airflow-mypy to devel-common's mypy extra and
switching dev/pyproject.toml to the module-style plugin names that
already work in the root pyproject.toml fixes both.

Verified locally:

  • prek run mypy-devel-common --all-files — Passed
  • prek run mypy-dev --all-files — Passed
  • prek run mypy-airflow-core (one file) — Passed

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Opus 4.7 (1M context)

Generated-by: Claude Opus 4.7 (1M context) following the guidelines

Two unrelated post-migration breakages in the mypy hooks introduced by
"Make Mypy plugins installable" (apache#61422):

* devel-common's [mypy] extra did not depend on apache-airflow-mypy,
  so any hook that pulls apache-airflow-devel-common[mypy] (mypy-airflow-core,
  mypy-task-sdk, mypy-devel-common, etc.) failed to import the plugin from
  the dedicated mypy virtualenv:
    pyproject.toml:1: error: Error importing plugin
    "airflow_mypy.plugins.decorators": No module named 'airflow_mypy'

* dev/pyproject.toml referenced the plugins by file path with the wrong
  subpackage name ("airflow_mypy/plugin/decorators.py" — singular, and
  path-style instead of module-style), so mypy-dev failed with:
    dev/pyproject.toml:1: error: Can't find plugin
    "dev/airflow_mypy/plugin/decorators.py"

Switching to the module-style names that already work in the root
pyproject.toml fixes mypy-dev.
@potiuk potiuk merged commit c43c778 into apache:main Apr 22, 2026
36 checks passed
@potiuk potiuk deleted the fix-mypy-plugin-loading branch April 22, 2026 12:20
@boring-cyborg
Copy link
Copy Markdown

boring-cyborg Bot commented Apr 22, 2026

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@github-actions
Copy link
Copy Markdown
Contributor

Backport failed to create: v3-2-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-2-test Commit Link

You can attempt to backport this manually by running:

cherry_picker c43c778 v3-2-test

This should apply the commit to the v3-2-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools 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.

2 participants