Skip to content

update check_clie_definition_import to allow using common provider sdk - #64138

Merged
jason810496 merged 3 commits into
apache:mainfrom
wjddn279:fix-check-cli-definition-imports
Mar 24, 2026
Merged

update check_clie_definition_import to allow using common provider sdk#64138
jason810496 merged 3 commits into
apache:mainfrom
wjddn279:fix-check-cli-definition-imports

Conversation

@wjddn279

Copy link
Copy Markdown
Contributor

Body

error occurs when doing task related: #60000

Check CLI definition files only import allowed modules....................................................Failed
- hook id: check-cli-definition-imports
- exit code: 1

  Checking 1 CLI definition file(s)...
  [PosixPath('edge3/src/airflow/providers/edge3/cli/definition.py')]

   Some CLI definition files contain forbidden imports!

  CLI definition files (*/cli/definition.py) should only import from:
    - airflow.configuration
    - airflow.cli.cli_config
    - Their own provider's version_compat module
    - Standard library modules (argparse, getpass, textwrap, typing, collections, functools, itertools, pathlib, os, sys, re, json, dataclasses, enum)

  Found forbidden imports in:

  edge3/src/airflow/providers/edge3/cli/definition.py:
    - airflow.providers.common.compat.sdk.conf

  This restriction exists to:
    - Keep CLI definitions lightweight and declarative to avoid slowdowns
    - Ensure clean separation between CLI structure and implementation

Resolving it by allowing to use common provider sdk


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • 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.

@wjddn279
wjddn279 force-pushed the fix-check-cli-definition-imports branch from 9ced8aa to 57a0507 Compare March 24, 2026 05:09

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one!

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but after a thorough review, I found that we need to narrow down the scope of what can be imported.

Comment thread scripts/ci/prek/check_cli_definition_imports.py Outdated
@jason810496
jason810496 merged commit 62cbf63 into apache:main Mar 24, 2026
64 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport failed to create: v3-1-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-1-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 62cbf63 v3-1-test

This should apply the commit to the v3-1-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.

vatsrahul1001 pushed a commit that referenced this pull request Mar 25, 2026
#64138)

* update check_clie_definition_import to allow using common provider sdk

* fix allowed module

* fix allowed module
aaron-y-chen pushed a commit to aaron-y-chen/airflow that referenced this pull request Mar 30, 2026
apache#64138)

* update check_clie_definition_import to allow using common provider sdk

* fix allowed module

* fix allowed module
Suraj-kumar00 pushed a commit to Suraj-kumar00/airflow that referenced this pull request Apr 7, 2026
apache#64138)

* update check_clie_definition_import to allow using common provider sdk

* fix allowed module

* fix allowed module
abhijeets25012-tech pushed a commit to abhijeets25012-tech/airflow that referenced this pull request Apr 9, 2026
apache#64138)

* update check_clie_definition_import to allow using common provider sdk

* fix allowed module

* fix allowed module
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.

2 participants