From 5b1043874bd70c8e06bdba4c2ee62e66e98d8eca Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:15:28 +0200 Subject: [PATCH 1/3] feat(actions): expose python-path output and propagate it to build-wheelhouse - Add python-path output and a "Get Python path" step to the _setup-python composite action. - Add id: setup-python to the build-wheelhouse setup step and expose python-path via steps.setup-python.outputs.python-path. --- _setup-python/action.yml | 15 +++++++++++++++ build-wheelhouse/action.yml | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/_setup-python/action.yml b/_setup-python/action.yml index 3d5273465..f05dae567 100644 --- a/_setup-python/action.yml +++ b/_setup-python/action.yml @@ -50,6 +50,11 @@ inputs: required: true type: boolean +outputs: + python-path: + description: "The path to the Python executable" + value: ${{ steps.python-path.outputs.PYTHON_PATH }} + runs: using: "composite" steps: @@ -102,3 +107,13 @@ runs: with: enable-cache: ${{ inputs.use-cache }} prune-cache: ${{ inputs.prune-uv-cache }} + + - name: "Get Python path" + id: python-path + shell: python + # Using python shell to ensure compatibility with Windows runners + run: | + import sys + import os + with open(os.environ['GITHUB_OUTPUT'], 'a') as f: + f.write(f"PYTHON_PATH={sys.executable}\n") diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index b5db1d7d2..ac02778e0 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -147,6 +147,13 @@ outputs: the virtual environment, such as running smoke tests. value: ${{ steps.virtual-environment-activation-command.outputs.ACTIVATE_VENV }} + python-path: + description: | + Path to the Python interpreter within the virtual environment set up by this action. + It can be reused in later steps of the same job to execute tasks within + the virtual environment, such as running smoke tests. + value: ${{ steps.setup-python.outputs.python-path }} + runs: using: "composite" steps: @@ -158,6 +165,7 @@ runs: persist-credentials: false - name: "Set up Python ${{ inputs.python-version }}" + id: setup-python uses: ansys/actions/_setup-python@main with: python-version: ${{ inputs.python-version }} From 6a3cbe43d6e4fbd872efd024aa87257b27f9387c Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Mon, 20 Oct 2025 11:17:41 +0000 Subject: [PATCH 2/3] chore: adding changelog file 1038.added.md [dependabot-skip] --- doc/source/changelog/1038.added.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/source/changelog/1038.added.md diff --git a/doc/source/changelog/1038.added.md b/doc/source/changelog/1038.added.md new file mode 100644 index 000000000..e17e754e6 --- /dev/null +++ b/doc/source/changelog/1038.added.md @@ -0,0 +1 @@ +Expose python-path output and propagate it to build-wheelhouse From c44fc48f2a850478ed4c2c7764557c50084a9581 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Mon, 20 Oct 2025 14:30:06 +0200 Subject: [PATCH 3/3] fix(actions): source python-path from virtual environment and add step to emit PYTHON_PATH --- build-wheelhouse/action.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index ac02778e0..1188b86d7 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -152,7 +152,7 @@ outputs: Path to the Python interpreter within the virtual environment set up by this action. It can be reused in later steps of the same job to execute tasks within the virtual environment, such as running smoke tests. - value: ${{ steps.setup-python.outputs.python-path }} + value: ${{ steps.virtual-environment-python-path.outputs.PYTHON_PATH }} runs: using: "composite" @@ -251,6 +251,13 @@ runs: echo "ACTIVATE_VENV=$(echo 'source .venv/bin/activate')" >> $GITHUB_OUTPUT fi + - name: "Set up python path output" + id: virtual-environment-python-path + shell: bash + run: | + ${ACTIVATE_VENV} + python -c "import sys,os;f=open(os.environ['GITHUB_OUTPUT'],'a');f.write(f'PYTHON_PATH={sys.executable}\n');f.close()" + - name: "Update pip" shell: bash env: