Skip to content

[airflow] Add AIR331 rule for airflow.traces module removed in Airflow 3.2#23914

Open
dstandish wants to merge 1 commit intoastral-sh:mainfrom
dstandish:dstandish/airflow-32-removal
Open

[airflow] Add AIR331 rule for airflow.traces module removed in Airflow 3.2#23914
dstandish wants to merge 1 commit intoastral-sh:mainfrom
dstandish:dstandish/airflow-32-removal

Conversation

@dstandish
Copy link

@dstandish dstandish commented Mar 12, 2026

Hi -- I am an airflow contributor. A real human one.

I want to add this rule to help identify if an airflow user is importing from the traces package (which we are removing in 3.2).

Thanks for your review.

Summary

  • Add new AIR331 lint rule that flags imports from the airflow.traces module, which was removed in Airflow 3.2
  • Covers airflow.traces.otel_tracer, airflow.traces.tracer, airflow.traces.utils, and all submodule members
  • Includes test fixtures and snapshot tests

Test plan

  • Added test fixture AIR331_names.py with positive and negative cases
  • Snapshot tests verify correct diagnostics are emitted

…rflow 3.2

The `airflow.traces` module was removed in Airflow 3.2. Add a new lint
rule to flag imports from this module so users can identify and remove
them before upgrading.

Made-with: Cursor
@ntBre
Copy link
Contributor

ntBre commented Mar 12, 2026

Thank you! I'm happy to give this a review, but I like to check in with @Lee-W first :)

@ntBre ntBre added rule Implementing or modifying a lint rule preview Related to preview mode features labels Mar 12, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 12, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@Lee-W
Copy link
Contributor

Lee-W commented Mar 13, 2026

Sure, will do it early next week. We're establishing the process how we contribute to ruff from airflow community. But Daniel's PR is most likely correct haha. Will take a deeper look 👀

@dstandish
Copy link
Author

Sure, will do it early next week. We're establishing the process how we contribute to ruff from airflow community. But Daniel's PR is most likely correct haha. Will take a deeper look 👀

All credit goes to claude

@dstandish
Copy link
Author

@Lee-W if we are also removing airflow.metrics and airflow.stats in 3.2, would it make sense to add these to the same ruff rule?

@Lee-W
Copy link
Contributor

Lee-W commented Mar 14, 2026

@Lee-W if we are also removing airflow.metrics and airflow.stats in 3.2, would it make sense to add these to the same ruff rule?

yep, we group logics with the same purpose into one rule

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

Labels

preview Related to preview mode features rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants