diff --git a/_release-pypi/action.yml b/_release-pypi/action.yml index b2c8ede79..fddc2816f 100644 --- a/_release-pypi/action.yml +++ b/_release-pypi/action.yml @@ -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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -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 diff --git a/_setup-python/action.yml b/_setup-python/action.yml index 92b40a45b..5d953a48d 100644 --- a/_setup-python/action.yml +++ b/_setup-python/action.yml @@ -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" @@ -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@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.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} diff --git a/build-library/action.yml b/build-library/action.yml index 7500ce7c7..6cfcb4c80 100644 --- a/build-library/action.yml +++ b/build-library/action.yml @@ -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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -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 diff --git a/build-wheelhouse/action.yml b/build-wheelhouse/action.yml index ef2adc71e..41d6f1215 100644 --- a/build-wheelhouse/action.yml +++ b/build-wheelhouse/action.yml @@ -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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean + outputs: activate-venv: @@ -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 diff --git a/check-licenses/action.yml b/check-licenses/action.yml index df251c732..f03224d5d 100644 --- a/check-licenses/action.yml +++ b/check-licenses/action.yml @@ -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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -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' diff --git a/check-vulnerabilities/action.yml b/check-vulnerabilities/action.yml index 32f731a23..78699c6a5 100644 --- a/check-vulnerabilities/action.yml +++ b/check-vulnerabilities/action.yml @@ -219,6 +219,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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -286,12 +295,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 diff --git a/code-style/action.yml b/code-style/action.yml index 38c566e02..f6ef864f9 100644 --- a/code-style/action.yml +++ b/code-style/action.yml @@ -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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -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 diff --git a/doc-build/action.yml b/doc-build/action.yml index 725058fc2..925f0d9ce 100644 --- a/doc-build/action.yml +++ b/doc-build/action.yml @@ -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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -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 }} # ------------------------------------------------------------------------ diff --git a/doc-changelog/action.yml b/doc-changelog/action.yml index c241b12c5..6fb92957f 100644 --- a/doc-changelog/action.yml +++ b/doc-changelog/action.yml @@ -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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -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 diff --git a/doc-deploy-changelog/action.yml b/doc-deploy-changelog/action.yml index 418f2db13..01a81e7ad 100644 --- a/doc-deploy-changelog/action.yml +++ b/doc-deploy-changelog/action.yml @@ -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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -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 diff --git a/doc-deploy-stable/action.yml b/doc-deploy-stable/action.yml index 13d40890f..fcbb21e10 100644 --- a/doc-deploy-stable/action.yml +++ b/doc-deploy-stable/action.yml @@ -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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -197,12 +206,13 @@ runs: 'release/.'. - 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 diff --git a/doc/source/changelog/1219.added.md b/doc/source/changelog/1219.added.md new file mode 100644 index 000000000..09bd63c28 --- /dev/null +++ b/doc/source/changelog/1219.added.md @@ -0,0 +1 @@ +Install python with uv diff --git a/hk-package-clean-except/action.yml b/hk-package-clean-except/action.yml index cea9aa76b..cd79c2461 100644 --- a/hk-package-clean-except/action.yml +++ b/hk-package-clean-except/action.yml @@ -67,6 +67,14 @@ inputs: default: '' 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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean runs: using: "composite" @@ -82,12 +90,13 @@ runs: up in a separate step.' - name: "Set up Python 3.13" - uses: ansys/actions/_setup-python@main + uses: ansys/actions/_setup-python@feat/install-python-with-uv with: python-version: '3.13' use-cache: false provision-uv: true prune-uv-cache: true + use-uv-python: ${{ inputs.install-python-with-uv }} - name: "Install required packages" shell: bash diff --git a/hk-package-clean-untagged/action.yml b/hk-package-clean-untagged/action.yml index a6789cbd9..014753e99 100644 --- a/hk-package-clean-untagged/action.yml +++ b/hk-package-clean-untagged/action.yml @@ -58,6 +58,14 @@ inputs: default: '' 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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean runs: using: "composite" @@ -73,12 +81,13 @@ runs: up in a separate step.' - name: "Set up Python 3.13" - uses: ansys/actions/_setup-python@main + uses: ansys/actions/_setup-python@feat/install-python-with-uv with: python-version: '3.13' use-cache: false provision-uv: true prune-uv-cache: true + use-uv-python: ${{ inputs.install-python-with-uv }} - name: "Install required packages" shell: bash diff --git a/release-github/action.yml b/release-github/action.yml index 910db35e1..4e8904e62 100644 --- a/release-github/action.yml +++ b/release-github/action.yml @@ -187,6 +187,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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -425,12 +434,13 @@ runs: run: ls -R dist/ - 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 tomlkit and pypandoc" shell: bash diff --git a/tests-pytest/action.yml b/tests-pytest/action.yml index 4de3891d4..e70e59194 100644 --- a/tests-pytest/action.yml +++ b/tests-pytest/action.yml @@ -132,6 +132,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 `_ + project. The uv Python distributions are self-contained, highly-portable, and performant. + default: false + required: false + type: boolean + runs: using: "composite" steps: @@ -179,12 +188,13 @@ runs: Set up python to test. - 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