amoghrajesh opened a new pull request, #57744:
URL: https://github.com/apache/airflow/pull/57744
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
Re-attempting with fresh set of eyes and better scope planning. The last
one: #54943 exploded and got too big and unmanageable.
## Why We Are Doing This
The task SDK currently depends on Airflow Core for configuration parsing,
preventing it from running independently and creating dependency with Airflow
Core. This blocks SDK independence and creates unnecessary coupling. Moving the
configuration parser to a shared library enables SDK to bootstrap its own
configuration without requiring Core.
## Vision
The Task SDK should be fully independent and runnable without Airflow Core
installed. Providers will eventually consume configuration from the SDK instead
of Core, reducing dependencies and reducing dependency breadth. The shared
configuration library provides a common config parsing foundation that both
Core and SDK can extend with their specific needs (explained later)
## Phase-Wise Approach
**Phase 1 (Current):** (targeted for 3.2)
- Move `AirflowConfigParser` core parsing logic to shared library
- SDK reads core's `config.yml` temporarily (shared config file)
- SDK can bootstrap itself and read `airflow.cfg` if present
- Providers continue depending on airflow core for configuration
- All parsing methods (get, getboolean, getint, etc.) moved to shared
**Phase 2 (Future):** (will discuss on devlist, but not a 3.2 blocking item)
- SDK gets its own `config.yml` with only authoring-related configs
- Providers migrate to consume configuration from SDK instead of Core
- Core retains deployment-specific configs (executor, scheduler, etc.)
**Phase 3 (Future):**
- Lazy loading of provider configurations (only load when accessed)
- Performance improvements by avoiding eager provider loading
## Impacted Components
1. **Users:** No impact. Existing `conf.get()` calls continue to work
unchanged.
2. **Providers:** No changes in Phase 1. Providers continue using Core's
configuration as before. Migration to SDK will happen in Phase 2.
3. **SDK:** Now uses `airflow.sdk.configuration.conf` instead of importing
from Core. Can run independently without Core installed.
4. **Core:** Extends shared parser and adds Core-specific functionality
(providers, validation, Fernet key generation, writing config files).
## What's Done in this PR
**Shared Library (`shared/configuration`):**
- `AirflowConfigParser` base class with all parsing methods
- `AirflowConfigException` exception class
- Deprecated options and sections handling
- Environment variable handling
- Command execution (`_cmd` suffix)
- Secrets backend integration (stubbed for subclasses)
- Sensitive value masking
- Type conversion methods (getboolean, getint, getfloat, getlist, getjson,
getenum, etc.)
- 38 unit tests covering parser functionality ported over from core, to
cover the breadth
**Core (`airflow-core`):**
- Extends shared parser with core-specific initialization
- Provider configuration loading
- Fernet key generation
- Config file writing
- Validation logic
- Maintains backward compatibility for things like AirflowConfigException
**SDK (`task-sdk`):**
- Own `AirflowSDKConfigParser` extending shared parser
- Reads Core's `config.yml` in Phase 1
- Can bootstrap itself (reads `airflow.cfg` if exists)
- No provider loading (Phase 1)
- No secrets backend integration (Phase 1)
- All SDK imports updated to use `airflow.sdk.configuration.conf`
## What's Next
**Phase 2:**
- Create SDK-specific `config.yml` with only authoring-related configs
- Migrate providers to consume configuration from SDK
- Remove SDK's dependency on Core's `config.yml`
**Phase 3:**
- Implement lazy loading for provider configurations
- Performance optimization by loading provider configs only when accessed
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
for more information.
In case of fundamental code changes, an Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party
License Policy](https://www.apache.org/legal/resolved.html#category-x).
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](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]