From a21238130f9a61a0a0d85bf27d377a0cd50186e3 Mon Sep 17 00:00:00 2001 From: jana-selva Date: Mon, 22 Jun 2026 12:08:21 +0530 Subject: [PATCH 1/3] Add all-extras support to python-environment action --- .github/actions/python-environment/action.yml | 34 ++++++++++++++++--- doc/changes/unreleased.md | 1 + doc/github_actions/python_environment.rst | 7 ++++ 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/.github/actions/python-environment/action.yml b/.github/actions/python-environment/action.yml index d6bd7b9da..be933e494 100644 --- a/.github/actions/python-environment/action.yml +++ b/.github/actions/python-environment/action.yml @@ -19,9 +19,14 @@ inputs: default: "." extras: - description: 'Space-separated list of extras' + description: 'Comma-separated list of extras' required: false + all-extras: + description: 'Install all extras' + required: false + default: 'false' + use-cache: description: 'Use cache for poetry environment' required: false @@ -72,20 +77,39 @@ runs: uses: actions/cache@v5 with: path: ${{ steps.setup-cache-variables.outputs.POETRY_ENV_PATH }} - key: poetry-env-${{ steps.setup-cache-variables.outputs.POETRY_SHA }}-${{ steps.setup-cache-variables.outputs.IMAGE_OS }}-${{ steps.setup-cache-variables.outputs.IMAGE_VERSION }}-${{ runner.arch }}-${{ inputs.poetry-version }}-${{ inputs.python-version }}-${{ inputs.extras }} + key: poetry-env-${{ steps.setup-cache-variables.outputs.POETRY_SHA }}-${{ steps.setup-cache-variables.outputs.IMAGE_OS }}-${{ steps.setup-cache-variables.outputs.IMAGE_VERSION }}-${{ runner.arch }}-${{ inputs.poetry-version }}-${{ inputs.python-version }}-${{ inputs.extras }}-${{ inputs.all-extras }} - name: Poetry install with extras working-directory: ${{ inputs.working-directory }} shell: bash run: | - EXTRAS=$(echo "${INPUTS_EXTRAS}" | tr -d ' ') - if [[ -n "$EXTRAS" ]]; then - poetry install --extras "$EXTRAS" + EXTRAS="${INPUTS_EXTRAS}" + ALL_EXTRAS="${INPUTS_ALL_EXTRAS}" + EXTRAS_TRIMMED=$(echo "${EXTRAS}" | tr -d '[:space:],') + + if [[ "${ALL_EXTRAS}" == "true" && -n "${EXTRAS_TRIMMED}" ]]; then + echo "Inputs 'extras' and 'all-extras' are mutually exclusive." >&2 + exit 1 + fi + + if [[ "${ALL_EXTRAS}" == "true" ]]; then + poetry install --all-extras + elif [[ -n "${EXTRAS_TRIMMED}" ]]; then + NORMALIZED_EXTRAS=$(echo "${EXTRAS}" | tr ',' ' ') + read -r -a EXTRAS_ARRAY <<< "${NORMALIZED_EXTRAS}" + + INSTALL_COMMAND=(poetry install) + for EXTRA in "${EXTRAS_ARRAY[@]}"; do + INSTALL_COMMAND+=(--extras "${EXTRA}") + done + + "${INSTALL_COMMAND[@]}" else poetry install fi env: INPUTS_EXTRAS: ${{ inputs.extras }} + INPUTS_ALL_EXTRAS: ${{ inputs.all-extras }} - name: Validate Poetry environment working-directory: ${{ inputs.working-directory }} diff --git a/doc/changes/unreleased.md b/doc/changes/unreleased.md index 63b459a93..dcc4d9128 100644 --- a/doc/changes/unreleased.md +++ b/doc/changes/unreleased.md @@ -8,6 +8,7 @@ so ITDE-related test flows use the configured Exasol baseline and unit-test help ## Feature * #874: Added the `security` label to dependency update PR creation +* #699: Added `all-extras` support to the Python environment GitHub action ## Bug diff --git a/doc/github_actions/python_environment.rst b/doc/github_actions/python_environment.rst index f400b02b4..165dfcec7 100644 --- a/doc/github_actions/python_environment.rst +++ b/doc/github_actions/python_environment.rst @@ -27,6 +27,10 @@ Parameters - Comma-separated list of extras - False - (not used by default) + * - all-extras + - Install all extras + - False + - false * - use-cache - Use cache for poetry environment - False @@ -60,4 +64,7 @@ Example Usage use-cache: false extras: 'numpy,pandas' +To install all extras instead of specific ones, set ``all-extras: true``. The +inputs ``extras`` and ``all-extras`` are mutually exclusive. + ... From ad50cbb4f95e38eaa584055af445de517c50d3a4 Mon Sep 17 00:00:00 2001 From: jana-selva Date: Mon, 22 Jun 2026 13:48:55 +0530 Subject: [PATCH 2/3] Sanitize extras in python-environment cache key --- .github/actions/python-environment/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/python-environment/action.yml b/.github/actions/python-environment/action.yml index be933e494..d216aa12d 100644 --- a/.github/actions/python-environment/action.yml +++ b/.github/actions/python-environment/action.yml @@ -65,11 +65,13 @@ runs: echo "ImageVersion=$ImageVersion" POETRY_ENV_PATH=$(poetry config virtualenvs.path) POETRY_SHA=$(cat pyproject.toml poetry.lock | sha256sum | cut -f 1 -d " ") #Remove trailing dash + EXTRAS_CACHE_KEY=$(echo "${{ inputs.extras }}" | tr ',[:space:]' '-') # output to GITHUB_OUTPUT echo "IMAGE_OS=$ImageOS" >> $GITHUB_OUTPUT echo "IMAGE_VERSION=$ImageVersion" >> $GITHUB_OUTPUT echo "POETRY_ENV_PATH=$POETRY_ENV_PATH" >> $GITHUB_OUTPUT echo "POETRY_SHA=$POETRY_SHA" >> $GITHUB_OUTPUT + echo "EXTRAS_CACHE_KEY=$EXTRAS_CACHE_KEY" >> $GITHUB_OUTPUT - name: Cache Poetry environment if: inputs.use-cache == 'true' @@ -77,7 +79,7 @@ runs: uses: actions/cache@v5 with: path: ${{ steps.setup-cache-variables.outputs.POETRY_ENV_PATH }} - key: poetry-env-${{ steps.setup-cache-variables.outputs.POETRY_SHA }}-${{ steps.setup-cache-variables.outputs.IMAGE_OS }}-${{ steps.setup-cache-variables.outputs.IMAGE_VERSION }}-${{ runner.arch }}-${{ inputs.poetry-version }}-${{ inputs.python-version }}-${{ inputs.extras }}-${{ inputs.all-extras }} + key: poetry-env-${{ steps.setup-cache-variables.outputs.POETRY_SHA }}-${{ steps.setup-cache-variables.outputs.IMAGE_OS }}-${{ steps.setup-cache-variables.outputs.IMAGE_VERSION }}-${{ runner.arch }}-${{ inputs.poetry-version }}-${{ inputs.python-version }}-${{ steps.setup-cache-variables.outputs.EXTRAS_CACHE_KEY }}-${{ inputs.all-extras }} - name: Poetry install with extras working-directory: ${{ inputs.working-directory }} From 036945a743695106820a01c681d2b136b615a39c Mon Sep 17 00:00:00 2001 From: jana-selva Date: Mon, 22 Jun 2026 14:02:20 +0530 Subject: [PATCH 3/3] Fix extras cache key handling --- .github/actions/python-environment/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/python-environment/action.yml b/.github/actions/python-environment/action.yml index d216aa12d..b03656c32 100644 --- a/.github/actions/python-environment/action.yml +++ b/.github/actions/python-environment/action.yml @@ -65,13 +65,15 @@ runs: echo "ImageVersion=$ImageVersion" POETRY_ENV_PATH=$(poetry config virtualenvs.path) POETRY_SHA=$(cat pyproject.toml poetry.lock | sha256sum | cut -f 1 -d " ") #Remove trailing dash - EXTRAS_CACHE_KEY=$(echo "${{ inputs.extras }}" | tr ',[:space:]' '-') + EXTRAS_CACHE_KEY=$(echo "${INPUTS_EXTRAS}" | tr ',[:space:]' '-') # output to GITHUB_OUTPUT echo "IMAGE_OS=$ImageOS" >> $GITHUB_OUTPUT echo "IMAGE_VERSION=$ImageVersion" >> $GITHUB_OUTPUT echo "POETRY_ENV_PATH=$POETRY_ENV_PATH" >> $GITHUB_OUTPUT echo "POETRY_SHA=$POETRY_SHA" >> $GITHUB_OUTPUT echo "EXTRAS_CACHE_KEY=$EXTRAS_CACHE_KEY" >> $GITHUB_OUTPUT + env: + INPUTS_EXTRAS: ${{ inputs.extras }} - name: Cache Poetry environment if: inputs.use-cache == 'true'