From 47051c20fbaa40937973ecb2ee41a1c555d86940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Sat, 25 Jul 2026 08:54:41 +0200 Subject: [PATCH 01/50] feat: use uv lock file --- build-library/action.yml | 24 ++++++++++++- build-wheelhouse/action.yml | 24 +++++++++++++ check-vulnerabilities/action.yml | 62 ++++++++++++++++++++++++-------- code-style/action.yml | 27 ++++++++++++-- 4 files changed, 119 insertions(+), 18 deletions(-) diff --git a/build-library/action.yml b/build-library/action.yml index dd6120c98..907dd3df5 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -121,6 +121,18 @@ inputs: required: false type: boolean + use-uv-lockfile: + description: | + Whether to use a uv lockfile when installing dependencies. + + .. note:: + + This option is only applicable when ``use-uv`` is set to ``true``. If + ``use-uv`` is set to ``false``, this option is ignored. + default: false + required: false + type: boolean + skip-python-setup: description: | Whether to skip the Python setup step performed by @@ -164,10 +176,20 @@ runs: message: > Skipping Python setup to use system Python. + - name: "Install dependencies from lockfile" + if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} + shell: bash + env: + WORKING_DIRECTORY: ${{ inputs.working-directory }} + run: | + cd ${WORKING_DIRECTORY} + uv export --frozen --no-emit-project --no-hashes -o /tmp/requirements-locked.txt + uv pip install --no-managed-python --system -r /tmp/requirements-locked.txt + - name: "Install library" shell: bash env: - INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python --system' || 'python -m pip install' }} + INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' && 'uv pip install --no-managed-python --system --no-deps' || inputs.use-uv == 'true' && 'uv pip install --no-managed-python --system' || 'python -m pip install' }} WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | ${INSTALL_COMMAND} ${WORKING_DIRECTORY} diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 94aea6fcf..a79682554 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -149,6 +149,18 @@ inputs: required: false type: boolean + use-uv-lockfile: + description: | + Whether to use a uv lockfile when installing dependencies. + + .. note:: + + This option is only applicable when ``use-uv`` is set to ``true``. If + ``use-uv`` is set to ``false``, this option is ignored. + default: false + required: false + type: boolean + skip-python-setup: description: | Whether to skip the Python setup step performed by @@ -410,6 +422,9 @@ runs: ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} BUILD_BACKEND: ${{ steps.build-system.outputs.BUILD_BACKEND }} INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} + USE_UV: ${{ inputs.use-uv }} + USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} + WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | ${ACTIVATE_VENV} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then @@ -417,6 +432,10 @@ runs: poetry add "${line//\'/\"}" --lock done poetry install + elif [[ "${USE_UV}" == 'true' ]] && [[ "${USE_UV_LOCKFILE}" == 'true' ]]; then + cd ${WORKING_DIRECTORY} + uv add --group ansys-actions -r "${GITHUB_ACTION_PATH}/requirements.txt" + uv sync --frozen --group ansys-actions --no-dev --no-install-project else $INSTALL_COMMAND -r ${GITHUB_ACTION_PATH}/requirements.txt fi @@ -429,12 +448,17 @@ runs: INSTALL_TARGET: ${{ steps.specific-target-requested.outputs.install_target }} WORKING_DIRECTORY: ${{ inputs.working-directory }} GITHUB_WORKSPACE: ${{ github.workspace }} + USE_UV: ${{ inputs.use-uv }} + USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} run: | ${ACTIVATE_VENV} cd ${WORKING_DIRECTORY} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry export --without-hashes --format=requirements.txt --output=wheel_reqs.txt pip wheel -w ${GITHUB_WORKSPACE}/wheelhouse -r wheel_reqs.txt + elif [[ "${USE_UV}" == 'true' && "${USE_UV_LOCKFILE}" == 'true' ]]; then + uv export --frozen --no-emit-project --no-hashes -o wheel_reqs.txt + python -m pip wheel -w ${GITHUB_WORKSPACE}/wheelhouse -r wheel_reqs.txt else python -m pip wheel "${INSTALL_TARGET}" -w ${GITHUB_WORKSPACE}/wheelhouse fi diff --git a/check-vulnerabilities/action.yml b/check-vulnerabilities/action.yml index 78ada7d72..b7ff24d00 100644 --- a/check-vulnerabilities/action.yml +++ b/check-vulnerabilities/action.yml @@ -219,6 +219,18 @@ inputs: required: false type: boolean + use-uv-lockfile: + description: | + Whether to use a uv lockfile when installing dependencies. + + .. note:: + + This option is only applicable when ``use-uv`` is set to ``true``. If + ``use-uv`` is set to ``false``, this option is ignored. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -376,29 +388,38 @@ runs: BUILD_BACKEND: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} EXTRA_TARGETS: ${{ inputs.extra-targets }} + USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} # Note: we need to use an array to store the extra targets, otherwise # the shell expansion messes with the quotes in the poetry case. run: | ${ACTIVATE_VENV} - if [[ "${EXTRA_TARGETS}" != '' ]]; then - if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then - echo "Installing extra targets with poetry: ${EXTRA_TARGETS}" - extra_targets=${EXTRA_TARGETS} + if [[ "${USE_UV_LOCKFILE}" == 'true' && "${BUILD_BACKEND}" == 'uv' ]]; then + if [[ "${EXTRA_TARGETS}" != '' ]]; then + uv sync --frozen --extra "${EXTRA_TARGETS}" --no-dev else - echo "Installing extra targets with pip: ${EXTRA_TARGETS}" - extra_targets=[${EXTRA_TARGETS}] + uv sync --frozen --no-dev fi else - echo "No extra targets to install" - extra_targets="" - fi + if [[ "${EXTRA_TARGETS}" != '' ]]; then + if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then + echo "Installing extra targets with poetry: ${EXTRA_TARGETS}" + extra_targets=${EXTRA_TARGETS} + else + echo "Installing extra targets with pip: ${EXTRA_TARGETS}" + extra_targets=[${EXTRA_TARGETS}] + fi + else + echo "No extra targets to install" + extra_targets="" + fi - if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then - poetry install --extras "${extra_targets}" - elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then - uv pip install ."${extra_targets}" - else - python -m pip install ."${extra_targets}" + if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then + poetry install --extras "${extra_targets}" + elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then + uv pip install ."${extra_targets}" + else + python -m pip install ."${extra_targets}" + fi fi - name: "Check if requirements.txt file exists" @@ -410,6 +431,17 @@ runs: run: | echo "EXISTS_REQUIREMENTS=$(if [ -f requirements/requirements_${EXTRA_TARGETS}.txt ]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_OUTPUT + - uses: ansys/actions/_logging@main + if: ${{ inputs.skip-install == 'true' && inputs.use-uv-lockfile == 'true' && steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true' }} + with: + level: "ERROR" + message: > + ``use-uv-lockfile`` is enabled, but ``skip-install`` is also enabled and + a requirements file exists. Please, either use the lock file or the requirements + file, but not both. If you want to use the lock file, remove the requirements file + from the repository. If you want to use the requirements file, disable + ``use-uv-lockfile``. + - name: "Install dependencies from the requirements file" shell: bash if: ${{ (inputs.skip-install == 'true' ) && (steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true') }} diff --git a/code-style/action.yml b/code-style/action.yml index c228ac046..c18c02ff8 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -131,6 +131,18 @@ inputs: required: false type: boolean + use-uv-lockfile: + description: | + Whether to use a uv lockfile when installing dependencies. + + .. note:: + + This option is only applicable when ``use-uv`` is set to ``true`` and + ``skip-install`` is set to ``false``. Otherwise, this option is ignored. + default: false + required: false + type: boolean + checkout: description: | Whether to do a checkout step or not. If ``true``, the checkout step is performed. @@ -274,12 +286,17 @@ runs: env: BUILD_BACKEND: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} + USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} run: | ${ACTIVATE_VENV} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then - uv pip install . + if [[ "${USE_UV_LOCKFILE}" == 'true' ]]; then + uv sync --frozen --no-dev + else + uv pip install . + fi else python -m pip install . fi @@ -291,6 +308,7 @@ runs: BUILD_BACKEND: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} SKIP_INSTALL: ${{ inputs.skip-install }} USE_PREK: ${{ inputs.use-prek }} + USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} run: | ${ACTIVATE_VENV} if [[ "${USE_PREK}" == 'true' ]]; then @@ -304,7 +322,12 @@ runs: done poetry install elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then - uv pip install -r ${REQUIREMENTS_FILE} + if [[ "${USE_UV_LOCKFILE}" == 'true' ]] && [[ "${SKIP_INSTALL}" == 'false' ]]; then + uv add --group ansys-actions -r "${REQUIREMENTS_FILE}" + uv sync --frozen --group ansys-actions --no-dev --no-install-project + else + uv pip install -r ${REQUIREMENTS_FILE} + fi else pip install -r ${REQUIREMENTS_FILE} fi From 4cef1c287a9433919246822c19b73f1bc5bb8f89 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Sat, 25 Jul 2026 06:57:45 +0000 Subject: [PATCH 02/50] chore: adding changelog file 1427.added.md [dependabot-skip] --- doc/source/changelog/1427.added.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/source/changelog/1427.added.md diff --git a/doc/source/changelog/1427.added.md b/doc/source/changelog/1427.added.md new file mode 100644 index 000000000..0ec7cb0b1 --- /dev/null +++ b/doc/source/changelog/1427.added.md @@ -0,0 +1 @@ +Use uv lock file From 5ec64d2eb3ae8e5ae50cf1c002be0616d538a79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Sat, 25 Jul 2026 18:41:36 +0200 Subject: [PATCH 03/50] wip: test PR --- .github/workflows/ci_cd_pr.yml | 2 ++ .github/workflows/ci_cd_pr_flit.yml | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 59c1d931f..54a32a6b0 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -124,6 +124,8 @@ jobs: python-version: ${{ env.MAIN_PYTHON_VERSION }} use-python-cache: false checkout: false + use-uv: true + use-uv-lockfile: true type-check: name: Type check with Ty diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index a0b46d8b3..3c11da881 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -83,6 +83,8 @@ jobs: working-directory: .ci/${{ env.LIBRARY_NAME }} attest-provenance: true checkout: false + use-uv: true + use-uv-lockfile: true test-build-library-flit: name: "Test build-library action (use-uv: ${{ matrix.use-uv }}) using ansys-actions-flit package" @@ -111,6 +113,7 @@ jobs: working-directory: .ci/${{ env.LIBRARY_NAME }} use-uv: ${{ matrix.use-uv }} checkout: false + use-uv-lockfile: ${{ matrix.use-uv }} test-release-flit: name: "Test releasing ansys-actions-flit package to local devpi server" @@ -216,6 +219,8 @@ jobs: library-name: ${{ matrix.repository.library }} python-version: ${{ env.MAIN_PYTHON_VERSION }} attest-provenance: true + use-uv-lockfile: true + use-uv: true test-check-licenses-flit-projects: name: "Test check-licenses action for ${{ matrix.repository.name }} project" From f3cee24eff75e2540cccc668305299516e6f6289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Sat, 25 Jul 2026 18:52:33 +0200 Subject: [PATCH 04/50] wip: add missing input --- .github/workflows/ci_cd_pr_flit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index 3c11da881..ad76fa9c1 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -176,6 +176,8 @@ jobs: operating-system: ${{ matrix.os }} python-version: ${{ env.MAIN_PYTHON_VERSION }} attest-provenance: true + use-uv : true + use-uv-lockfile: true test-build-library-flit-projects: name: "Test build-library action for ${{ matrix.repository.name }} project" From 83e60ca948c66d1c84e5cc0155b463c055896bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 12:33:45 +0200 Subject: [PATCH 05/50] refactor: add failing step when non uv lock file exists --- build-library/action.yml | 20 ++++++++++++++++++++ build-wheelhouse/action.yml | 18 ++++++++++++++++++ check-vulnerabilities/action.yml | 18 ++++++++++++++++++ code-style/action.yml | 18 ++++++++++++++++++ 4 files changed, 74 insertions(+) diff --git a/build-library/action.yml b/build-library/action.yml index 907dd3df5..dd97c03b9 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -176,6 +176,26 @@ runs: message: > Skipping Python setup to use system Python. + - name: "Validate uv lockfile existence" + id: validate-uv-lockfile + if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} + shell: bash + env: + WORKING_DIRECTORY: ${{ inputs.working-directory }} + run: | + if [[ ! -f "${WORKING_DIRECTORY}/uv.lock" ]]; then + echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + else + echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + fi + + - uses: ansys/actions/_logging@main + if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} + with: + level: "ERROR" + message: > + uv lockfile (uv.lock) not found in ${{ inputs.working-directory }} + - name: "Install dependencies from lockfile" if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} shell: bash diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index a79682554..947994e68 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -302,6 +302,24 @@ runs: python -m pip install -U pip fi + - name: "Validate uv lockfile existence" + id: validate-uv-lockfile + if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} + shell: bash + run: | + if [[ ! -f "uv.lock" ]]; then + echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + else + echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + fi + + - uses: ansys/actions/_logging@main + if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} + with: + level: "ERROR" + message: > + uv lockfile (uv.lock) not found in repository root + - name: "Install the library with the desired targets" env: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} diff --git a/check-vulnerabilities/action.yml b/check-vulnerabilities/action.yml index b7ff24d00..e92eb7e33 100644 --- a/check-vulnerabilities/action.yml +++ b/check-vulnerabilities/action.yml @@ -289,6 +289,24 @@ runs: message: > Build backend: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} + - name: "Validate uv lockfile existence" + id: validate-uv-lockfile + if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' && inputs.skip-install == 'false' }} + shell: bash + run: | + if [[ ! -f "uv.lock" ]]; then + echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + else + echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + fi + + - uses: ansys/actions/_logging@main + if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} + with: + level: "ERROR" + message: > + uv lockfile (uv.lock) not found in repository root + # ------------------------------------------------------------------------ - uses: ansys/actions/_logging@main diff --git a/code-style/action.yml b/code-style/action.yml index c18c02ff8..9d6e0500a 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -267,6 +267,24 @@ runs: # ------------------------------------------------------------------------ + - name: "Validate uv lockfile existence" + id: validate-uv-lockfile + if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' && inputs.skip-install == 'false' }} + shell: bash + run: | + if [[ ! -f "uv.lock" ]]; then + echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + else + echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + fi + + - uses: ansys/actions/_logging@main + if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} + with: + level: "ERROR" + message: > + uv lockfile (uv.lock) not found in repository root + - name: "Update pip" shell: bash env: From 53ed4dbef75106454974adf620aa4d4a106d38ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 12:42:17 +0200 Subject: [PATCH 06/50] ci: force code style with install --- .github/workflows/ci_cd_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 54a32a6b0..7f1110b33 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -126,6 +126,7 @@ jobs: checkout: false use-uv: true use-uv-lockfile: true + skip-install: false type-check: name: Type check with Ty From 5fe8fc66f3cfe45a1397763a978a7ceee095d17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 14:08:55 +0200 Subject: [PATCH 07/50] fix: missing working directory when checking --- build-wheelhouse/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 947994e68..4608d766a 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -306,8 +306,10 @@ runs: id: validate-uv-lockfile if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} shell: bash + env: + WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | - if [[ ! -f "uv.lock" ]]; then + if [[ ! -f "${WORKING_DIRECTORY}/uv.lock" ]]; then echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} else echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} From b5c507e1f8922cc41f6659dd9369f0c05216f33f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 14:17:28 +0200 Subject: [PATCH 08/50] ci: update to trigger jobs --- .github/workflows/ci_cd_pr_flit.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index ad76fa9c1..1d30065a2 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -89,7 +89,7 @@ jobs: test-build-library-flit: name: "Test build-library action (use-uv: ${{ matrix.use-uv }}) using ansys-actions-flit package" runs-on: ubuntu-latest - needs: test-build-wheelhouse-flit + # needs: test-build-wheelhouse-flit strategy: matrix: use-uv: ['true', 'false'] @@ -298,6 +298,8 @@ jobs: use-python-cache: false use-prek: ${{ matrix.use-prek }} checkout: false + use-uv: true + use-uv-lockfile: true test-doc-style-flit-projects: name: "Test doc-style action for ${{ matrix.repository.name }} project" From 48bc226bc5c2edf54db77cb41bdd85dc40a3871c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 14:27:30 +0200 Subject: [PATCH 09/50] ci: update to trigger jobs --- .github/workflows/ci_cd_pr_flit.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index 1d30065a2..318b6b05f 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -182,7 +182,6 @@ jobs: test-build-library-flit-projects: name: "Test build-library action for ${{ matrix.repository.name }} project" runs-on: ubuntu-latest - needs: test-build-wheelhouse-flit-projects strategy: matrix: repository: @@ -200,7 +199,6 @@ jobs: contents: read attestations: write # Needed for provenance attestation steps: - - name: "Install Git and clone ${{ matrix.repository.name }} repository" uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: From 0ba1a5574ee629a30c0596cb70638a34fd21ac4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 15:42:19 +0200 Subject: [PATCH 10/50] ci: add missed input to trigger uv lock install --- .github/workflows/ci_cd_pr_flit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index 318b6b05f..e208589e5 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -298,6 +298,7 @@ jobs: checkout: false use-uv: true use-uv-lockfile: true + skip-install: false test-doc-style-flit-projects: name: "Test doc-style action for ${{ matrix.repository.name }} project" From 10ddec7a6d31adcaaef6b9f71e38b39680e5f174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 17:35:48 +0200 Subject: [PATCH 11/50] refactor: do not use add group to not break hooks --- code-style/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code-style/action.yml b/code-style/action.yml index 9d6e0500a..d314cbe30 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -341,8 +341,7 @@ runs: poetry install elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then if [[ "${USE_UV_LOCKFILE}" == 'true' ]] && [[ "${SKIP_INSTALL}" == 'false' ]]; then - uv add --group ansys-actions -r "${REQUIREMENTS_FILE}" - uv sync --frozen --group ansys-actions --no-dev --no-install-project + uv pip install -r "${REQUIREMENTS_FILE}" else uv pip install -r ${REQUIREMENTS_FILE} fi From 41f51143ab0ecfa0f460d2e330b43865327d2cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 17:41:43 +0200 Subject: [PATCH 12/50] refactor: fix previous refactoring --- code-style/action.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/code-style/action.yml b/code-style/action.yml index d314cbe30..fca0a3231 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -340,11 +340,7 @@ runs: done poetry install elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then - if [[ "${USE_UV_LOCKFILE}" == 'true' ]] && [[ "${SKIP_INSTALL}" == 'false' ]]; then - uv pip install -r "${REQUIREMENTS_FILE}" - else - uv pip install -r ${REQUIREMENTS_FILE} - fi + uv pip install -r ${REQUIREMENTS_FILE} else pip install -r ${REQUIREMENTS_FILE} fi From 32cd596d18bbeb9d5353f2f42a551eaca8c3bd8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 08:34:13 +0200 Subject: [PATCH 13/50] fix: add missing step in build wheelhouse --- build-wheelhouse/action.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 4608d766a..cab4a7d6a 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -326,6 +326,9 @@ runs: env: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} INSTALL_TARGET: ${{ steps.specific-target-requested.outputs.install_target }} + TARGET: ${{ inputs.target }} + USE_UV: ${{ inputs.use-uv }} + USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} BUILD_BACKEND: ${{ steps.build-system.outputs.BUILD_BACKEND }} WORKING_DIRECTORY: ${{ inputs.working-directory }} @@ -335,6 +338,12 @@ runs: cd ${WORKING_DIRECTORY} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install ${INSTALL_TARGET} + elif [[ "${USE_UV}" == 'true' && "${USE_UV_LOCKFILE}" == 'true' ]]; then + if [[ "${TARGET}" != '' ]]; then + uv sync --frozen --extra "${TARGET}" --no-dev + else + uv sync --frozen --no-dev + fi else ${INSTALL_COMMAND} "${INSTALL_TARGET}" fi @@ -444,7 +453,6 @@ runs: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} USE_UV: ${{ inputs.use-uv }} USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} - WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | ${ACTIVATE_VENV} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then @@ -453,9 +461,7 @@ runs: done poetry install elif [[ "${USE_UV}" == 'true' ]] && [[ "${USE_UV_LOCKFILE}" == 'true' ]]; then - cd ${WORKING_DIRECTORY} - uv add --group ansys-actions -r "${GITHUB_ACTION_PATH}/requirements.txt" - uv sync --frozen --group ansys-actions --no-dev --no-install-project + uv pip install -r "${GITHUB_ACTION_PATH}/requirements.txt" else $INSTALL_COMMAND -r ${GITHUB_ACTION_PATH}/requirements.txt fi From 940bac6367c9ee1787a04027db52dba60e091685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 16:28:18 +0200 Subject: [PATCH 14/50] refactor: keep uv logic to install only --- build-wheelhouse/action.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index cab4a7d6a..7d63d77ea 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -474,17 +474,12 @@ runs: INSTALL_TARGET: ${{ steps.specific-target-requested.outputs.install_target }} WORKING_DIRECTORY: ${{ inputs.working-directory }} GITHUB_WORKSPACE: ${{ github.workspace }} - USE_UV: ${{ inputs.use-uv }} - USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} run: | ${ACTIVATE_VENV} cd ${WORKING_DIRECTORY} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry export --without-hashes --format=requirements.txt --output=wheel_reqs.txt pip wheel -w ${GITHUB_WORKSPACE}/wheelhouse -r wheel_reqs.txt - elif [[ "${USE_UV}" == 'true' && "${USE_UV_LOCKFILE}" == 'true' ]]; then - uv export --frozen --no-emit-project --no-hashes -o wheel_reqs.txt - python -m pip wheel -w ${GITHUB_WORKSPACE}/wheelhouse -r wheel_reqs.txt else python -m pip wheel "${INSTALL_TARGET}" -w ${GITHUB_WORKSPACE}/wheelhouse fi From 8e525b6379826b62772e6d7aa3e9686fe8c6a42c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 16:56:18 +0200 Subject: [PATCH 15/50] refactor: fix wrong logic --- build-library/action.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build-library/action.yml b/build-library/action.yml index dd97c03b9..1267596a5 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -176,6 +176,10 @@ runs: message: > Skipping Python setup to use system Python. + # ------------------------------------------------------------------------ + # Leverage uv lockfile if requested and available + # ------------------------------------------------------------------------ + - name: "Validate uv lockfile existence" id: validate-uv-lockfile if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} @@ -196,7 +200,7 @@ runs: message: > uv lockfile (uv.lock) not found in ${{ inputs.working-directory }} - - name: "Install dependencies from lockfile" + - name: "Install dependencies from uv lockfile" if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} shell: bash env: @@ -207,9 +211,10 @@ runs: uv pip install --no-managed-python --system -r /tmp/requirements-locked.txt - name: "Install library" + if: ${{ inputs.use-uv != 'true' || inputs.use-uv-lockfile != 'true' }} shell: bash env: - INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' && 'uv pip install --no-managed-python --system --no-deps' || inputs.use-uv == 'true' && 'uv pip install --no-managed-python --system' || 'python -m pip install' }} + INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python --system' || 'python -m pip install' }} WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | ${INSTALL_COMMAND} ${WORKING_DIRECTORY} From cc9b64feb9489b733942c8ad41091d0e9d877735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 17:03:48 +0200 Subject: [PATCH 16/50] refactor: cleanup --- build-library/action.yml | 6 +++++- build-wheelhouse/action.yml | 2 -- check-vulnerabilities/action.yml | 5 ++++- code-style/action.yml | 1 - 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/build-library/action.yml b/build-library/action.yml index 1267596a5..67aa7130b 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -177,7 +177,7 @@ runs: Skipping Python setup to use system Python. # ------------------------------------------------------------------------ - # Leverage uv lockfile if requested and available + # Install package by leveraging uv lockfile if requested and available # ------------------------------------------------------------------------ - name: "Validate uv lockfile existence" @@ -210,6 +210,10 @@ runs: uv export --frozen --no-emit-project --no-hashes -o /tmp/requirements-locked.txt uv pip install --no-managed-python --system -r /tmp/requirements-locked.txt + # ------------------------------------------------------------------------ + # Install package without leveraging uv lockfile + # ------------------------------------------------------------------------ + - name: "Install library" if: ${{ inputs.use-uv != 'true' || inputs.use-uv-lockfile != 'true' }} shell: bash diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 7d63d77ea..cd8691e1d 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -460,8 +460,6 @@ runs: poetry add "${line//\'/\"}" --lock done poetry install - elif [[ "${USE_UV}" == 'true' ]] && [[ "${USE_UV_LOCKFILE}" == 'true' ]]; then - uv pip install -r "${GITHUB_ACTION_PATH}/requirements.txt" else $INSTALL_COMMAND -r ${GITHUB_ACTION_PATH}/requirements.txt fi diff --git a/check-vulnerabilities/action.yml b/check-vulnerabilities/action.yml index e92eb7e33..2c709b04f 100644 --- a/check-vulnerabilities/action.yml +++ b/check-vulnerabilities/action.yml @@ -411,13 +411,16 @@ runs: # the shell expansion messes with the quotes in the poetry case. run: | ${ACTIVATE_VENV} + # Use uv lockfile if requested and the build backend is uv if [[ "${USE_UV_LOCKFILE}" == 'true' && "${BUILD_BACKEND}" == 'uv' ]]; then if [[ "${EXTRA_TARGETS}" != '' ]]; then uv sync --frozen --extra "${EXTRA_TARGETS}" --no-dev else uv sync --frozen --no-dev fi + # Use other installation methods if uv lockfile is not requested or the build backend is not uv else + # 1. Define the extra targets to be installed based on the build backend and the provided input if [[ "${EXTRA_TARGETS}" != '' ]]; then if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then echo "Installing extra targets with poetry: ${EXTRA_TARGETS}" @@ -430,7 +433,7 @@ runs: echo "No extra targets to install" extra_targets="" fi - + # 2. Trigger the installation command based on the build backend if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install --extras "${extra_targets}" elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then diff --git a/code-style/action.yml b/code-style/action.yml index fca0a3231..20b883797 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -326,7 +326,6 @@ runs: BUILD_BACKEND: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} SKIP_INSTALL: ${{ inputs.skip-install }} USE_PREK: ${{ inputs.use-prek }} - USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} run: | ${ACTIVATE_VENV} if [[ "${USE_PREK}" == 'true' ]]; then From 6932c1a73bcf28020e2ba7ad4841b3179c08c993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 18:12:59 +0200 Subject: [PATCH 17/50] fix: distribution folder handling when using uv without pip --- build-wheelhouse/smoke_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-wheelhouse/smoke_test.py b/build-wheelhouse/smoke_test.py index c7428f581..084b5462c 100644 --- a/build-wheelhouse/smoke_test.py +++ b/build-wheelhouse/smoke_test.py @@ -70,7 +70,7 @@ def find_module_from_dist(pkg_name: str, attr: str): if pth_file: source_code_folder = None # Read the .pth file to find the source code path - with Path(pth_file).open("r") as file: + with Path(dist.locate_file(pth_file)).open("r") as file: for line in file: # Check if the path is a valid directory path = Path(line.strip()) From 1b687e1977bc2ecbef18f15bbff5902be6531a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 18:33:38 +0200 Subject: [PATCH 18/50] ci: update to only test with geometry --- .github/workflows/ci_cd_pr.yml | 2 -- .github/workflows/ci_cd_pr_flit.yml | 14 ++++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 7f1110b33..0764825de 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -124,8 +124,6 @@ jobs: python-version: ${{ env.MAIN_PYTHON_VERSION }} use-python-cache: false checkout: false - use-uv: true - use-uv-lockfile: true skip-install: false type-check: diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index e208589e5..5bd08e460 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -83,8 +83,6 @@ jobs: working-directory: .ci/${{ env.LIBRARY_NAME }} attest-provenance: true checkout: false - use-uv: true - use-uv-lockfile: true test-build-library-flit: name: "Test build-library action (use-uv: ${{ matrix.use-uv }}) using ansys-actions-flit package" @@ -176,8 +174,8 @@ jobs: operating-system: ${{ matrix.os }} python-version: ${{ env.MAIN_PYTHON_VERSION }} attest-provenance: true - use-uv : true - use-uv-lockfile: true + use-uv-lockfile: ${{ matrix.repository.name == 'pyansys-geometry' }} + use-uv: ${{ matrix.repository.name == 'pyansys-geometry' }} test-build-library-flit-projects: name: "Test build-library action for ${{ matrix.repository.name }} project" @@ -219,8 +217,8 @@ jobs: library-name: ${{ matrix.repository.library }} python-version: ${{ env.MAIN_PYTHON_VERSION }} attest-provenance: true - use-uv-lockfile: true - use-uv: true + use-uv-lockfile: ${{ matrix.repository.name == 'pyansys-geometry' }} + use-uv: ${{ matrix.repository.name == 'pyansys-geometry' }} test-check-licenses-flit-projects: name: "Test check-licenses action for ${{ matrix.repository.name }} project" @@ -296,8 +294,8 @@ jobs: use-python-cache: false use-prek: ${{ matrix.use-prek }} checkout: false - use-uv: true - use-uv-lockfile: true + use-uv-lockfile: ${{ matrix.repository.name == 'pyansys-geometry' }} + use-uv: ${{ matrix.repository.name == 'pyansys-geometry' }} skip-install: false test-doc-style-flit-projects: From 759836d9f8a8b51fc4472cbd09e0b1a27866b044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 18:38:26 +0200 Subject: [PATCH 19/50] refactor: update to fix type hint --- build-wheelhouse/smoke_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-wheelhouse/smoke_test.py b/build-wheelhouse/smoke_test.py index 084b5462c..e6ccaf960 100644 --- a/build-wheelhouse/smoke_test.py +++ b/build-wheelhouse/smoke_test.py @@ -70,7 +70,7 @@ def find_module_from_dist(pkg_name: str, attr: str): if pth_file: source_code_folder = None # Read the .pth file to find the source code path - with Path(dist.locate_file(pth_file)).open("r") as file: + with Path(str(dist.locate_file(pth_file))).open("r") as file: for line in file: # Check if the path is a valid directory path = Path(line.strip()) From c55b7599d8cbe4832388a1765de74d6485ad8d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Wed, 29 Jul 2026 09:26:12 +0200 Subject: [PATCH 20/50] ci: do not use lockfile on fake package --- .github/workflows/ci_cd_pr_flit.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index 5bd08e460..bfdc00461 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -111,7 +111,6 @@ jobs: working-directory: .ci/${{ env.LIBRARY_NAME }} use-uv: ${{ matrix.use-uv }} checkout: false - use-uv-lockfile: ${{ matrix.use-uv }} test-release-flit: name: "Test releasing ansys-actions-flit package to local devpi server" From e0f044e9224d0da3c306b5dd8a300833f6d598e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Wed, 29 Jul 2026 16:08:31 +0200 Subject: [PATCH 21/50] ci: update following review --- build-library/action.yml | 3 +- build-wheelhouse/action.yml | 5 +- check-vulnerabilities/action.yml | 84 ++++++++++++++++---------------- 3 files changed, 45 insertions(+), 47 deletions(-) diff --git a/build-library/action.yml b/build-library/action.yml index 67aa7130b..22661f5bb 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -207,8 +207,7 @@ runs: WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | cd ${WORKING_DIRECTORY} - uv export --frozen --no-emit-project --no-hashes -o /tmp/requirements-locked.txt - uv pip install --no-managed-python --system -r /tmp/requirements-locked.txt + uv sync --frozen --no-managed-python # ------------------------------------------------------------------------ # Install package without leveraging uv lockfile diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index cd8691e1d..569c99d14 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -326,7 +326,6 @@ runs: env: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} INSTALL_TARGET: ${{ steps.specific-target-requested.outputs.install_target }} - TARGET: ${{ inputs.target }} USE_UV: ${{ inputs.use-uv }} USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} @@ -339,8 +338,8 @@ runs: if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install ${INSTALL_TARGET} elif [[ "${USE_UV}" == 'true' && "${USE_UV_LOCKFILE}" == 'true' ]]; then - if [[ "${TARGET}" != '' ]]; then - uv sync --frozen --extra "${TARGET}" --no-dev + if [[ "${INSTALL_TARGET}" != '' ]]; then + uv sync --frozen --extra "${INSTALL_TARGET}" --no-dev else uv sync --frozen --no-dev fi diff --git a/check-vulnerabilities/action.yml b/check-vulnerabilities/action.yml index 2c709b04f..a4cbcccd5 100644 --- a/check-vulnerabilities/action.yml +++ b/check-vulnerabilities/action.yml @@ -263,6 +263,28 @@ runs: # ------------------------------------------------------------------------ + - name: "Check if requirements.txt file exists" + id: check-exists-requirements-file + shell: bash + if: ${{ inputs.skip-install == 'true' }} + env: + EXTRA_TARGETS: ${{ inputs.extra-targets }} + run: | + echo "EXISTS_REQUIREMENTS=$(if [ -f requirements/requirements_${EXTRA_TARGETS}.txt ]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_OUTPUT + + - uses: ansys/actions/_logging@main + if: ${{ inputs.skip-install == 'true' && inputs.use-uv-lockfile == 'true' && steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true' }} + with: + level: "ERROR" + message: > + ``use-uv-lockfile`` is enabled, but ``skip-install`` is also enabled and + a requirements file exists. Please, either use the lock file or the requirements + file, but not both. If you want to use the lock file, remove the requirements file + from the repository. If you want to use the requirements file, disable + ``use-uv-lockfile``. + + # ------------------------------------------------------------------------ + - uses: ansys/actions/_logging@main with: level: "INFO" @@ -411,58 +433,36 @@ runs: # the shell expansion messes with the quotes in the poetry case. run: | ${ACTIVATE_VENV} - # Use uv lockfile if requested and the build backend is uv - if [[ "${USE_UV_LOCKFILE}" == 'true' && "${BUILD_BACKEND}" == 'uv' ]]; then - if [[ "${EXTRA_TARGETS}" != '' ]]; then - uv sync --frozen --extra "${EXTRA_TARGETS}" --no-dev + # 1. Define the extra targets to be installed based on the build backend and the provided input + if [[ "${EXTRA_TARGETS}" != '' ]]; then + if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then + echo "Installing extra targets with poetry: ${EXTRA_TARGETS}" + extra_targets=${EXTRA_TARGETS} else - uv sync --frozen --no-dev + echo "Installing extra targets with pip: ${EXTRA_TARGETS}" + extra_targets=[${EXTRA_TARGETS}] fi - # Use other installation methods if uv lockfile is not requested or the build backend is not uv else - # 1. Define the extra targets to be installed based on the build backend and the provided input - if [[ "${EXTRA_TARGETS}" != '' ]]; then - if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then - echo "Installing extra targets with poetry: ${EXTRA_TARGETS}" - extra_targets=${EXTRA_TARGETS} + echo "No extra targets to install" + extra_targets="" + fi + # 2. Trigger the installation command based on the build backend + if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then + poetry install --extras "${extra_targets}" + elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then + if [[ ${USE_UV_LOCKFILE}" == 'true' ]]; then + if [[ "${EXTRA_TARGETS}" != '' ]]; then + uv sync --frozen --extra "${EXTRA_TARGETS}" --no-dev else - echo "Installing extra targets with pip: ${EXTRA_TARGETS}" - extra_targets=[${EXTRA_TARGETS}] + uv sync --frozen --no-dev fi else - echo "No extra targets to install" - extra_targets="" - fi - # 2. Trigger the installation command based on the build backend - if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then - poetry install --extras "${extra_targets}" - elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then uv pip install ."${extra_targets}" - else - python -m pip install ."${extra_targets}" fi + else + python -m pip install ."${extra_targets}" fi - - name: "Check if requirements.txt file exists" - id: check-exists-requirements-file - shell: bash - if: ${{ inputs.skip-install == 'true' }} - env: - EXTRA_TARGETS: ${{ inputs.extra-targets }} - run: | - echo "EXISTS_REQUIREMENTS=$(if [ -f requirements/requirements_${EXTRA_TARGETS}.txt ]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_OUTPUT - - - uses: ansys/actions/_logging@main - if: ${{ inputs.skip-install == 'true' && inputs.use-uv-lockfile == 'true' && steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true' }} - with: - level: "ERROR" - message: > - ``use-uv-lockfile`` is enabled, but ``skip-install`` is also enabled and - a requirements file exists. Please, either use the lock file or the requirements - file, but not both. If you want to use the lock file, remove the requirements file - from the repository. If you want to use the requirements file, disable - ``use-uv-lockfile``. - - name: "Install dependencies from the requirements file" shell: bash if: ${{ (inputs.skip-install == 'true' ) && (steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true') }} From 33d926ebd7f25f473dae0350a2ca1b6f78204e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Wed, 29 Jul 2026 17:12:09 +0200 Subject: [PATCH 22/50] revert: change related to target to use --- build-wheelhouse/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 569c99d14..cd8691e1d 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -326,6 +326,7 @@ runs: env: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} INSTALL_TARGET: ${{ steps.specific-target-requested.outputs.install_target }} + TARGET: ${{ inputs.target }} USE_UV: ${{ inputs.use-uv }} USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} @@ -338,8 +339,8 @@ runs: if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install ${INSTALL_TARGET} elif [[ "${USE_UV}" == 'true' && "${USE_UV_LOCKFILE}" == 'true' ]]; then - if [[ "${INSTALL_TARGET}" != '' ]]; then - uv sync --frozen --extra "${INSTALL_TARGET}" --no-dev + if [[ "${TARGET}" != '' ]]; then + uv sync --frozen --extra "${TARGET}" --no-dev else uv sync --frozen --no-dev fi From 0c8b58ce51d3a15510c6e0a7f678764b73da4933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Fri, 31 Jul 2026 11:33:42 +0200 Subject: [PATCH 23/50] refactor: add autodetect lockfile for v11 --- build-library/action.yml | 23 +++++--------- build-wheelhouse/action.yml | 23 +++++--------- check-vulnerabilities/action.yml | 52 +++++++++++--------------------- code-style/action.yml | 21 +++++-------- 4 files changed, 40 insertions(+), 79 deletions(-) diff --git a/build-library/action.yml b/build-library/action.yml index 22661f5bb..8fab2053e 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -180,28 +180,21 @@ runs: # Install package by leveraging uv lockfile if requested and available # ------------------------------------------------------------------------ - - name: "Validate uv lockfile existence" - id: validate-uv-lockfile - if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} + - name: "Auto-detect uv lockfile" + id: auto-detect-uv-lockfile + if: ${{ inputs.use-uv == 'true' }} shell: bash env: WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | - if [[ ! -f "${WORKING_DIRECTORY}/uv.lock" ]]; then - echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + if [[ -f "${WORKING_DIRECTORY}/uv.lock" ]]; then + echo "USE_UV_LOCKFILE=true" >> ${GITHUB_OUTPUT} else - echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + echo "USE_UV_LOCKFILE=false" >> ${GITHUB_OUTPUT} fi - - uses: ansys/actions/_logging@main - if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} - with: - level: "ERROR" - message: > - uv lockfile (uv.lock) not found in ${{ inputs.working-directory }} - - name: "Install dependencies from uv lockfile" - if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} + if: ${{ inputs.use-uv == 'true' && steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE == 'true' }} shell: bash env: WORKING_DIRECTORY: ${{ inputs.working-directory }} @@ -214,7 +207,7 @@ runs: # ------------------------------------------------------------------------ - name: "Install library" - if: ${{ inputs.use-uv != 'true' || inputs.use-uv-lockfile != 'true' }} + if: ${{ inputs.use-uv != 'true' || steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE != 'true' }} shell: bash env: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python --system' || 'python -m pip install' }} diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index cd8691e1d..09d83d65f 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -302,33 +302,26 @@ runs: python -m pip install -U pip fi - - name: "Validate uv lockfile existence" - id: validate-uv-lockfile - if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} + - name: "Auto-detect uv lockfile" + id: auto-detect-uv-lockfile + if: ${{ inputs.use-uv == 'true' }} shell: bash env: WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | - if [[ ! -f "${WORKING_DIRECTORY}/uv.lock" ]]; then - echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + if [[ -f "${WORKING_DIRECTORY}/uv.lock" ]]; then + echo "USE_UV_LOCKFILE=true" >> ${GITHUB_OUTPUT} else - echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + echo "USE_UV_LOCKFILE=false" >> ${GITHUB_OUTPUT} fi - - uses: ansys/actions/_logging@main - if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} - with: - level: "ERROR" - message: > - uv lockfile (uv.lock) not found in repository root - - name: "Install the library with the desired targets" env: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} INSTALL_TARGET: ${{ steps.specific-target-requested.outputs.install_target }} TARGET: ${{ inputs.target }} USE_UV: ${{ inputs.use-uv }} - USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} + USE_UV_LOCKFILE: ${{ steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} BUILD_BACKEND: ${{ steps.build-system.outputs.BUILD_BACKEND }} WORKING_DIRECTORY: ${{ inputs.working-directory }} @@ -452,7 +445,7 @@ runs: BUILD_BACKEND: ${{ steps.build-system.outputs.BUILD_BACKEND }} INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} USE_UV: ${{ inputs.use-uv }} - USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} + USE_UV_LOCKFILE: ${{ steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE }} run: | ${ACTIVATE_VENV} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then diff --git a/check-vulnerabilities/action.yml b/check-vulnerabilities/action.yml index a4cbcccd5..97cb50d80 100644 --- a/check-vulnerabilities/action.yml +++ b/check-vulnerabilities/action.yml @@ -219,17 +219,7 @@ inputs: required: false type: boolean - use-uv-lockfile: - description: | - Whether to use a uv lockfile when installing dependencies. - - .. note:: - This option is only applicable when ``use-uv`` is set to ``true``. If - ``use-uv`` is set to ``false``, this option is ignored. - default: false - required: false - type: boolean runs: using: "composite" @@ -261,6 +251,17 @@ runs: repository: ${{ inputs.repo-full-name == '' && github.repository || inputs.repo-full-name }} persist-credentials: false + - name: "Auto-detect uv lockfile" + id: auto-detect-uv-lockfile + if: ${{ inputs.use-uv == 'true' }} + shell: bash + run: | + if [[ -f "uv.lock" ]]; then + echo "USE_UV_LOCKFILE=true" >> ${GITHUB_OUTPUT} + else + echo "USE_UV_LOCKFILE=false" >> ${GITHUB_OUTPUT} + fi + # ------------------------------------------------------------------------ - name: "Check if requirements.txt file exists" @@ -273,15 +274,14 @@ runs: echo "EXISTS_REQUIREMENTS=$(if [ -f requirements/requirements_${EXTRA_TARGETS}.txt ]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_OUTPUT - uses: ansys/actions/_logging@main - if: ${{ inputs.skip-install == 'true' && inputs.use-uv-lockfile == 'true' && steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true' }} + if: ${{ inputs.skip-install == 'true' && steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE == 'true' && steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true' }} with: level: "ERROR" message: > - ``use-uv-lockfile`` is enabled, but ``skip-install`` is also enabled and + A uv.lock file was detected, but ``skip-install`` is also enabled and a requirements file exists. Please, either use the lock file or the requirements file, but not both. If you want to use the lock file, remove the requirements file - from the repository. If you want to use the requirements file, disable - ``use-uv-lockfile``. + from the repository. If you want to use the requirements file, remove uv.lock. # ------------------------------------------------------------------------ @@ -311,24 +311,6 @@ runs: message: > Build backend: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} - - name: "Validate uv lockfile existence" - id: validate-uv-lockfile - if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' && inputs.skip-install == 'false' }} - shell: bash - run: | - if [[ ! -f "uv.lock" ]]; then - echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} - else - echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} - fi - - - uses: ansys/actions/_logging@main - if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} - with: - level: "ERROR" - message: > - uv lockfile (uv.lock) not found in repository root - # ------------------------------------------------------------------------ - uses: ansys/actions/_logging@main @@ -428,7 +410,7 @@ runs: BUILD_BACKEND: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} EXTRA_TARGETS: ${{ inputs.extra-targets }} - USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} + USE_UV_LOCKFILE: ${{ steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE }} # Note: we need to use an array to store the extra targets, otherwise # the shell expansion messes with the quotes in the poetry case. run: | @@ -450,7 +432,7 @@ runs: if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install --extras "${extra_targets}" elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then - if [[ ${USE_UV_LOCKFILE}" == 'true' ]]; then + if [[ "${USE_UV_LOCKFILE}" == 'true' ]]; then if [[ "${EXTRA_TARGETS}" != '' ]]; then uv sync --frozen --extra "${EXTRA_TARGETS}" --no-dev else @@ -595,7 +577,7 @@ runs: # Run safety vulnerability checks and strip safety scan deprecation notes from the output safety check -o bare --save-json info_safety.json --continue-on-error --policy-file "${SAFETY_POLICY_FILE}" -r "${GITHUB_ACTION_PATH}/requirements-for-safety.txt" 2>&1 \ - | grep -v -E '^\+==|^$|DEPRECATED:.*has been DEPRECATED|encourage switching to the new' + | grep -v -E '^\+==|^$|DEPRECATED:.*has been DEPRECATED|encourage switching to the new|.*AuthlibDeprecationWarning:.*|^It will be compatible before version 2\.0\.0\.$|^[[:space:]]+from authlib\.jose import jwt$' - uses: ansys/actions/_logging@main with: diff --git a/code-style/action.yml b/code-style/action.yml index 20b883797..368921cb6 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -267,24 +267,17 @@ runs: # ------------------------------------------------------------------------ - - name: "Validate uv lockfile existence" - id: validate-uv-lockfile - if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' && inputs.skip-install == 'false' }} + - name: "Auto-detect uv lockfile" + id: auto-detect-uv-lockfile + if: ${{ inputs.use-uv == 'true' }} shell: bash run: | - if [[ ! -f "uv.lock" ]]; then - echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + if [[ -f "uv.lock" ]]; then + echo "USE_UV_LOCKFILE=true" >> ${GITHUB_OUTPUT} else - echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + echo "USE_UV_LOCKFILE=false" >> ${GITHUB_OUTPUT} fi - - uses: ansys/actions/_logging@main - if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} - with: - level: "ERROR" - message: > - uv lockfile (uv.lock) not found in repository root - - name: "Update pip" shell: bash env: @@ -304,7 +297,7 @@ runs: env: BUILD_BACKEND: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} - USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} + USE_UV_LOCKFILE: ${{ steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE }} run: | ${ACTIVATE_VENV} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then From e6e7568a4e21336a85c0bb258a7b15289ba08f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Fri, 31 Jul 2026 11:43:36 +0200 Subject: [PATCH 24/50] ci: revert changes --- .github/workflows/ci_cd_pr.yml | 1 - .github/workflows/ci_cd_pr_flit.yml | 11 +++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 0764825de..59c1d931f 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -124,7 +124,6 @@ jobs: python-version: ${{ env.MAIN_PYTHON_VERSION }} use-python-cache: false checkout: false - skip-install: false type-check: name: Type check with Ty diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index bfdc00461..a0b46d8b3 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -87,7 +87,7 @@ jobs: test-build-library-flit: name: "Test build-library action (use-uv: ${{ matrix.use-uv }}) using ansys-actions-flit package" runs-on: ubuntu-latest - # needs: test-build-wheelhouse-flit + needs: test-build-wheelhouse-flit strategy: matrix: use-uv: ['true', 'false'] @@ -173,12 +173,11 @@ jobs: operating-system: ${{ matrix.os }} python-version: ${{ env.MAIN_PYTHON_VERSION }} attest-provenance: true - use-uv-lockfile: ${{ matrix.repository.name == 'pyansys-geometry' }} - use-uv: ${{ matrix.repository.name == 'pyansys-geometry' }} test-build-library-flit-projects: name: "Test build-library action for ${{ matrix.repository.name }} project" runs-on: ubuntu-latest + needs: test-build-wheelhouse-flit-projects strategy: matrix: repository: @@ -196,6 +195,7 @@ jobs: contents: read attestations: write # Needed for provenance attestation steps: + - name: "Install Git and clone ${{ matrix.repository.name }} repository" uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: @@ -216,8 +216,6 @@ jobs: library-name: ${{ matrix.repository.library }} python-version: ${{ env.MAIN_PYTHON_VERSION }} attest-provenance: true - use-uv-lockfile: ${{ matrix.repository.name == 'pyansys-geometry' }} - use-uv: ${{ matrix.repository.name == 'pyansys-geometry' }} test-check-licenses-flit-projects: name: "Test check-licenses action for ${{ matrix.repository.name }} project" @@ -293,9 +291,6 @@ jobs: use-python-cache: false use-prek: ${{ matrix.use-prek }} checkout: false - use-uv-lockfile: ${{ matrix.repository.name == 'pyansys-geometry' }} - use-uv: ${{ matrix.repository.name == 'pyansys-geometry' }} - skip-install: false test-doc-style-flit-projects: name: "Test doc-style action for ${{ matrix.repository.name }} project" From f0a8bbcc7ddd5bc434678d989be8e6d4fae7ff00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Sat, 25 Jul 2026 08:54:41 +0200 Subject: [PATCH 25/50] feat: use uv lock file --- build-library/action.yml | 24 ++++++++++++- build-wheelhouse/action.yml | 24 +++++++++++++ check-vulnerabilities/action.yml | 62 ++++++++++++++++++++++++-------- code-style/action.yml | 27 ++++++++++++-- 4 files changed, 119 insertions(+), 18 deletions(-) diff --git a/build-library/action.yml b/build-library/action.yml index 85e93a6bc..2ff2afe31 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -121,6 +121,18 @@ inputs: required: false type: boolean + use-uv-lockfile: + description: | + Whether to use a uv lockfile when installing dependencies. + + .. note:: + + This option is only applicable when ``use-uv`` is set to ``true``. If + ``use-uv`` is set to ``false``, this option is ignored. + default: false + required: false + type: boolean + skip-python-setup: description: | Whether to skip the Python setup step performed by @@ -164,10 +176,20 @@ runs: message: > Skipping Python setup to use system Python. + - name: "Install dependencies from lockfile" + if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} + shell: bash + env: + WORKING_DIRECTORY: ${{ inputs.working-directory }} + run: | + cd ${WORKING_DIRECTORY} + uv export --frozen --no-emit-project --no-hashes -o /tmp/requirements-locked.txt + uv pip install --no-managed-python --system -r /tmp/requirements-locked.txt + - name: "Install library" shell: bash env: - INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python --system' || 'python -m pip install' }} + INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' && 'uv pip install --no-managed-python --system --no-deps' || inputs.use-uv == 'true' && 'uv pip install --no-managed-python --system' || 'python -m pip install' }} WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | ${INSTALL_COMMAND} ${WORKING_DIRECTORY} diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 9bf5bff48..59aef06e0 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -149,6 +149,18 @@ inputs: required: false type: boolean + use-uv-lockfile: + description: | + Whether to use a uv lockfile when installing dependencies. + + .. note:: + + This option is only applicable when ``use-uv`` is set to ``true``. If + ``use-uv`` is set to ``false``, this option is ignored. + default: false + required: false + type: boolean + skip-python-setup: description: | Whether to skip the Python setup step performed by @@ -410,6 +422,9 @@ runs: ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} BUILD_BACKEND: ${{ steps.build-system.outputs.BUILD_BACKEND }} INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} + USE_UV: ${{ inputs.use-uv }} + USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} + WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | ${ACTIVATE_VENV} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then @@ -417,6 +432,10 @@ runs: poetry add "${line//\'/\"}" --lock done poetry install + elif [[ "${USE_UV}" == 'true' ]] && [[ "${USE_UV_LOCKFILE}" == 'true' ]]; then + cd ${WORKING_DIRECTORY} + uv add --group ansys-actions -r "${GITHUB_ACTION_PATH}/requirements.txt" + uv sync --frozen --group ansys-actions --no-dev --no-install-project else $INSTALL_COMMAND -r ${GITHUB_ACTION_PATH}/requirements.txt fi @@ -429,12 +448,17 @@ runs: INSTALL_TARGET: ${{ steps.specific-target-requested.outputs.install_target }} WORKING_DIRECTORY: ${{ inputs.working-directory }} GITHUB_WORKSPACE: ${{ github.workspace }} + USE_UV: ${{ inputs.use-uv }} + USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} run: | ${ACTIVATE_VENV} cd ${WORKING_DIRECTORY} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry export --without-hashes --format=requirements.txt --output=wheel_reqs.txt pip wheel -w ${GITHUB_WORKSPACE}/wheelhouse -r wheel_reqs.txt + elif [[ "${USE_UV}" == 'true' && "${USE_UV_LOCKFILE}" == 'true' ]]; then + uv export --frozen --no-emit-project --no-hashes -o wheel_reqs.txt + python -m pip wheel -w ${GITHUB_WORKSPACE}/wheelhouse -r wheel_reqs.txt else python -m pip wheel "${INSTALL_TARGET}" -w ${GITHUB_WORKSPACE}/wheelhouse fi diff --git a/check-vulnerabilities/action.yml b/check-vulnerabilities/action.yml index 1ef6689d8..c4dee4538 100644 --- a/check-vulnerabilities/action.yml +++ b/check-vulnerabilities/action.yml @@ -219,6 +219,18 @@ inputs: required: false type: boolean + use-uv-lockfile: + description: | + Whether to use a uv lockfile when installing dependencies. + + .. note:: + + This option is only applicable when ``use-uv`` is set to ``true``. If + ``use-uv`` is set to ``false``, this option is ignored. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -376,29 +388,38 @@ runs: BUILD_BACKEND: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} EXTRA_TARGETS: ${{ inputs.extra-targets }} + USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} # Note: we need to use an array to store the extra targets, otherwise # the shell expansion messes with the quotes in the poetry case. run: | ${ACTIVATE_VENV} - if [[ "${EXTRA_TARGETS}" != '' ]]; then - if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then - echo "Installing extra targets with poetry: ${EXTRA_TARGETS}" - extra_targets=${EXTRA_TARGETS} + if [[ "${USE_UV_LOCKFILE}" == 'true' && "${BUILD_BACKEND}" == 'uv' ]]; then + if [[ "${EXTRA_TARGETS}" != '' ]]; then + uv sync --frozen --extra "${EXTRA_TARGETS}" --no-dev else - echo "Installing extra targets with pip: ${EXTRA_TARGETS}" - extra_targets=[${EXTRA_TARGETS}] + uv sync --frozen --no-dev fi else - echo "No extra targets to install" - extra_targets="" - fi + if [[ "${EXTRA_TARGETS}" != '' ]]; then + if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then + echo "Installing extra targets with poetry: ${EXTRA_TARGETS}" + extra_targets=${EXTRA_TARGETS} + else + echo "Installing extra targets with pip: ${EXTRA_TARGETS}" + extra_targets=[${EXTRA_TARGETS}] + fi + else + echo "No extra targets to install" + extra_targets="" + fi - if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then - poetry install --extras "${extra_targets}" - elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then - uv pip install ."${extra_targets}" - else - python -m pip install ."${extra_targets}" + if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then + poetry install --extras "${extra_targets}" + elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then + uv pip install ."${extra_targets}" + else + python -m pip install ."${extra_targets}" + fi fi - name: "Check if requirements.txt file exists" @@ -410,6 +431,17 @@ runs: run: | echo "EXISTS_REQUIREMENTS=$(if [ -f requirements/requirements_${EXTRA_TARGETS}.txt ]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_OUTPUT + - uses: ansys/actions/_logging@main + if: ${{ inputs.skip-install == 'true' && inputs.use-uv-lockfile == 'true' && steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true' }} + with: + level: "ERROR" + message: > + ``use-uv-lockfile`` is enabled, but ``skip-install`` is also enabled and + a requirements file exists. Please, either use the lock file or the requirements + file, but not both. If you want to use the lock file, remove the requirements file + from the repository. If you want to use the requirements file, disable + ``use-uv-lockfile``. + - name: "Install dependencies from the requirements file" shell: bash if: ${{ (inputs.skip-install == 'true' ) && (steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true') }} diff --git a/code-style/action.yml b/code-style/action.yml index 8c3beee3d..ae7528220 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -131,6 +131,18 @@ inputs: required: false type: boolean + use-uv-lockfile: + description: | + Whether to use a uv lockfile when installing dependencies. + + .. note:: + + This option is only applicable when ``use-uv`` is set to ``true`` and + ``skip-install`` is set to ``false``. Otherwise, this option is ignored. + default: false + required: false + type: boolean + checkout: description: | Whether to do a checkout step or not. If ``true``, the checkout step is performed. @@ -274,12 +286,17 @@ runs: env: BUILD_BACKEND: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} + USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} run: | ${ACTIVATE_VENV} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then - uv pip install . + if [[ "${USE_UV_LOCKFILE}" == 'true' ]]; then + uv sync --frozen --no-dev + else + uv pip install . + fi else python -m pip install . fi @@ -291,6 +308,7 @@ runs: BUILD_BACKEND: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} SKIP_INSTALL: ${{ inputs.skip-install }} USE_PREK: ${{ inputs.use-prek }} + USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} run: | ${ACTIVATE_VENV} if [[ "${USE_PREK}" == 'true' ]]; then @@ -304,7 +322,12 @@ runs: done poetry install elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then - uv pip install -r ${REQUIREMENTS_FILE} + if [[ "${USE_UV_LOCKFILE}" == 'true' ]] && [[ "${SKIP_INSTALL}" == 'false' ]]; then + uv add --group ansys-actions -r "${REQUIREMENTS_FILE}" + uv sync --frozen --group ansys-actions --no-dev --no-install-project + else + uv pip install -r ${REQUIREMENTS_FILE} + fi else pip install -r ${REQUIREMENTS_FILE} fi From 6b8bec47f67bc82f9a667493bf151b92b510d8a4 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Sat, 25 Jul 2026 06:57:45 +0000 Subject: [PATCH 26/50] chore: adding changelog file 1427.added.md [dependabot-skip] --- doc/source/changelog/1427.added.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/source/changelog/1427.added.md diff --git a/doc/source/changelog/1427.added.md b/doc/source/changelog/1427.added.md new file mode 100644 index 000000000..0ec7cb0b1 --- /dev/null +++ b/doc/source/changelog/1427.added.md @@ -0,0 +1 @@ +Use uv lock file From 34a57b28bc62b5cd4fd9ebb85f52b6715872bf29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Sat, 25 Jul 2026 18:41:36 +0200 Subject: [PATCH 27/50] wip: test PR --- .github/workflows/ci_cd_pr.yml | 2 ++ .github/workflows/ci_cd_pr_flit.yml | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 550cd4f82..7b538a75e 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -124,6 +124,8 @@ jobs: python-version: ${{ env.MAIN_PYTHON_VERSION }} use-python-cache: false checkout: false + use-uv: true + use-uv-lockfile: true type-check: name: Type check with Ty diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index a3677d0d9..d44809d11 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -83,6 +83,8 @@ jobs: working-directory: .ci/${{ env.LIBRARY_NAME }} attest-provenance: true checkout: false + use-uv: true + use-uv-lockfile: true test-build-library-flit: name: "Test build-library action (use-uv: ${{ matrix.use-uv }}) using ansys-actions-flit package" @@ -111,6 +113,7 @@ jobs: working-directory: .ci/${{ env.LIBRARY_NAME }} use-uv: ${{ matrix.use-uv }} checkout: false + use-uv-lockfile: ${{ matrix.use-uv }} test-release-flit: name: "Test releasing ansys-actions-flit package to local devpi server" @@ -216,6 +219,8 @@ jobs: library-name: ${{ matrix.repository.library }} python-version: ${{ env.MAIN_PYTHON_VERSION }} attest-provenance: true + use-uv-lockfile: true + use-uv: true test-check-licenses-flit-projects: name: "Test check-licenses action for ${{ matrix.repository.name }} project" From 03a888cd225e9339a6c7e9c18091f6d6ff21832d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Sat, 25 Jul 2026 18:52:33 +0200 Subject: [PATCH 28/50] wip: add missing input --- .github/workflows/ci_cd_pr_flit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index d44809d11..92e9a0cf8 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -176,6 +176,8 @@ jobs: operating-system: ${{ matrix.os }} python-version: ${{ env.MAIN_PYTHON_VERSION }} attest-provenance: true + use-uv : true + use-uv-lockfile: true test-build-library-flit-projects: name: "Test build-library action for ${{ matrix.repository.name }} project" From 34e5438e5b0816188b2ccc70f649ebc5aedb9e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 12:33:45 +0200 Subject: [PATCH 29/50] refactor: add failing step when non uv lock file exists --- build-library/action.yml | 20 ++++++++++++++++++++ build-wheelhouse/action.yml | 18 ++++++++++++++++++ check-vulnerabilities/action.yml | 18 ++++++++++++++++++ code-style/action.yml | 18 ++++++++++++++++++ 4 files changed, 74 insertions(+) diff --git a/build-library/action.yml b/build-library/action.yml index 2ff2afe31..6ddf7b916 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -176,6 +176,26 @@ runs: message: > Skipping Python setup to use system Python. + - name: "Validate uv lockfile existence" + id: validate-uv-lockfile + if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} + shell: bash + env: + WORKING_DIRECTORY: ${{ inputs.working-directory }} + run: | + if [[ ! -f "${WORKING_DIRECTORY}/uv.lock" ]]; then + echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + else + echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + fi + + - uses: ansys/actions/_logging@main + if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} + with: + level: "ERROR" + message: > + uv lockfile (uv.lock) not found in ${{ inputs.working-directory }} + - name: "Install dependencies from lockfile" if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} shell: bash diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 59aef06e0..5326405f3 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -302,6 +302,24 @@ runs: python -m pip install -U pip fi + - name: "Validate uv lockfile existence" + id: validate-uv-lockfile + if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} + shell: bash + run: | + if [[ ! -f "uv.lock" ]]; then + echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + else + echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + fi + + - uses: ansys/actions/_logging@main + if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} + with: + level: "ERROR" + message: > + uv lockfile (uv.lock) not found in repository root + - name: "Install the library with the desired targets" env: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} diff --git a/check-vulnerabilities/action.yml b/check-vulnerabilities/action.yml index c4dee4538..be3d048f1 100644 --- a/check-vulnerabilities/action.yml +++ b/check-vulnerabilities/action.yml @@ -289,6 +289,24 @@ runs: message: > Build backend: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} + - name: "Validate uv lockfile existence" + id: validate-uv-lockfile + if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' && inputs.skip-install == 'false' }} + shell: bash + run: | + if [[ ! -f "uv.lock" ]]; then + echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + else + echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + fi + + - uses: ansys/actions/_logging@main + if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} + with: + level: "ERROR" + message: > + uv lockfile (uv.lock) not found in repository root + # ------------------------------------------------------------------------ - uses: ansys/actions/_logging@main diff --git a/code-style/action.yml b/code-style/action.yml index ae7528220..c01e23a8d 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -267,6 +267,24 @@ runs: # ------------------------------------------------------------------------ + - name: "Validate uv lockfile existence" + id: validate-uv-lockfile + if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' && inputs.skip-install == 'false' }} + shell: bash + run: | + if [[ ! -f "uv.lock" ]]; then + echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + else + echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + fi + + - uses: ansys/actions/_logging@main + if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} + with: + level: "ERROR" + message: > + uv lockfile (uv.lock) not found in repository root + - name: "Update pip" shell: bash env: From ec2e5059310f019567bfef557f80fb2b16a9bb0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 12:42:17 +0200 Subject: [PATCH 30/50] ci: force code style with install --- .github/workflows/ci_cd_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 7b538a75e..1e82ae276 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -126,6 +126,7 @@ jobs: checkout: false use-uv: true use-uv-lockfile: true + skip-install: false type-check: name: Type check with Ty From 73f755dc62ef0ff676d14284afe5ab4b722b8ebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 14:08:55 +0200 Subject: [PATCH 31/50] fix: missing working directory when checking --- build-wheelhouse/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 5326405f3..2dc24e360 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -306,8 +306,10 @@ runs: id: validate-uv-lockfile if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} shell: bash + env: + WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | - if [[ ! -f "uv.lock" ]]; then + if [[ ! -f "${WORKING_DIRECTORY}/uv.lock" ]]; then echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} else echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} From 340ce440a842ab9a904042a0ecb2e69f92673ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 14:17:28 +0200 Subject: [PATCH 32/50] ci: update to trigger jobs --- .github/workflows/ci_cd_pr_flit.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index 92e9a0cf8..8a8d980d1 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -89,7 +89,7 @@ jobs: test-build-library-flit: name: "Test build-library action (use-uv: ${{ matrix.use-uv }}) using ansys-actions-flit package" runs-on: ubuntu-latest - needs: test-build-wheelhouse-flit + # needs: test-build-wheelhouse-flit strategy: matrix: use-uv: ['true', 'false'] @@ -298,6 +298,8 @@ jobs: use-python-cache: false use-prek: ${{ matrix.use-prek }} checkout: false + use-uv: true + use-uv-lockfile: true test-doc-style-flit-projects: name: "Test doc-style action for ${{ matrix.repository.name }} project" From 079a7c4bed3e71dcf6feb30c3a3b6f234d281653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 14:27:30 +0200 Subject: [PATCH 33/50] ci: update to trigger jobs --- .github/workflows/ci_cd_pr_flit.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index 8a8d980d1..28df3bc88 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -182,7 +182,6 @@ jobs: test-build-library-flit-projects: name: "Test build-library action for ${{ matrix.repository.name }} project" runs-on: ubuntu-latest - needs: test-build-wheelhouse-flit-projects strategy: matrix: repository: @@ -200,7 +199,6 @@ jobs: contents: read attestations: write # Needed for provenance attestation steps: - - name: "Install Git and clone ${{ matrix.repository.name }} repository" uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: From 6b4e3f64e34122c42a76434dc0e29c5ef9086bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 15:42:19 +0200 Subject: [PATCH 34/50] ci: add missed input to trigger uv lock install --- .github/workflows/ci_cd_pr_flit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index 28df3bc88..42bb27f41 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -298,6 +298,7 @@ jobs: checkout: false use-uv: true use-uv-lockfile: true + skip-install: false test-doc-style-flit-projects: name: "Test doc-style action for ${{ matrix.repository.name }} project" From ed932684fd04de0859621f5826d4b8c93385eda8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 17:35:48 +0200 Subject: [PATCH 35/50] refactor: do not use add group to not break hooks --- code-style/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code-style/action.yml b/code-style/action.yml index c01e23a8d..457fead0a 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -341,8 +341,7 @@ runs: poetry install elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then if [[ "${USE_UV_LOCKFILE}" == 'true' ]] && [[ "${SKIP_INSTALL}" == 'false' ]]; then - uv add --group ansys-actions -r "${REQUIREMENTS_FILE}" - uv sync --frozen --group ansys-actions --no-dev --no-install-project + uv pip install -r "${REQUIREMENTS_FILE}" else uv pip install -r ${REQUIREMENTS_FILE} fi From fbed0e310c6c1964ad48e71e0004fb595eb2312c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Mon, 27 Jul 2026 17:41:43 +0200 Subject: [PATCH 36/50] refactor: fix previous refactoring --- code-style/action.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/code-style/action.yml b/code-style/action.yml index 457fead0a..642fa4520 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -340,11 +340,7 @@ runs: done poetry install elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then - if [[ "${USE_UV_LOCKFILE}" == 'true' ]] && [[ "${SKIP_INSTALL}" == 'false' ]]; then - uv pip install -r "${REQUIREMENTS_FILE}" - else - uv pip install -r ${REQUIREMENTS_FILE} - fi + uv pip install -r ${REQUIREMENTS_FILE} else pip install -r ${REQUIREMENTS_FILE} fi From 41bd52fc0291e2c7af1110ff3ea87f5ae5bc1865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 08:34:13 +0200 Subject: [PATCH 37/50] fix: add missing step in build wheelhouse --- build-wheelhouse/action.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 2dc24e360..fd613f343 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -326,6 +326,9 @@ runs: env: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} INSTALL_TARGET: ${{ steps.specific-target-requested.outputs.install_target }} + TARGET: ${{ inputs.target }} + USE_UV: ${{ inputs.use-uv }} + USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} BUILD_BACKEND: ${{ steps.build-system.outputs.BUILD_BACKEND }} WORKING_DIRECTORY: ${{ inputs.working-directory }} @@ -335,6 +338,12 @@ runs: cd ${WORKING_DIRECTORY} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install ${INSTALL_TARGET} + elif [[ "${USE_UV}" == 'true' && "${USE_UV_LOCKFILE}" == 'true' ]]; then + if [[ "${TARGET}" != '' ]]; then + uv sync --frozen --extra "${TARGET}" --no-dev + else + uv sync --frozen --no-dev + fi else ${INSTALL_COMMAND} "${INSTALL_TARGET}" fi @@ -444,7 +453,6 @@ runs: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} USE_UV: ${{ inputs.use-uv }} USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} - WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | ${ACTIVATE_VENV} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then @@ -453,9 +461,7 @@ runs: done poetry install elif [[ "${USE_UV}" == 'true' ]] && [[ "${USE_UV_LOCKFILE}" == 'true' ]]; then - cd ${WORKING_DIRECTORY} - uv add --group ansys-actions -r "${GITHUB_ACTION_PATH}/requirements.txt" - uv sync --frozen --group ansys-actions --no-dev --no-install-project + uv pip install -r "${GITHUB_ACTION_PATH}/requirements.txt" else $INSTALL_COMMAND -r ${GITHUB_ACTION_PATH}/requirements.txt fi From 0c4ec2687bb946fbfd327ed9e3c4cc10abe71cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 16:28:18 +0200 Subject: [PATCH 38/50] refactor: keep uv logic to install only --- build-wheelhouse/action.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index fd613f343..ed64ceb76 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -474,17 +474,12 @@ runs: INSTALL_TARGET: ${{ steps.specific-target-requested.outputs.install_target }} WORKING_DIRECTORY: ${{ inputs.working-directory }} GITHUB_WORKSPACE: ${{ github.workspace }} - USE_UV: ${{ inputs.use-uv }} - USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} run: | ${ACTIVATE_VENV} cd ${WORKING_DIRECTORY} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry export --without-hashes --format=requirements.txt --output=wheel_reqs.txt pip wheel -w ${GITHUB_WORKSPACE}/wheelhouse -r wheel_reqs.txt - elif [[ "${USE_UV}" == 'true' && "${USE_UV_LOCKFILE}" == 'true' ]]; then - uv export --frozen --no-emit-project --no-hashes -o wheel_reqs.txt - python -m pip wheel -w ${GITHUB_WORKSPACE}/wheelhouse -r wheel_reqs.txt else python -m pip wheel "${INSTALL_TARGET}" -w ${GITHUB_WORKSPACE}/wheelhouse fi From 073c59d9c9449fd2b283b26e6450ee5a401d9742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 16:56:18 +0200 Subject: [PATCH 39/50] refactor: fix wrong logic --- build-library/action.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build-library/action.yml b/build-library/action.yml index 6ddf7b916..bab19701a 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -176,6 +176,10 @@ runs: message: > Skipping Python setup to use system Python. + # ------------------------------------------------------------------------ + # Leverage uv lockfile if requested and available + # ------------------------------------------------------------------------ + - name: "Validate uv lockfile existence" id: validate-uv-lockfile if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} @@ -196,7 +200,7 @@ runs: message: > uv lockfile (uv.lock) not found in ${{ inputs.working-directory }} - - name: "Install dependencies from lockfile" + - name: "Install dependencies from uv lockfile" if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} shell: bash env: @@ -207,9 +211,10 @@ runs: uv pip install --no-managed-python --system -r /tmp/requirements-locked.txt - name: "Install library" + if: ${{ inputs.use-uv != 'true' || inputs.use-uv-lockfile != 'true' }} shell: bash env: - INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' && 'uv pip install --no-managed-python --system --no-deps' || inputs.use-uv == 'true' && 'uv pip install --no-managed-python --system' || 'python -m pip install' }} + INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python --system' || 'python -m pip install' }} WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | ${INSTALL_COMMAND} ${WORKING_DIRECTORY} From fde43406e14f30691645a2415185a6197eed033d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 17:03:48 +0200 Subject: [PATCH 40/50] refactor: cleanup --- build-library/action.yml | 6 +++++- build-wheelhouse/action.yml | 2 -- check-vulnerabilities/action.yml | 5 ++++- code-style/action.yml | 1 - 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/build-library/action.yml b/build-library/action.yml index bab19701a..10228c376 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -177,7 +177,7 @@ runs: Skipping Python setup to use system Python. # ------------------------------------------------------------------------ - # Leverage uv lockfile if requested and available + # Install package by leveraging uv lockfile if requested and available # ------------------------------------------------------------------------ - name: "Validate uv lockfile existence" @@ -210,6 +210,10 @@ runs: uv export --frozen --no-emit-project --no-hashes -o /tmp/requirements-locked.txt uv pip install --no-managed-python --system -r /tmp/requirements-locked.txt + # ------------------------------------------------------------------------ + # Install package without leveraging uv lockfile + # ------------------------------------------------------------------------ + - name: "Install library" if: ${{ inputs.use-uv != 'true' || inputs.use-uv-lockfile != 'true' }} shell: bash diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index ed64ceb76..2d7004c54 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -460,8 +460,6 @@ runs: poetry add "${line//\'/\"}" --lock done poetry install - elif [[ "${USE_UV}" == 'true' ]] && [[ "${USE_UV_LOCKFILE}" == 'true' ]]; then - uv pip install -r "${GITHUB_ACTION_PATH}/requirements.txt" else $INSTALL_COMMAND -r ${GITHUB_ACTION_PATH}/requirements.txt fi diff --git a/check-vulnerabilities/action.yml b/check-vulnerabilities/action.yml index be3d048f1..5134b1093 100644 --- a/check-vulnerabilities/action.yml +++ b/check-vulnerabilities/action.yml @@ -411,13 +411,16 @@ runs: # the shell expansion messes with the quotes in the poetry case. run: | ${ACTIVATE_VENV} + # Use uv lockfile if requested and the build backend is uv if [[ "${USE_UV_LOCKFILE}" == 'true' && "${BUILD_BACKEND}" == 'uv' ]]; then if [[ "${EXTRA_TARGETS}" != '' ]]; then uv sync --frozen --extra "${EXTRA_TARGETS}" --no-dev else uv sync --frozen --no-dev fi + # Use other installation methods if uv lockfile is not requested or the build backend is not uv else + # 1. Define the extra targets to be installed based on the build backend and the provided input if [[ "${EXTRA_TARGETS}" != '' ]]; then if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then echo "Installing extra targets with poetry: ${EXTRA_TARGETS}" @@ -430,7 +433,7 @@ runs: echo "No extra targets to install" extra_targets="" fi - + # 2. Trigger the installation command based on the build backend if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install --extras "${extra_targets}" elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then diff --git a/code-style/action.yml b/code-style/action.yml index 642fa4520..a11fb8f83 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -326,7 +326,6 @@ runs: BUILD_BACKEND: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} SKIP_INSTALL: ${{ inputs.skip-install }} USE_PREK: ${{ inputs.use-prek }} - USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} run: | ${ACTIVATE_VENV} if [[ "${USE_PREK}" == 'true' ]]; then From 1e61b41f81bb2815701a9b342e0f8d5a1f834b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 18:12:59 +0200 Subject: [PATCH 41/50] fix: distribution folder handling when using uv without pip --- build-wheelhouse/smoke_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-wheelhouse/smoke_test.py b/build-wheelhouse/smoke_test.py index c7428f581..084b5462c 100644 --- a/build-wheelhouse/smoke_test.py +++ b/build-wheelhouse/smoke_test.py @@ -70,7 +70,7 @@ def find_module_from_dist(pkg_name: str, attr: str): if pth_file: source_code_folder = None # Read the .pth file to find the source code path - with Path(pth_file).open("r") as file: + with Path(dist.locate_file(pth_file)).open("r") as file: for line in file: # Check if the path is a valid directory path = Path(line.strip()) From ef444a6b82e79317d5d42b12b96099a8149265c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 18:33:38 +0200 Subject: [PATCH 42/50] ci: update to only test with geometry --- .github/workflows/ci_cd_pr.yml | 2 -- .github/workflows/ci_cd_pr_flit.yml | 14 ++++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 1e82ae276..e1a4bd799 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -124,8 +124,6 @@ jobs: python-version: ${{ env.MAIN_PYTHON_VERSION }} use-python-cache: false checkout: false - use-uv: true - use-uv-lockfile: true skip-install: false type-check: diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index 42bb27f41..3a232e144 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -83,8 +83,6 @@ jobs: working-directory: .ci/${{ env.LIBRARY_NAME }} attest-provenance: true checkout: false - use-uv: true - use-uv-lockfile: true test-build-library-flit: name: "Test build-library action (use-uv: ${{ matrix.use-uv }}) using ansys-actions-flit package" @@ -176,8 +174,8 @@ jobs: operating-system: ${{ matrix.os }} python-version: ${{ env.MAIN_PYTHON_VERSION }} attest-provenance: true - use-uv : true - use-uv-lockfile: true + use-uv-lockfile: ${{ matrix.repository.name == 'pyansys-geometry' }} + use-uv: ${{ matrix.repository.name == 'pyansys-geometry' }} test-build-library-flit-projects: name: "Test build-library action for ${{ matrix.repository.name }} project" @@ -219,8 +217,8 @@ jobs: library-name: ${{ matrix.repository.library }} python-version: ${{ env.MAIN_PYTHON_VERSION }} attest-provenance: true - use-uv-lockfile: true - use-uv: true + use-uv-lockfile: ${{ matrix.repository.name == 'pyansys-geometry' }} + use-uv: ${{ matrix.repository.name == 'pyansys-geometry' }} test-check-licenses-flit-projects: name: "Test check-licenses action for ${{ matrix.repository.name }} project" @@ -296,8 +294,8 @@ jobs: use-python-cache: false use-prek: ${{ matrix.use-prek }} checkout: false - use-uv: true - use-uv-lockfile: true + use-uv-lockfile: ${{ matrix.repository.name == 'pyansys-geometry' }} + use-uv: ${{ matrix.repository.name == 'pyansys-geometry' }} skip-install: false test-doc-style-flit-projects: From d5f5d7e6aaa2634fda532e78619beb63693dba37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Tue, 28 Jul 2026 18:38:26 +0200 Subject: [PATCH 43/50] refactor: update to fix type hint --- build-wheelhouse/smoke_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-wheelhouse/smoke_test.py b/build-wheelhouse/smoke_test.py index 084b5462c..e6ccaf960 100644 --- a/build-wheelhouse/smoke_test.py +++ b/build-wheelhouse/smoke_test.py @@ -70,7 +70,7 @@ def find_module_from_dist(pkg_name: str, attr: str): if pth_file: source_code_folder = None # Read the .pth file to find the source code path - with Path(dist.locate_file(pth_file)).open("r") as file: + with Path(str(dist.locate_file(pth_file))).open("r") as file: for line in file: # Check if the path is a valid directory path = Path(line.strip()) From 49cb03d29ff32de193e038d94ceb1cea351ff5b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Wed, 29 Jul 2026 09:26:12 +0200 Subject: [PATCH 44/50] ci: do not use lockfile on fake package --- .github/workflows/ci_cd_pr_flit.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index 3a232e144..b7cf28351 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -111,7 +111,6 @@ jobs: working-directory: .ci/${{ env.LIBRARY_NAME }} use-uv: ${{ matrix.use-uv }} checkout: false - use-uv-lockfile: ${{ matrix.use-uv }} test-release-flit: name: "Test releasing ansys-actions-flit package to local devpi server" From f9e67a9cc52b50e0dd0ae6bbadb1e6df0e38ed93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Wed, 29 Jul 2026 16:08:31 +0200 Subject: [PATCH 45/50] ci: update following review --- build-library/action.yml | 3 +- build-wheelhouse/action.yml | 5 +- check-vulnerabilities/action.yml | 84 ++++++++++++++++---------------- 3 files changed, 45 insertions(+), 47 deletions(-) diff --git a/build-library/action.yml b/build-library/action.yml index 10228c376..515ed4272 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -207,8 +207,7 @@ runs: WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | cd ${WORKING_DIRECTORY} - uv export --frozen --no-emit-project --no-hashes -o /tmp/requirements-locked.txt - uv pip install --no-managed-python --system -r /tmp/requirements-locked.txt + uv sync --frozen --no-managed-python # ------------------------------------------------------------------------ # Install package without leveraging uv lockfile diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 2d7004c54..2908dfe77 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -326,7 +326,6 @@ runs: env: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} INSTALL_TARGET: ${{ steps.specific-target-requested.outputs.install_target }} - TARGET: ${{ inputs.target }} USE_UV: ${{ inputs.use-uv }} USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} @@ -339,8 +338,8 @@ runs: if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install ${INSTALL_TARGET} elif [[ "${USE_UV}" == 'true' && "${USE_UV_LOCKFILE}" == 'true' ]]; then - if [[ "${TARGET}" != '' ]]; then - uv sync --frozen --extra "${TARGET}" --no-dev + if [[ "${INSTALL_TARGET}" != '' ]]; then + uv sync --frozen --extra "${INSTALL_TARGET}" --no-dev else uv sync --frozen --no-dev fi diff --git a/check-vulnerabilities/action.yml b/check-vulnerabilities/action.yml index 5134b1093..ad1cc5415 100644 --- a/check-vulnerabilities/action.yml +++ b/check-vulnerabilities/action.yml @@ -263,6 +263,28 @@ runs: # ------------------------------------------------------------------------ + - name: "Check if requirements.txt file exists" + id: check-exists-requirements-file + shell: bash + if: ${{ inputs.skip-install == 'true' }} + env: + EXTRA_TARGETS: ${{ inputs.extra-targets }} + run: | + echo "EXISTS_REQUIREMENTS=$(if [ -f requirements/requirements_${EXTRA_TARGETS}.txt ]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_OUTPUT + + - uses: ansys/actions/_logging@main + if: ${{ inputs.skip-install == 'true' && inputs.use-uv-lockfile == 'true' && steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true' }} + with: + level: "ERROR" + message: > + ``use-uv-lockfile`` is enabled, but ``skip-install`` is also enabled and + a requirements file exists. Please, either use the lock file or the requirements + file, but not both. If you want to use the lock file, remove the requirements file + from the repository. If you want to use the requirements file, disable + ``use-uv-lockfile``. + + # ------------------------------------------------------------------------ + - uses: ansys/actions/_logging@main with: level: "INFO" @@ -411,58 +433,36 @@ runs: # the shell expansion messes with the quotes in the poetry case. run: | ${ACTIVATE_VENV} - # Use uv lockfile if requested and the build backend is uv - if [[ "${USE_UV_LOCKFILE}" == 'true' && "${BUILD_BACKEND}" == 'uv' ]]; then - if [[ "${EXTRA_TARGETS}" != '' ]]; then - uv sync --frozen --extra "${EXTRA_TARGETS}" --no-dev + # 1. Define the extra targets to be installed based on the build backend and the provided input + if [[ "${EXTRA_TARGETS}" != '' ]]; then + if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then + echo "Installing extra targets with poetry: ${EXTRA_TARGETS}" + extra_targets=${EXTRA_TARGETS} else - uv sync --frozen --no-dev + echo "Installing extra targets with pip: ${EXTRA_TARGETS}" + extra_targets=[${EXTRA_TARGETS}] fi - # Use other installation methods if uv lockfile is not requested or the build backend is not uv else - # 1. Define the extra targets to be installed based on the build backend and the provided input - if [[ "${EXTRA_TARGETS}" != '' ]]; then - if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then - echo "Installing extra targets with poetry: ${EXTRA_TARGETS}" - extra_targets=${EXTRA_TARGETS} + echo "No extra targets to install" + extra_targets="" + fi + # 2. Trigger the installation command based on the build backend + if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then + poetry install --extras "${extra_targets}" + elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then + if [[ ${USE_UV_LOCKFILE}" == 'true' ]]; then + if [[ "${EXTRA_TARGETS}" != '' ]]; then + uv sync --frozen --extra "${EXTRA_TARGETS}" --no-dev else - echo "Installing extra targets with pip: ${EXTRA_TARGETS}" - extra_targets=[${EXTRA_TARGETS}] + uv sync --frozen --no-dev fi else - echo "No extra targets to install" - extra_targets="" - fi - # 2. Trigger the installation command based on the build backend - if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then - poetry install --extras "${extra_targets}" - elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then uv pip install ."${extra_targets}" - else - python -m pip install ."${extra_targets}" fi + else + python -m pip install ."${extra_targets}" fi - - name: "Check if requirements.txt file exists" - id: check-exists-requirements-file - shell: bash - if: ${{ inputs.skip-install == 'true' }} - env: - EXTRA_TARGETS: ${{ inputs.extra-targets }} - run: | - echo "EXISTS_REQUIREMENTS=$(if [ -f requirements/requirements_${EXTRA_TARGETS}.txt ]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_OUTPUT - - - uses: ansys/actions/_logging@main - if: ${{ inputs.skip-install == 'true' && inputs.use-uv-lockfile == 'true' && steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true' }} - with: - level: "ERROR" - message: > - ``use-uv-lockfile`` is enabled, but ``skip-install`` is also enabled and - a requirements file exists. Please, either use the lock file or the requirements - file, but not both. If you want to use the lock file, remove the requirements file - from the repository. If you want to use the requirements file, disable - ``use-uv-lockfile``. - - name: "Install dependencies from the requirements file" shell: bash if: ${{ (inputs.skip-install == 'true' ) && (steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true') }} From 3f38cdc024e70beaf9a2f595f07615a289b3eea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Wed, 29 Jul 2026 17:12:09 +0200 Subject: [PATCH 46/50] revert: change related to target to use --- build-wheelhouse/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 2908dfe77..2d7004c54 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -326,6 +326,7 @@ runs: env: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} INSTALL_TARGET: ${{ steps.specific-target-requested.outputs.install_target }} + TARGET: ${{ inputs.target }} USE_UV: ${{ inputs.use-uv }} USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} @@ -338,8 +339,8 @@ runs: if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install ${INSTALL_TARGET} elif [[ "${USE_UV}" == 'true' && "${USE_UV_LOCKFILE}" == 'true' ]]; then - if [[ "${INSTALL_TARGET}" != '' ]]; then - uv sync --frozen --extra "${INSTALL_TARGET}" --no-dev + if [[ "${TARGET}" != '' ]]; then + uv sync --frozen --extra "${TARGET}" --no-dev else uv sync --frozen --no-dev fi From 3aa9a74e74c8a70ba8b3d0bcc184afb222f6fa4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Fri, 31 Jul 2026 11:33:42 +0200 Subject: [PATCH 47/50] refactor: add autodetect lockfile for v11 --- build-library/action.yml | 23 +++++--------- build-wheelhouse/action.yml | 23 +++++--------- check-vulnerabilities/action.yml | 52 +++++++++++--------------------- code-style/action.yml | 21 +++++-------- 4 files changed, 40 insertions(+), 79 deletions(-) diff --git a/build-library/action.yml b/build-library/action.yml index 515ed4272..218a09f05 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -180,28 +180,21 @@ runs: # Install package by leveraging uv lockfile if requested and available # ------------------------------------------------------------------------ - - name: "Validate uv lockfile existence" - id: validate-uv-lockfile - if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} + - name: "Auto-detect uv lockfile" + id: auto-detect-uv-lockfile + if: ${{ inputs.use-uv == 'true' }} shell: bash env: WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | - if [[ ! -f "${WORKING_DIRECTORY}/uv.lock" ]]; then - echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + if [[ -f "${WORKING_DIRECTORY}/uv.lock" ]]; then + echo "USE_UV_LOCKFILE=true" >> ${GITHUB_OUTPUT} else - echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + echo "USE_UV_LOCKFILE=false" >> ${GITHUB_OUTPUT} fi - - uses: ansys/actions/_logging@main - if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} - with: - level: "ERROR" - message: > - uv lockfile (uv.lock) not found in ${{ inputs.working-directory }} - - name: "Install dependencies from uv lockfile" - if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} + if: ${{ inputs.use-uv == 'true' && steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE == 'true' }} shell: bash env: WORKING_DIRECTORY: ${{ inputs.working-directory }} @@ -214,7 +207,7 @@ runs: # ------------------------------------------------------------------------ - name: "Install library" - if: ${{ inputs.use-uv != 'true' || inputs.use-uv-lockfile != 'true' }} + if: ${{ inputs.use-uv != 'true' || steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE != 'true' }} shell: bash env: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python --system' || 'python -m pip install' }} diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 2d7004c54..a32d80069 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -302,33 +302,26 @@ runs: python -m pip install -U pip fi - - name: "Validate uv lockfile existence" - id: validate-uv-lockfile - if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' }} + - name: "Auto-detect uv lockfile" + id: auto-detect-uv-lockfile + if: ${{ inputs.use-uv == 'true' }} shell: bash env: WORKING_DIRECTORY: ${{ inputs.working-directory }} run: | - if [[ ! -f "${WORKING_DIRECTORY}/uv.lock" ]]; then - echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + if [[ -f "${WORKING_DIRECTORY}/uv.lock" ]]; then + echo "USE_UV_LOCKFILE=true" >> ${GITHUB_OUTPUT} else - echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + echo "USE_UV_LOCKFILE=false" >> ${GITHUB_OUTPUT} fi - - uses: ansys/actions/_logging@main - if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} - with: - level: "ERROR" - message: > - uv lockfile (uv.lock) not found in repository root - - name: "Install the library with the desired targets" env: INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} INSTALL_TARGET: ${{ steps.specific-target-requested.outputs.install_target }} TARGET: ${{ inputs.target }} USE_UV: ${{ inputs.use-uv }} - USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} + USE_UV_LOCKFILE: ${{ steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} BUILD_BACKEND: ${{ steps.build-system.outputs.BUILD_BACKEND }} WORKING_DIRECTORY: ${{ inputs.working-directory }} @@ -452,7 +445,7 @@ runs: BUILD_BACKEND: ${{ steps.build-system.outputs.BUILD_BACKEND }} INSTALL_COMMAND: ${{ inputs.use-uv == 'true' && 'uv pip install --no-managed-python' || 'python -m pip install' }} USE_UV: ${{ inputs.use-uv }} - USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} + USE_UV_LOCKFILE: ${{ steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE }} run: | ${ACTIVATE_VENV} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then diff --git a/check-vulnerabilities/action.yml b/check-vulnerabilities/action.yml index ad1cc5415..fabc972bc 100644 --- a/check-vulnerabilities/action.yml +++ b/check-vulnerabilities/action.yml @@ -219,17 +219,7 @@ inputs: required: false type: boolean - use-uv-lockfile: - description: | - Whether to use a uv lockfile when installing dependencies. - - .. note:: - This option is only applicable when ``use-uv`` is set to ``true``. If - ``use-uv`` is set to ``false``, this option is ignored. - default: false - required: false - type: boolean runs: using: "composite" @@ -261,6 +251,17 @@ runs: repository: ${{ inputs.repo-full-name == '' && github.repository || inputs.repo-full-name }} persist-credentials: false + - name: "Auto-detect uv lockfile" + id: auto-detect-uv-lockfile + if: ${{ inputs.use-uv == 'true' }} + shell: bash + run: | + if [[ -f "uv.lock" ]]; then + echo "USE_UV_LOCKFILE=true" >> ${GITHUB_OUTPUT} + else + echo "USE_UV_LOCKFILE=false" >> ${GITHUB_OUTPUT} + fi + # ------------------------------------------------------------------------ - name: "Check if requirements.txt file exists" @@ -273,15 +274,14 @@ runs: echo "EXISTS_REQUIREMENTS=$(if [ -f requirements/requirements_${EXTRA_TARGETS}.txt ]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_OUTPUT - uses: ansys/actions/_logging@main - if: ${{ inputs.skip-install == 'true' && inputs.use-uv-lockfile == 'true' && steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true' }} + if: ${{ inputs.skip-install == 'true' && steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE == 'true' && steps.check-exists-requirements-file.outputs.EXISTS_REQUIREMENTS == 'true' }} with: level: "ERROR" message: > - ``use-uv-lockfile`` is enabled, but ``skip-install`` is also enabled and + A uv.lock file was detected, but ``skip-install`` is also enabled and a requirements file exists. Please, either use the lock file or the requirements file, but not both. If you want to use the lock file, remove the requirements file - from the repository. If you want to use the requirements file, disable - ``use-uv-lockfile``. + from the repository. If you want to use the requirements file, remove uv.lock. # ------------------------------------------------------------------------ @@ -311,24 +311,6 @@ runs: message: > Build backend: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} - - name: "Validate uv lockfile existence" - id: validate-uv-lockfile - if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' && inputs.skip-install == 'false' }} - shell: bash - run: | - if [[ ! -f "uv.lock" ]]; then - echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} - else - echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} - fi - - - uses: ansys/actions/_logging@main - if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} - with: - level: "ERROR" - message: > - uv lockfile (uv.lock) not found in repository root - # ------------------------------------------------------------------------ - uses: ansys/actions/_logging@main @@ -428,7 +410,7 @@ runs: BUILD_BACKEND: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} EXTRA_TARGETS: ${{ inputs.extra-targets }} - USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} + USE_UV_LOCKFILE: ${{ steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE }} # Note: we need to use an array to store the extra targets, otherwise # the shell expansion messes with the quotes in the poetry case. run: | @@ -450,7 +432,7 @@ runs: if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install --extras "${extra_targets}" elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then - if [[ ${USE_UV_LOCKFILE}" == 'true' ]]; then + if [[ "${USE_UV_LOCKFILE}" == 'true' ]]; then if [[ "${EXTRA_TARGETS}" != '' ]]; then uv sync --frozen --extra "${EXTRA_TARGETS}" --no-dev else @@ -595,7 +577,7 @@ runs: # Run safety vulnerability checks and strip safety scan deprecation notes from the output safety check -o bare --save-json info_safety.json --continue-on-error --policy-file "${SAFETY_POLICY_FILE}" -r "${GITHUB_ACTION_PATH}/requirements-for-safety.txt" 2>&1 \ - | grep -v -E '^\+==|^$|DEPRECATED:.*has been DEPRECATED|encourage switching to the new' + | grep -v -E '^\+==|^$|DEPRECATED:.*has been DEPRECATED|encourage switching to the new|.*AuthlibDeprecationWarning:.*|^It will be compatible before version 2\.0\.0\.$|^[[:space:]]+from authlib\.jose import jwt$' - uses: ansys/actions/_logging@main with: diff --git a/code-style/action.yml b/code-style/action.yml index a11fb8f83..d8af86989 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -267,24 +267,17 @@ runs: # ------------------------------------------------------------------------ - - name: "Validate uv lockfile existence" - id: validate-uv-lockfile - if: ${{ inputs.use-uv == 'true' && inputs.use-uv-lockfile == 'true' && inputs.skip-install == 'false' }} + - name: "Auto-detect uv lockfile" + id: auto-detect-uv-lockfile + if: ${{ inputs.use-uv == 'true' }} shell: bash run: | - if [[ ! -f "uv.lock" ]]; then - echo "UV_LOCKFILE_MISSING=true" >> ${GITHUB_OUTPUT} + if [[ -f "uv.lock" ]]; then + echo "USE_UV_LOCKFILE=true" >> ${GITHUB_OUTPUT} else - echo "UV_LOCKFILE_MISSING=false" >> ${GITHUB_OUTPUT} + echo "USE_UV_LOCKFILE=false" >> ${GITHUB_OUTPUT} fi - - uses: ansys/actions/_logging@main - if: ${{ steps.validate-uv-lockfile.outputs.UV_LOCKFILE_MISSING == 'true' }} - with: - level: "ERROR" - message: > - uv lockfile (uv.lock) not found in repository root - - name: "Update pip" shell: bash env: @@ -304,7 +297,7 @@ runs: env: BUILD_BACKEND: ${{ steps.github-environment-variables.outputs.BUILD_BACKEND }} ACTIVATE_VENV: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} - USE_UV_LOCKFILE: ${{ inputs.use-uv-lockfile }} + USE_UV_LOCKFILE: ${{ steps.auto-detect-uv-lockfile.outputs.USE_UV_LOCKFILE }} run: | ${ACTIVATE_VENV} if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then From dd7aa72b4fab9abd47c8cd1f500d4e356c1bb2d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Fri, 31 Jul 2026 11:43:36 +0200 Subject: [PATCH 48/50] ci: revert changes --- .github/workflows/ci_cd_pr.yml | 1 - .github/workflows/ci_cd_pr_flit.yml | 11 +++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index e1a4bd799..550cd4f82 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -124,7 +124,6 @@ jobs: python-version: ${{ env.MAIN_PYTHON_VERSION }} use-python-cache: false checkout: false - skip-install: false type-check: name: Type check with Ty diff --git a/.github/workflows/ci_cd_pr_flit.yml b/.github/workflows/ci_cd_pr_flit.yml index b7cf28351..a3677d0d9 100644 --- a/.github/workflows/ci_cd_pr_flit.yml +++ b/.github/workflows/ci_cd_pr_flit.yml @@ -87,7 +87,7 @@ jobs: test-build-library-flit: name: "Test build-library action (use-uv: ${{ matrix.use-uv }}) using ansys-actions-flit package" runs-on: ubuntu-latest - # needs: test-build-wheelhouse-flit + needs: test-build-wheelhouse-flit strategy: matrix: use-uv: ['true', 'false'] @@ -173,12 +173,11 @@ jobs: operating-system: ${{ matrix.os }} python-version: ${{ env.MAIN_PYTHON_VERSION }} attest-provenance: true - use-uv-lockfile: ${{ matrix.repository.name == 'pyansys-geometry' }} - use-uv: ${{ matrix.repository.name == 'pyansys-geometry' }} test-build-library-flit-projects: name: "Test build-library action for ${{ matrix.repository.name }} project" runs-on: ubuntu-latest + needs: test-build-wheelhouse-flit-projects strategy: matrix: repository: @@ -196,6 +195,7 @@ jobs: contents: read attestations: write # Needed for provenance attestation steps: + - name: "Install Git and clone ${{ matrix.repository.name }} repository" uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -216,8 +216,6 @@ jobs: library-name: ${{ matrix.repository.library }} python-version: ${{ env.MAIN_PYTHON_VERSION }} attest-provenance: true - use-uv-lockfile: ${{ matrix.repository.name == 'pyansys-geometry' }} - use-uv: ${{ matrix.repository.name == 'pyansys-geometry' }} test-check-licenses-flit-projects: name: "Test check-licenses action for ${{ matrix.repository.name }} project" @@ -293,9 +291,6 @@ jobs: use-python-cache: false use-prek: ${{ matrix.use-prek }} checkout: false - use-uv-lockfile: ${{ matrix.repository.name == 'pyansys-geometry' }} - use-uv: ${{ matrix.repository.name == 'pyansys-geometry' }} - skip-install: false test-doc-style-flit-projects: name: "Test doc-style action for ${{ matrix.repository.name }} project" From 5b89b4be811ae65386dc0035869ce76eecc91c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Fri, 31 Jul 2026 13:49:41 +0200 Subject: [PATCH 49/50] fix: working directory usage with lockfile --- build-wheelhouse/action.yml | 13 ++++++++----- check-vulnerabilities/action.yml | 4 +--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index a32d80069..4a326f3b5 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -332,11 +332,14 @@ runs: if [[ "${BUILD_BACKEND}" == 'poetry' ]]; then poetry install ${INSTALL_TARGET} elif [[ "${USE_UV}" == 'true' && "${USE_UV_LOCKFILE}" == 'true' ]]; then - if [[ "${TARGET}" != '' ]]; then - uv sync --frozen --extra "${TARGET}" --no-dev - else - uv sync --frozen --no-dev - fi + SYNC_OPTIONS="--no-dev" + SYNC_OPTIONS+=$( [[ "${TARGET}" != '' ]] && echo " --extra ${TARGET}" || echo "" ) + # NOTE: --active is only needed when the working directory is not the root of the repository. + # This is because uv sync works with the project environment path and since the virtual + # environment is created in the root of the repository, uv sync needs to be told to use the + # active environment when the working directory is not the root. + SYNC_OPTIONS+=$( [[ "${WORKING_DIRECTORY}" != '.' ]] && echo "--active" || echo "" ) + uv sync --frozen $SYNC_OPTIONS else ${INSTALL_COMMAND} "${INSTALL_TARGET}" fi diff --git a/check-vulnerabilities/action.yml b/check-vulnerabilities/action.yml index fabc972bc..461132a60 100644 --- a/check-vulnerabilities/action.yml +++ b/check-vulnerabilities/action.yml @@ -219,8 +219,6 @@ inputs: required: false type: boolean - - runs: using: "composite" steps: @@ -577,7 +575,7 @@ runs: # Run safety vulnerability checks and strip safety scan deprecation notes from the output safety check -o bare --save-json info_safety.json --continue-on-error --policy-file "${SAFETY_POLICY_FILE}" -r "${GITHUB_ACTION_PATH}/requirements-for-safety.txt" 2>&1 \ - | grep -v -E '^\+==|^$|DEPRECATED:.*has been DEPRECATED|encourage switching to the new|.*AuthlibDeprecationWarning:.*|^It will be compatible before version 2\.0\.0\.$|^[[:space:]]+from authlib\.jose import jwt$' + | grep -v -E '^\+==|^$|DEPRECATED:.*has been DEPRECATED|encourage switching to the new' - uses: ansys/actions/_logging@main with: From 3cea3ee5cedfdee852896736d604ee723f7eb776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= Date: Fri, 31 Jul 2026 13:56:35 +0200 Subject: [PATCH 50/50] fix: missing space --- build-wheelhouse/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index 4a326f3b5..22e102f82 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -338,7 +338,7 @@ runs: # This is because uv sync works with the project environment path and since the virtual # environment is created in the root of the repository, uv sync needs to be told to use the # active environment when the working directory is not the root. - SYNC_OPTIONS+=$( [[ "${WORKING_DIRECTORY}" != '.' ]] && echo "--active" || echo "" ) + SYNC_OPTIONS+=$( [[ "${WORKING_DIRECTORY}" != '.' ]] && echo " --active" || echo "" ) uv sync --frozen $SYNC_OPTIONS else ${INSTALL_COMMAND} "${INSTALL_TARGET}"