This is an automated email from the ASF dual-hosted git repository. ash pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push: new b994a1d5421 Ensure that the `enerate-tasksdk-datamodels` is not susceptible to local config (#48198) b994a1d5421 is described below commit b994a1d542106763867eb860dee4ebc0cf2eedae Author: Ash Berlin-Taylor <a...@apache.org> AuthorDate: Mon Mar 24 15:55:19 2025 +0000 Ensure that the `enerate-tasksdk-datamodels` is not susceptible to local config (#48198) With a top level `airflow` import the exact behaviour will depend on the users local config --- task-sdk/dev/generate_task_sdk_models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/task-sdk/dev/generate_task_sdk_models.py b/task-sdk/dev/generate_task_sdk_models.py index 9917c029221..bce9af5172a 100644 --- a/task-sdk/dev/generate_task_sdk_models.py +++ b/task-sdk/dev/generate_task_sdk_models.py @@ -30,14 +30,13 @@ from datamodel_code_generator import ( generate as generate_models, ) -from airflow.api_fastapi.execution_api.app import InProcessExecutionAPI +os.environ["_AIRFLOW__AS_LIBRARY"] = "1" AIRFLOW_ROOT_PATH = Path(__file__).parents[2].resolve() AIRFLOW_TASK_SDK_ROOT_PATH = AIRFLOW_ROOT_PATH / "task-sdk" AIRFLOW_CORE_SOURCES_PATH = AIRFLOW_ROOT_PATH / "airflow-core" / "src" sys.path.insert(0, str(Path(__file__).parent.resolve())) # make sure common_precommit_utils is imported -os.environ["_AIRFLOW__AS_LIBRARY"] = "1" sys.path.insert(0, AIRFLOW_CORE_SOURCES_PATH.as_posix()) sys.path.insert(0, str(AIRFLOW_ROOT_PATH)) # make sure setup is imported from Airflow @@ -75,6 +74,8 @@ def load_config(): def generate_file(): + from airflow.api_fastapi.execution_api.app import InProcessExecutionAPI + app = InProcessExecutionAPI() latest_version = app.app.versions.version_values[-1]