Skip to content

Conversation

@amoghrajesh
Copy link
Contributor

@amoghrajesh amoghrajesh commented Dec 18, 2025

We imported around: DEFAULT_SECRETS_SEARCH_PATH from airflow.secrets in sdk configuration to detect worker mode and perform some operations with that.

We indeed need the constant for some detection logic, so instead of cross importing, we can just maintain a copy in the task sdk, since thats unlikely to change.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@potiuk
Copy link
Member

potiuk commented Dec 18, 2025

Should not secret search path be passed as an initialization parameter from outside ?

I think we should note have "ANY" like ANY references to core packages from shared libraries. The only references it should have is via releative imports to other shared libraries. Not even "string" form of those. Actually we might even want to extend my #58825 to also check for those.

In this case - an obvious solution is to have some kind of mandatory intialization method that should be called by the user and pass those paths.

Then "airflow-core" could pass it's own paths, and 'task-sdk` could pass it's own - no coupling, no core nor task-sdk code in the shared library.

I think we might even come up with some convention on how all "shared" libraries should be initialized by it's users - and have some common init pattern for all those libraries done during entrypoint and have those shared library calls generally fail if the init did not happen for them - just to be absolutely sure that we explicitly initialized those libraries

@amoghrajesh
Copy link
Contributor Author

@potiuk pretty good idea really. Let me take a stab at this one.

@uranusjr
Copy link
Member

uranusjr commented Jan 8, 2026

Is this good to merge?

@amoghrajesh
Copy link
Contributor Author

Some comments from @potiuk that I have to look at, let me do it now.

@amoghrajesh amoghrajesh changed the title Move DEFAULT_SECRETS_SEARCH_PATH to shared library to decouple imports in sdk Remove core references in secrets backend logic in sdk Jan 8, 2026
@amoghrajesh
Copy link
Contributor Author

@potiuk @uranusjr @Lee-W looking at it from fresh set of eyes. Duplication is much cleaner in this case :)

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

Nit - would be nice to keep it in sync with prek hook

@amoghrajesh
Copy link
Contributor Author

Thanks, I added a prek hook which does this for mismatch:

(apache-airflow) ➜  airflow git:(remove-dependency-on-constant) ✗ ./scripts/ci/prek/check_secrets_search_path_sync.py

ERROR: Secrets search paths are not synchronized!

The DEFAULT_SECRETS_SEARCH_PATH in airflow-core and _SERVER_DEFAULT_SECRETS_SEARCH_PATH in task-sdk must match.

Please update either:
  - /Users/amoghdesai/Documents/OSS/repos/airflow/airflow-core/src/airflow/secrets/base_secrets.py
  - /Users/amoghdesai/Documents/OSS/repos/airflow/task-sdk/src/airflow/sdk/execution_time/secrets/__init__.py

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.

Just ran the prek script manually, LGTM.

@amoghrajesh amoghrajesh merged commit 8a94a43 into apache:main Jan 9, 2026
101 checks passed
@amoghrajesh amoghrajesh deleted the remove-dependency-on-constant branch January 9, 2026 10:16
stegololz pushed a commit to stegololz/airflow that referenced this pull request Jan 9, 2026
@potiuk
Copy link
Member

potiuk commented Jan 10, 2026

nice!

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.

5 participants