You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by hu...@apache.org on 2024/04/15 18:04:30 UTC

(airflow) branch main updated: Use default_factory instead of calling the method in dataclass (#38948)

This is an automated email from the ASF dual-hosted git repository.

husseinawala 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 58820a914c Use default_factory instead of calling the method in dataclass (#38948)
58820a914c is described below

commit 58820a914c9b84c378c9bc1acd4ddbcb4e4a3497
Author: Hussein Awala <hu...@awala.fr>
AuthorDate: Mon Apr 15 20:04:22 2024 +0200

    Use default_factory instead of calling the method in dataclass (#38948)
---
 dev/breeze/src/airflow_breeze/global_constants.py         | 1 +
 dev/breeze/src/airflow_breeze/params/build_prod_params.py | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dev/breeze/src/airflow_breeze/global_constants.py b/dev/breeze/src/airflow_breeze/global_constants.py
index efc01b5885..db9425e490 100644
--- a/dev/breeze/src/airflow_breeze/global_constants.py
+++ b/dev/breeze/src/airflow_breeze/global_constants.py
@@ -368,6 +368,7 @@ def get_airflow_version():
     return airflow_version
 
 
+@lru_cache(maxsize=None)
 def get_airflow_extras():
     airflow_dockerfile = AIRFLOW_SOURCES_ROOT / "Dockerfile"
     with open(airflow_dockerfile) as dockerfile:
diff --git a/dev/breeze/src/airflow_breeze/params/build_prod_params.py b/dev/breeze/src/airflow_breeze/params/build_prod_params.py
index d6193963ce..2533c30d6f 100644
--- a/dev/breeze/src/airflow_breeze/params/build_prod_params.py
+++ b/dev/breeze/src/airflow_breeze/params/build_prod_params.py
@@ -19,7 +19,7 @@ from __future__ import annotations
 import json
 import re
 import sys
-from dataclasses import dataclass
+from dataclasses import dataclass, field
 
 from airflow_breeze.branch_defaults import AIRFLOW_BRANCH, DEFAULT_AIRFLOW_CONSTRAINTS_BRANCH
 from airflow_breeze.global_constants import (
@@ -43,7 +43,7 @@ class BuildProdParams(CommonBuildParams):
     airflow_constraints_mode: str = "constraints"
     airflow_constraints_reference: str = DEFAULT_AIRFLOW_CONSTRAINTS_BRANCH
     cleanup_context: bool = False
-    airflow_extras: str = get_airflow_extras()
+    airflow_extras: str = field(default_factory=get_airflow_extras)
     disable_airflow_repo_cache: bool = False
     disable_mssql_client_installation: bool = False
     disable_mysql_client_installation: bool = False