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
12 changes: 11 additions & 1 deletion _release-pypi/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ inputs:
required: false
type: boolean

install-python-with-uv:
description: |
Whether to install Python using uv. The python distribution provided by uv are coming from
the Astral `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`_
project. The uv Python distributions are self-contained, highly-portable, and performant.
default: false
required: false
type: boolean

runs:
using: "composite"
steps:
Expand All @@ -128,12 +137,13 @@ runs:
echo "::notice::We recommend using trusted publishers to securely publish packages on PyPI. You should consider moving to this approach."

- name: "Set up Python"
uses: ansys/actions/_setup-python@main
uses: ansys/actions/_setup-python@feat/install-python-with-uv
with:
python-version: ${{ inputs.python-version }}
use-cache: false
provision-uv: ${{ inputs.use-uv }}
prune-uv-cache: true
use-uv-python: ${{ inputs.install-python-with-uv }}

- name: "Install twine"
shell: bash
Expand Down
25 changes: 20 additions & 5 deletions _setup-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ inputs:

required: true
type: boolean
use-uv-python:
description: |
'Whether to use uv python or not. This input only has an effect if
``provision-uv`` is set to ``true``. If ``true``, uv python is used. If ``false``,
python provided by ``actions/setup-python`` is used.
By default it is set to ``false``.'
required: true
type: boolean

runs:
using: "composite"
Expand Down Expand Up @@ -82,23 +90,30 @@ runs:
# NOTE: When a workflow is triggered without using the cache, it can lead to a failure
# in the Post Run action saying that the cache folder doesn't exist on disk.
# This is related to our use of uv to install packages, see https://github.com/ansys/actions/pull/811
- name: "Set up Python using cache"
if: ${{ inputs.use-cache == 'true' && inputs.provision-uv == 'false'}}
- name: Set up Python with actions/setup-python and using cache
if: ${{ inputs.use-uv-python == 'false' && inputs.use-cache == 'true' && inputs.provision-uv == 'false'}}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
cache-dependency-path: 'pyproject.toml'

- name: "Set up Python without using cache"
if: ${{ inputs.use-cache == 'false' || (inputs.use-cache == 'true' && inputs.provision-uv == 'true') }}
- name: Set up Python with actions/setup-python and without using cache
if: ${{ inputs.use-uv-python == 'false' && inputs.use-cache == 'false' || (inputs.use-cache == 'true' && inputs.provision-uv == 'true') }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ inputs.python-version }}

- name: "Set up uv"
- name: Set up uv
if: ${{ inputs.provision-uv == 'true' }}
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
enable-cache: ${{ inputs.use-cache }}
prune-cache: ${{ inputs.prune-uv-cache }}

- name: Install Python with uv
if: ${{ inputs.provision-uv == 'true' && inputs.use-uv-python == 'true' }}
env:
PYTHON_VERSION: ${{ inputs.python-version }}
shell: bash
run: uv python install ${PYTHON_VERSION}
12 changes: 11 additions & 1 deletion build-library/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ inputs:
default: false
type: boolean

install-python-with-uv:
description: |
Whether to install Python using uv. The python distribution provided by uv are coming from
the Astral `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`_
project. The uv Python distributions are self-contained, highly-portable, and performant.
default: false
required: false
type: boolean

runs:
using: "composite"
steps:
Expand All @@ -148,12 +157,13 @@ runs:
fetch-tags: ${{ inputs.checkout-fetch-tags }}

- name: "Set up Python"
uses: ansys/actions/_setup-python@main
uses: ansys/actions/_setup-python@feat/install-python-with-uv
with:
python-version: ${{ inputs.python-version }}
use-cache: ${{ inputs.use-python-cache }}
provision-uv: ${{ inputs.use-uv }}
prune-uv-cache: ${{ inputs.use-python-cache != 'true' }}
use-uv-python: ${{ inputs.install-python-with-uv }}

- name: "Install library"
shell: bash
Expand Down
12 changes: 11 additions & 1 deletion build-wheelhouse/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ inputs:
required: false
type: boolean

