Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions build-library/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ 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 will be ignored.

default: false
required: false
type: boolean

skip-python-setup:
description: |
Whether to skip the Python setup step performed by
Expand Down Expand Up @@ -164,6 +177,16 @@ 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:
Expand Down
18 changes: 18 additions & 0 deletions build-wheelhouse/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,19 @@ 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 will be ignored.

default: false
required: false
type: boolean

skip-python-setup:
description: |
Whether to skip the Python setup step performed by
Expand Down Expand Up @@ -429,12 +442,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
pip wheel -w ${GITHUB_WORKSPACE}/wheelhouse -r wheel_reqs.txt
else
python -m pip wheel "${INSTALL_TARGET}" -w ${GITHUB_WORKSPACE}/wheelhouse
fi
Expand Down
54 changes: 38 additions & 16 deletions check-vulnerabilities/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,19 @@ 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 will be ignored.

default: false
required: false
type: boolean

runs:
using: "composite"
steps:
Expand All @@ -243,7 +256,7 @@ runs:
fi

- name: "Install Git and clone project"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
if: ${{ inputs.checkout == 'true' }}
with:
repository: ${{ inputs.repo-full-name == '' && github.repository || inputs.repo-full-name }}
Expand Down Expand Up @@ -376,29 +389,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"
Expand Down
1 change: 1 addition & 0 deletions doc/source/changelog/1364.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow us uv lock file
Loading