From a30a08a65d98db2cc19e04dc296653ed52894b37 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Fri, 1 Nov 2024 15:13:04 +0100 Subject: [PATCH] Allow to switch breeze to use uv internally to create virtualenvs Breeze sometimes creates "internal" virtualenvs in local ".build" directory when it needs - for example in order to run k8s tests or for release management commands. This PR adds capability to switch breeze to use `uv` instead of `pip` to install depdendencies in those envs. You can now switch breeze to use uv by `breeze setup config --use-uv` and switch back to pip by `breeze setup config --no-use-uv`. --- .github/workflows/ci.yml | 1 + .github/workflows/k8s-tests.yml | 7 +++++ dev/breeze/doc/images/output_setup_config.svg | 24 ++++++++------ dev/breeze/doc/images/output_setup_config.txt | 2 +- .../commands/release_management_commands.py | 6 +++- .../airflow_breeze/commands/setup_commands.py | 31 +++++++++++++++---- .../commands/setup_commands_config.py | 1 + .../src/airflow_breeze/global_constants.py | 1 + .../airflow_breeze/utils/kubernetes_utils.py | 27 +++++++++++++--- .../src/airflow_breeze/utils/run_tests.py | 6 ++-- .../airflow_breeze/utils/virtualenv_utils.py | 30 ++++++++++++++++-- scripts/ci/pre_commit/update_installers.py | 6 +++- 12 files changed, 113 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5609c2eac0caa..acf711c4a2384 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -642,6 +642,7 @@ jobs: kubernetes-versions-list-as-string: ${{ needs.build-info.outputs.kubernetes-versions-list-as-string }} kubernetes-combos-list-as-string: ${{ needs.build-info.outputs.kubernetes-combos-list-as-string }} include-success-outputs: ${{ needs.build-info.outputs.include-success-outputs }} + use-uv: ${{ needs.build-info.outputs.force-pip && 'false' || 'true' }} debug-resources: ${{ needs.build-info.outputs.debug-resources }} if: > ( needs.build-info.outputs.run-kubernetes-tests == 'true' || diff --git a/.github/workflows/k8s-tests.yml b/.github/workflows/k8s-tests.yml index c4b72a9afc924..9a764e88c4e99 100644 --- a/.github/workflows/k8s-tests.yml +++ b/.github/workflows/k8s-tests.yml @@ -44,6 +44,10 @@ on: # yamllint disable-line rule:truthy description: "Whether to include success outputs" required: true type: string + use-uv: + description: "Whether to use uv" + required: true + type: string debug-resources: description: "Whether to debug resources" required: true @@ -96,6 +100,9 @@ jobs: key: "\ k8s-env-${{ steps.breeze.outputs.host-python-version }}-\ ${{ hashFiles('scripts/ci/kubernetes/k8s_requirements.txt','hatch_build.py') }}" + - name: "Switch breeze to use uv" + run: breeze setup-config --use-uv + if: inputs.use-uv == 'true' - name: Run complete K8S tests ${{ inputs.kubernetes-combos-list-as-string }} run: breeze k8s run-complete-tests --run-in-parallel --upgrade --no-copy-local-sources env: diff --git a/dev/breeze/doc/images/output_setup_config.svg b/dev/breeze/doc/images/output_setup_config.svg index 808e5e2c306dd..70a197ce5a6e0 100644 --- a/dev/breeze/doc/images/output_setup_config.svg +++ b/dev/breeze/doc/images/output_setup_config.svg @@ -1,4 +1,4 @@ - +