install-python-with-uv:
description: |
Whether to install Python using uv. The python distribution provided by uv are coming from
the Astral `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`_
project. The uv Python distributions are self-contained, highly-portable, and performant.
default: false
required: false
type: boolean

outputs:

activate-venv:
Expand All @@ -169,12 +178,13 @@ runs:
persist-credentials: false

- name: "Set up Python ${{ inputs.python-version }}"
uses: ansys/actions/_setup-python@main
uses: ansys/actions/_setup-python@feat/install-python-with-uv
with:
python-version: ${{ inputs.python-version }}
use-cache: ${{ inputs.use-python-cache }}
provision-uv: ${{ inputs.use-uv }}
prune-uv-cache: ${{ inputs.use-python-cache != 'true' }}
use-uv-python: ${{ inputs.install-python-with-uv }}

- name: "Identify the build system"
id: build-system
Expand Down
12 changes: 11 additions & 1 deletion check-licenses/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ inputs:
default: ''
type: string

install-python-with-uv:
description: |
Whether to install Python using uv. The python distribution provided by uv are coming from
the Astral `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`_
project. The uv Python distributions are self-contained, highly-portable, and performant.
default: false
required: false
type: boolean

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -195,12 +204,13 @@ runs:

- name: "Set up Python"
if: inputs.skip-install == 'false'
uses: ansys/actions/_setup-python@main
uses: ansys/actions/_setup-python@feat/install-python-with-uv
with:
python-version: ${{ inputs.python-version }}
use-cache: ${{ inputs.use-python-cache }}
provision-uv: ${{ inputs.use-uv }}
prune-uv-cache: ${{ inputs.use-python-cache != 'true' }}
use-uv-python: ${{ inputs.install-python-with-uv }}

- name: "Identify the build system"
if: inputs.skip-install == 'false'
Expand Down
14 changes: 12 additions & 2 deletions check-vulnerabilities/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ inputs:
required: false
type: boolean

install-python-with-uv:
description: |
Whether to install Python using uv. The python distribution provided by uv are coming from
the Astral `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`_
project. The uv Python distributions are self-contained, highly-portable, and performant.
default: false
required: false
type: boolean

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -273,12 +282,13 @@ runs:
Set up python to check vulnerabilities.

- name: "Set up Python ${{ inputs.python-version }}"
uses: ansys/actions/_setup-python@main
uses: ansys/actions/_setup-python@feat/install-python-with-uv
with:
python-version: ${{ inputs.python-version }}
use-cache: false
provision-uv: ${{ inputs.use-uv }}
prune-uv-cache: true
use-uv-python: ${{ inputs.install-python-with-uv }}

# NOTE: Installation of poetry in a separate environment to the project to
# avoid situations in which both poetry and the project have shared
Expand Down Expand Up @@ -523,7 +533,7 @@ runs:
fi

- name: "Uploading safety and bandit results"
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: inputs.upload-reports == 'true' || ( failure() && inputs.upload-reports == 'true' )
with:
name: vulnerability-results
Expand Down
12 changes: 11 additions & 1 deletion code-style/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ inputs:
default: true
type: boolean

install-python-with-uv:
description: |
Whether to install Python using uv. The python distribution provided by uv are coming from
the Astral `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`_
project. The uv Python distributions are self-contained, highly-portable, and performant.
default: false
required: false
type: boolean

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -187,12 +196,13 @@ runs:
Set up python to check code style.

- name: "Set up Python"
uses: ansys/actions/_setup-python@main
uses: ansys/actions/_setup-python@feat/install-python-with-uv
with:
python-version: ${{ inputs.python-version }}
use-cache: ${{ inputs.use-python-cache }}
provision-uv: ${{ inputs.use-uv }}
prune-uv-cache: ${{ inputs.use-python-cache != 'true' }}
use-uv-python: ${{ inputs.install-python-with-uv }}

# NOTE: Installation of poetry in a separate environment to the project to
# avoid situations in which both poetry and the project have shared
Expand Down
12 changes: 11 additions & 1 deletion doc-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,15 @@ inputs:
required: false
type: string

install-python-with-uv:
description: |
Whether to install Python using uv. The python distribution provided by uv are coming from
the Astral `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`_
project. The uv Python distributions are self-contained, highly-portable, and performant.
default: false
required: false
type: boolean

runs:
using: "composite"
steps:
Expand All @@ -226,12 +235,13 @@ runs:
if: ${{ inputs.checkout == 'true' }}

- name: "Set up Python"
uses: ansys/actions/_setup-python@main
uses: ansys/actions/_setup-python@feat/install-python-with-uv
with:
python-version: ${{ inputs.python-version }}
use-cache: ${{ inputs.use-python-cache }}
provision-uv: ${{ inputs.use-uv }}
prune-uv-cache: ${{ inputs.use-python-cache != 'true' }}
use-uv-python: ${{ inputs.install-python-with-uv }}

# ------------------------------------------------------------------------

Expand Down
12 changes: 11 additions & 1 deletion doc-changelog/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@ inputs:
required: false
type: boolean

install-python-with-uv:
description: |
Whether to install Python using uv. The python distribution provided by uv are coming from
the Astral `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`_
project. The uv Python distributions are self-contained, highly-portable, and performant.
default: false
required: false
type: boolean

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -197,12 +206,13 @@ runs:
token: ${{ inputs.token }} # zizmor: ignore[artipacked] , credentials should be persisted

- name: "Set up Python ${{ inputs.python-version }}"
uses: ansys/actions/_setup-python@main
uses: ansys/actions/_setup-python@feat/install-python-with-uv
with:
python-version: ${{ inputs.python-version }}
use-cache: ${{ inputs.use-python-cache }}
provision-uv: ${{ inputs.use-uv }}
prune-uv-cache: ${{ inputs.use-python-cache != 'true' }}
use-uv-python: ${{ inputs.install-python-with-uv }}

- name: "Install towncrier and tomlkit"
shell: bash
Expand Down
12 changes: 11 additions & 1 deletion doc-deploy-changelog/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@ inputs:
default: true
type: boolean

install-python-with-uv:
description: |
Whether to install Python using uv. The python distribution provided by uv are coming from
the Astral `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`_
project. The uv Python distributions are self-contained, highly-portable, and performant.
default: false
required: false
type: boolean

runs:
using: "composite"
steps:
Expand All @@ -197,12 +206,13 @@ runs:
fetch-depth: 0 # zizmor: ignore[artipacked] , credentials must be persisted in this case

- name: "Set up Python ${{ inputs.python-version }}"
uses: ansys/actions/_setup-python@main
uses: ansys/actions/_setup-python@feat/install-python-with-uv
with:
python-version: ${{ inputs.python-version }}
use-cache: ${{ inputs.use-python-cache }}
provision-uv: false
prune-uv-cache: ${{ inputs.use-python-cache != 'true' }}
use-uv-python: ${{ inputs.install-python-with-uv }}

- name: Save tag version
id: save-tag-version
Expand Down
12 changes: 11 additions & 1 deletion doc-deploy-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ inputs:
default: true
type: boolean

install-python-with-uv:
description: |
Whether to install Python using uv. The python distribution provided by uv are coming from
the Astral `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`_
project. The uv Python distributions are self-contained, highly-portable, and performant.
default: false
required: false
type: boolean

runs:
using: "composite"
steps:
Expand All @@ -197,12 +206,13 @@ runs:
'release/<MAJOR>.<MINOR>'.

- name: "Set up Python ${{ inputs.python-version }}"
uses: ansys/actions/_setup-python@main
uses: ansys/actions/_setup-python@feat/install-python-with-uv
with:
python-version: ${{ inputs.python-version }}
use-cache: ${{ inputs.use-python-cache }}
provision-uv: ${{ inputs.use-uv }}
prune-uv-cache: ${{ inputs.use-python-cache != 'true' }}
use-uv-python: ${{ inputs.install-python-with-uv }}

- name: "Install packaging"
shell: bash
Expand Down
1 change: 1 addition & 0 deletions doc/source/changelog/1219.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Install python with uv
Loading
Loading