This is an automated email from the ASF dual-hosted git repository.
potiuk 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 6339d0947dc Fix group/extra bug in initialize_virtualenv (#62230)
6339d0947dc is described below
commit 6339d0947dcec547594798318bea221bf68bc299
Author: Michael Doo <[email protected]>
AuthorDate: Thu Apr 2 12:10:56 2026 -0400
Fix group/extra bug in initialize_virtualenv (#62230)
Previously, the initialize_virtualenv script didn't correctly build the uv
command to
distinguish between `--group` and `--extra`. This updates the `extra_param`
to fix that.
---
scripts/tools/initialize_virtualenv.py | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/scripts/tools/initialize_virtualenv.py
b/scripts/tools/initialize_virtualenv.py
index 7bc754c43ad..fff6fbb4b62 100755
--- a/scripts/tools/initialize_virtualenv.py
+++ b/scripts/tools/initialize_virtualenv.py
@@ -55,7 +55,19 @@ def check_for_package_extras() -> str:
return "dev"
-def uv_install_requirements() -> int:
+def get_dependency_groups(pyproject_toml_path: Path) -> list[str]:
+ """
+ Get the dependency groups from pyproject.toml
+ """
+ try:
+ import tomllib
+ except ImportError:
+ import tomli as tomllib
+ airflow_core_toml_dict = tomllib.loads(pyproject_toml_path.read_text())
+ return airflow_core_toml_dict["dependency-groups"].keys()
+
+
+def uv_install_requirements(airflow_pyproject_toml_file: Path) -> int:
"""
install the requirements of the current python version.
return 0 if success, anything else is an error.
@@ -87,7 +99,12 @@ system packages. It's easier to install extras one-by-one as
needed.
"""
)
- extra_param = [x for extra in extras.split(",") for x in ("--group",
extra)]
+ dependency_groups = get_dependency_groups(airflow_pyproject_toml_file)
+ extra_param = [
+ flag
+ for extra in extras.split(",")
+ for flag in (["--group", extra] if extra in dependency_groups else
["--extra", extra])
+ ]
uv_install_command = ["uv", "sync"] + extra_param
quoted_command = " ".join([shlex.quote(parameter) for parameter in
uv_install_command])
print()
@@ -139,7 +156,8 @@ def main():
clean_up_airflow_home(airflow_home_dir)
- return_code = uv_install_requirements()
+ airflow_pyproject_toml_file = airflow_sources / "pyproject.toml"
+ return_code = uv_install_requirements(airflow_pyproject_toml_file)
if return_code != 0:
print(