potiuk commented on code in PR #31943:
URL: https://github.com/apache/airflow/pull/31943#discussion_r1232046871


##########
dev/breeze/src/airflow_breeze/utils/cdxgen.py:
##########
@@ -115,6 +119,99 @@ def get_cdxgen_port_mapping(parallelism: int, pool: Pool) 
-> dict[str, int]:
     return port_map
 
 
+def get_provider_requirement_image_name(airflow_version: str, python_version: 
str) -> str:
+    return 
f"apache/airflow-dev/base_requirements/{airflow_version}/python{python_version}"
+
+
+def build_providers_base_image(airflow_version: str, python_version: str):
+    image_name = get_provider_requirement_image_name(
+        airflow_version=airflow_version, python_version=python_version
+    )
+    dockerfile = f"""
+FROM ghcr.io/apache/airflow/main/ci/python{python_version}
+RUN pip install --upgrade pip
+# Remove all packages
+RUN python -m venv /opt/airflow/providers
+RUN /opt/airflow/providers/bin/pip install --upgrade pip
+RUN /opt/airflow/providers/bin/pip install apache-airflow=={airflow_version} \
+    --constraint https://raw.githubusercontent.com/apache/airflow/\
+constraints-{airflow_version}/constraints-{python_version}.txt
+"""
+    run_command(["docker", "build", "--tag", image_name, "-"], 
input=dockerfile, text=True, check=True)
+
+
+TARGET_DIR_NAME = "provider_requirements"
+DOCKER_FILE_PREFIX = f"/files/{TARGET_DIR_NAME}/"
+
+
+def get_requirements_for_provider(
+    provider_id: str,
+    airflow_version: str,
+    provider_version: str | None = None,
+    python_version: str = DEFAULT_PYTHON_MAJOR_MINOR_VERSION,
+):
+    provider_path_array = provider_id.split(".")
+    if not provider_version:
+        provider_file = (
+            AIRFLOW_SOURCES_ROOT
+            / "airflow"
+            / "providers"
+            / os.sep.join(provider_path_array)
+            / "provider.yaml"
+        )

Review Comment:
   Ah . But. I think I can use joinpath differently, to get the best of both.



-- 
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]

Reply via email to