Skip to content

update check_clie_definition_import to allow using common provider sdk#64138

Merged
jason810496 merged 3 commits intoapache: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 intoapache:mainfrom
wjddn279:fix-check-cli-definition-imports

Conversation

@wjddn279
Copy link
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
Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

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

Nice one!

Copy link
Member

@jason810496 jason810496 left a comment

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.

@jason810496 jason810496 merged commit 62cbf63 into apache:main Mar 24, 2026
64 checks passed
@github-actions
Copy link

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.

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-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants