这是indexloc提供的服务,不要输入任何密码
Skip to content

Migrate remaining providers to common.compat compatibility layer #57018

@kaxil

Description

@kaxil

This issue tracks the migration of Airflow providers to use the centralized compatibility layer in common.compat provider. The goal is to replace version-specific conditional imports scattered across providers with a standardized approach that works seamlessly across Airflow 2.x and 3.x.

The common.compat layer provides lazy imports that abstract away version differences, eliminating the need for conditional logic like if AIRFLOW_V_3_0_PLUS: in provider code. This improves maintainability and reduces code duplication.

Foundational Work: See PR #56884 for the architectural changes that established this pattern.

Example PRs

Review these PRs to understand the migration pattern:

Migration Steps

  1. Add apache-airflow-providers-common-compat>=1.8.0 to the provider's dependencies array in pyproject.toml

    • Also add it to the dev dependency-group
  2. Replace imports from local version_compat.py with from airflow.providers.common.compat.sdk import ...

    • Common imports: BaseOperator, BaseHook, Context, task, etc.
  3. Update test files similarly

  4. Simplify or remove version_compat.py:

    • Keep only version check constants (AIRFLOW_V_3_0_PLUS, etc.) if still needed
    • Remove conditional import logic that's now handled by common.compat
  5. Run verification:

    prek mypy-providers --directory providers/<your-provider>
  6. Run provider tests to ensure everything works

Current Status (Updated: 2025-10-26)

Total providers: 97

Progress: 84/97 (86.6%) ✅

Remaining: 13 providers

Already Migrated ✅ (84 providers)

Remaining to Migrate 📋 (13 providers)

How to Contribute

  1. Pick a provider: Choose an unchecked provider from the list above that doesn't have an open PR
  2. Review examples: Look at PRs Migrate asana provider to common.compat #57007, Migrate airbyte provider to common.compat #56996, or Migrate dbt.cloud provider to common.compat #56999 to understand the pattern
  3. Make changes: Follow the migration steps outlined above
  4. Verify: Run prek mypy-providers --directory providers/<your-provider> and provider tests
  5. Submit PR:
    • Use title format: "Migrate X provider to common.compat"
    • Reference this issue in your PR description
    • Check off your provider in this issue when you open the PR

Guidelines

  • Focus on one provider at a time to avoid merge conflicts
  • Follow the patterns established in example PRs - consistency is key
  • Ensure all tests pass before submitting your PR
  • If you encounter a provider-specific edge case, ask for guidance in this issue
  • Update this issue by checking off your provider when you open a PR
  • Use the PR title format: "Migrate X provider to common.compat" for easy tracking

Notes

  • The common.compat layer provides version-agnostic imports that work across Airflow 2.x and 3.x
  • This eliminates the need for conditional imports based on AIRFLOW_V_3_0_PLUS and similar version checks
  • See PR Common.Compat: Extract reusable compat utilities and rename to sdk #56884 for the foundational architectural work
  • Some providers may not need migration if they don't use version-specific imports (marked as no changes needed)

Let's work together to improve Airflow's maintainability and reduce technical debt! 🚀

Note: Provider counts may change as PRs are merged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:providerskind:metaHigh-level information important to the community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions