You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jason810496 (via GitHub)" <gi...@apache.org> on 2026/04/01 09:57:26 UTC

[PR] Add prek hook to enforce conf import from compat SDK in providers [airflow]

jason810496 opened a new pull request, #64564:
URL: https://github.com/apache/airflow/pull/64564

   related: #64143
   
   ## Why
   
   Providers have historically imported `conf` from `airflow.configuration` or `airflow.sdk.configuration` directly, which breaks cross-version compatibility between Airflow 2 and 3. We need to enforce that `conf `is only
   imported from `airflow.providers.common.compat.sdk`.
   
   ## What
   
   - Add `check_conf_import_in_providers.py` prek hook that uses AST-based import analysis to detect forbidden `conf` imports from `airflow.configuration` and `airflow.sdk.configuration` in provider source files.
   - Catches imports at all scopes: top-level, inside functions, inside TYPE_CHECKING blocks, and aliased imports.
   - Excludes the compat SDK module itself (common/compat/sdk.py) which legitimately re-exports conf.
   - Register the hook in `providers/.pre-commit-config.yaml` targeting `^.*/src/airflow/providers/.*\.py$`.
   - Add parametrized tests covering forbidden and allowed import patterns.
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes (please specify the tool below) Claude Code following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add prek hook to enforce conf import from compat SDK in providers [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #64564:
URL: https://github.com/apache/airflow/pull/64564


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add prek hook to enforce conf import from compat SDK in providers [airflow]

Posted by "koteshyelamati (via GitHub)" <gi...@apache.org>.
koteshyelamati commented on PR #64564:
URL: https://github.com/apache/airflow/pull/64564#issuecomment-4587210100

   I would like to take this on. My approach:
   The azure-batch SDK v15.x replaced BatchServiceClient with the new BatchClient and changed several method signatures (e.g. job.add() → job.create_job()). The Airflow Azure Batch provider still depends on the <15 pin, which blocks users on newer SDK versions.
   My plan: audit all method calls in airflow/providers/microsoft/azure/operators/batch.py and hooks/batch.py against the v15.x changelog, update the BatchClient instantiation, migrate deprecated method calls, update provider.yaml to remove the <15 cap, and add/update unit tests to mock the new SDK interface.
   I build and operate Kafka + Spring Boot microservices on AWS and have worked with the Azure SDK in data pipeline contexts. Happy to submit a PR once assigned.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add prek hook to enforce conf import from compat SDK in providers [airflow]

Posted by "jscheffl (via GitHub)" <gi...@apache.org>.
jscheffl commented on PR #64564:
URL: https://github.com/apache/airflow/pull/64564#issuecomment-4171678286

   Cool!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add prek hook to enforce conf import from compat SDK in providers [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #64564:
URL: https://github.com/apache/airflow/pull/64564#issuecomment-4169045818

   ### Backport successfully created: v3-2-test
   
   Note: As of [Merging PRs targeted for Airflow 3.X](https://github.com/apache/airflow/blob/main/dev/README_AIRFLOW3_DEV.md#merging-prs-targeted-for-airflow-3x)
   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](https://apache-airflow.slack.com/archives/C03G9H97MM2) Slack channel.
   
   <table>
           <tr>
           <th>Status</th>
           <th>Branch</th>
           <th>Result</th>
       </tr>
       <tr>
           <td>✅</td>
           <td>v3-2-test</td>
           <td><a href="https://github.com/apache/airflow/pull/64567"><img src="https://img.shields.io/badge/PR-64567-blue" alt="PR Link"></a></td>
       </tr>
   </table>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org