Dev-iL commented on code in PR #74556:
URL: https://github.com/apache/airflow/pull/74556#discussion_r4308431390


##########
scripts/docker/install_airflow_when_building_images.sh:
##########
@@ -35,6 +35,104 @@
 # shellcheck source=scripts/docker/common.sh
 . "$( dirname "${BASH_SOURCE[0]}" )/common.sh"
 
+function has_providers_excluded_for_python() {
+    local python_minor="${AIRFLOW_PYTHON_VERSION%.*}"
+    PYTHONPATH="$( dirname "${BASH_SOURCE[0]}" )" python3 -c \
+        'from pathlib import Path; import sys; from filter_ci_install_set 
import split_members; sys.exit(not split_members(Path.cwd(), sys.argv[1])[1])' \
+        "${python_minor}"
+}
+
+# uv sync --all-packages installs every workspace member, including providers 
excluded for this
+# Python minor and the third-party packages only they need. Resolve the 
members that are not excluded
+# for this interpreter, with the lock's pins as constraints, and install 
exactly that result.
+# Resolves the lock into the install set for this interpreter. This is the 
only step that can fail
+# recoverably - a dependency missing from uv.lock stops the helper - so the 
caller tests it, and that
+# suppresses errexit here: each command has to report its own failure.
+function prepare_filtered_install_set() {
+    local status
+    # Two exports of the same lock: the plain one is the resolver's 
constraints file (uv rejects hashes
+    # there), the hashed one supplies the --hash options that keep `uv sync 
--frozen`'s sha256 check.
+    uv export --frozen --all-packages --group ci-image --no-hashes 
--no-emit-workspace \
+        --output-file "${work_dir}/pins.txt" || { status=$?; set +x; return 
"${status}"; }
+    uv export --frozen --all-packages --group ci-image --no-emit-workspace \
+        --output-file "${work_dir}/hashed-pins.txt" || { status=$?; set +x; 
return "${status}"; }
+    python3 "$( dirname "${BASH_SOURCE[0]}" )/filter_ci_install_set.py" --root 
"${PWD}" \
+        --constraints "${work_dir}/pins.txt" "${helper_hash_args[@]}" \
+        --python-minor "${python_minor}" --platform "${platform_arch}" \
+        --workdir "${work_dir}" --output "${work_dir}/requirements.txt" \
+        --editables "${work_dir}/editables.txt" || { status=$?; set +x; return 
"${status}"; }
+}
+
+# Pass "allow-relock" to let a stale lock be re-resolved instead of failing 
the build.
+function install_workspace_without_excluded_providers() {
+    local allow_relock="${1:-}"
+    local python_minor="${AIRFLOW_PYTHON_VERSION%.*}"
+    local work_dir="/tmp/ci-install-set"
+    local python_bin
+    local platform_arch
+    local status=0
+    # Hash enforcement travels as arrays so a later caller can turn it off 
coherently: uv verifies a
+    # hash whenever the requirements file carries one, so skipping 
--require-hashes alone is not enough.
+    # --no-config rides with --require-hashes: the install runs from the 
workspace root, and uv would
+    # otherwise apply the root's constraint-dependencies, which 
--require-hashes rejects for not being
+    # pinned with "==". Nothing is lost - these are exact pins installed with 
--no-deps.
+    local -a hash_args=(--require-hashes --no-config)

Review Comment:
   Done; the "nothing is lost" claim is gone, and `--no-build-isolation-package 
sphinx-redoc` is passed back explicitly while `exclude-newer` cannot apply to 
an exact set installed with `--no-deps`.



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