mirror of
https://github.com/actions/setup-python
synced 2025-04-05 14:59:42 +00:00
Enhance workflows: Add macOS 13 support, upgrade publish-action, and update documentation for arm64 and latest versions (#965)
* update ci workflows with latest versions and added macos-13 * updated document with latest versions
This commit is contained in:
@ -27,14 +27,14 @@
|
||||
|
||||
### Specifying a Python version
|
||||
|
||||
If there is a specific version of Python that you need and you don't want to worry about any potential breaking changes due to patch updates (going from `3.7.5` to `3.7.6` for example), you should specify the **exact major, minor, and patch version** (such as `3.7.5`):
|
||||
If there is a specific version of Python that you need and you don't want to worry about any potential breaking changes due to patch updates (going from `3.12.6` to `3.12.7` for example), you should specify the **exact major, minor, and patch version** (such as `3.12.6`):
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.7.5'
|
||||
python-version: '3.12.6'
|
||||
- run: python my_script.py
|
||||
```
|
||||
|
||||
@ -48,7 +48,7 @@ steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.7'
|
||||
python-version: '3.13'
|
||||
- run: python my_script.py
|
||||
```
|
||||
- There will be a single patch version already installed on each runner for every minor version of Python that is supported.
|
||||
@ -62,7 +62,7 @@ steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12.0-alpha.1'
|
||||
python-version: '3.14.0-alpha.1'
|
||||
- run: python my_script.py
|
||||
```
|
||||
|
||||
@ -73,7 +73,7 @@ steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12-dev'
|
||||
python-version: '3.14-dev'
|
||||
- run: python my_script.py
|
||||
```
|
||||
|
||||
@ -86,7 +86,7 @@ steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '>=3.9 <3.10'
|
||||
python-version: '>=3.9 <3.14'
|
||||
- run: python my_script.py
|
||||
```
|
||||
|
||||
@ -97,7 +97,7 @@ steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12.0-alpha - 3.12.0'
|
||||
python-version: '3.13.0-alpha - 3.13.0'
|
||||
- run: python my_script.py
|
||||
```
|
||||
|
||||
@ -118,6 +118,7 @@ The version of PyPy should be specified in the format `pypy<python_version>[-v<p
|
||||
The `-v<pypy_version>` parameter is optional and can be skipped. The latest PyPy version will be used in this case.
|
||||
|
||||
```
|
||||
pypy3.10 or pypy-3.10 # the latest available version of PyPy that supports Python 3.10
|
||||
pypy3.9 or pypy-3.9 # the latest available version of PyPy that supports Python 3.9
|
||||
pypy2.7 or pypy-2.7 # the latest available version of PyPy that supports Python 2.7
|
||||
pypy3.7-v7.3.3 or pypy-3.7-v7.3.3 # Python 3.7 and PyPy 7.3.3
|
||||
@ -135,8 +136,8 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
python-version:
|
||||
- 'pypy3.7' # the latest available version of PyPy that supports Python 3.7
|
||||
- 'pypy3.7-v7.3.3' # Python 3.7 and PyPy 7.3.3
|
||||
- 'pypy3.10' # the latest available version of PyPy that supports Python 3.10
|
||||
- 'pypy3.10-v7.3.17' # Python 3.10 and PyPy 7.3.17
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
@ -160,9 +161,9 @@ jobs:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: |
|
||||
3.8
|
||||
3.9
|
||||
3.10
|
||||
3.11
|
||||
3.12
|
||||
3.13
|
||||
- run: python my_script.py
|
||||
```
|
||||
|
||||
@ -177,9 +178,9 @@ jobs:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: |
|
||||
pypy-3.7-v7.3.x
|
||||
pypy3.9-nightly
|
||||
pypy3.8
|
||||
pypy-3.10-v7.3.x
|
||||
pypy3.10-nightly
|
||||
pypy3.9
|
||||
- run: python my_script.py
|
||||
```
|
||||
|
||||
@ -194,11 +195,11 @@ jobs:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: |
|
||||
3.8
|
||||
3.9
|
||||
pypy3.9-nightly
|
||||
pypy3.8
|
||||
3.10
|
||||
3.11
|
||||
3.12
|
||||
pypy3.10-nightly
|
||||
pypy3.10
|
||||
3.13
|
||||
- run: python my_script.py
|
||||
```
|
||||
|
||||
@ -212,7 +213,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [ '2.x', '3.x', 'pypy2.7', 'pypy3.8', 'pypy3.9' ]
|
||||
python-version: ['3.x', 'pypy2.7', 'pypy3.8', 'pypy3.9' ]
|
||||
name: Python ${{ matrix.python-version }} sample
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@ -233,12 +234,12 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
python-version: ['2.7', '3.7', '3.8', '3.9', '3.10', 'pypy2.7', 'pypy3.9']
|
||||
python-version: ['3.7', '3.8', '3.9', '3.10', 'pypy2.7', 'pypy3.9']
|
||||
exclude:
|
||||
- os: macos-latest
|
||||
python-version: '3.8'
|
||||
- os: windows-latest
|
||||
python-version: '3.6'
|
||||
python-version: '3.8'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python
|
||||
@ -284,7 +285,7 @@ steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.7'
|
||||
python-version: '3.13'
|
||||
check-latest: true
|
||||
- run: python my_script.py
|
||||
```
|
||||
@ -299,7 +300,7 @@ steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.9'
|
||||
python-version: '3.13'
|
||||
cache: 'pipenv'
|
||||
- name: Install pipenv
|
||||
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
|
||||
@ -314,7 +315,7 @@ steps:
|
||||
run: pipx install poetry
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.9'
|
||||
python-version: '3.13'
|
||||
cache: 'poetry'
|
||||
- run: poetry install
|
||||
- run: poetry run pytest
|
||||
@ -327,7 +328,7 @@ steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.9'
|
||||
python-version: '3.13'
|
||||
cache: 'pipenv'
|
||||
cache-dependency-path: |
|
||||
server/app/Pipfile.lock
|
||||
@ -342,7 +343,7 @@ steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.9'
|
||||
python-version: '3.13'
|
||||
cache: 'pip'
|
||||
cache-dependency-path: '**/requirements-dev.txt'
|
||||
- run: pip install -r subdirectory/requirements-dev.txt
|
||||
@ -354,7 +355,7 @@ steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.13'
|
||||
cache: 'pip'
|
||||
cache-dependency-path: |
|
||||
**/setup.cfg
|
||||
@ -369,7 +370,7 @@ steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
python-version: '3.13'
|
||||
cache: 'pip'
|
||||
cache-dependency-path: setup.py
|
||||
- run: pip install -e .
|
||||
@ -382,7 +383,7 @@ steps:
|
||||
|
||||
### `python-version`
|
||||
|
||||
Using **python-version** output it's possible to get the installed by action Python or PyPy version. This output is useful when the input `python-version` is given as a range (e.g. 3.8.0 - 3.10.0 ), but down in a workflow you need to operate with the exact installed version (e.g. 3.10.1).
|
||||
Using **python-version** output it's possible to get the installed by action Python or PyPy version. This output is useful when the input `python-version` is given as a range (e.g. 3.8.0 - 3.12.0 ), but down in a workflow you need to operate with the exact installed version (e.g. 3.12.1).
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@ -391,10 +392,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
id: cp310
|
||||
id: cp312
|
||||
with:
|
||||
python-version: "3.8.0 - 3.10.0"
|
||||
- run: echo '${{ steps.cp310.outputs.python-version }}'
|
||||
python-version: "3.8.0 - 3.12.0"
|
||||
- run: echo '${{ steps.cp312.outputs.python-version }}'
|
||||
```
|
||||
|
||||
### `python-path`
|
||||
@ -408,10 +409,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
id: cp310
|
||||
id: cp313
|
||||
with:
|
||||
python-version: "3.10"
|
||||
- run: pipx run --python '${{ steps.cp310.outputs.python-path }}' nox --version
|
||||
python-version: "3.13"
|
||||
- run: pipx run --python '${{ steps.cp313.outputs.python-path }}' nox --version
|
||||
```
|
||||
### `cache-hit`
|
||||
|
||||
@ -424,11 +425,11 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
id: cp310
|
||||
id: cp313
|
||||
with:
|
||||
python-version: "3.8.0"
|
||||
python-version: "3.13.0"
|
||||
cache: "poetry"
|
||||
- run: echo '${{ steps.cp310.outputs.cache-hit }}' # true if cache-hit occurred on the primary key
|
||||
- run: echo '${{ steps.cp313.outputs.cache-hit }}' # true if cache-hit occurred on the primary key
|
||||
```
|
||||
|
||||
## Environment variables
|
||||
@ -455,11 +456,11 @@ Such a requirement on side-effect could be because you don't want your composite
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
id: cp310
|
||||
id: cp313
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.13'
|
||||
update-environment: false
|
||||
- run: ${{ steps.cp310.outputs.python-path }} my_script.py
|
||||
- run: ${{ steps.cp313.outputs.python-path }} my_script.py
|
||||
```
|
||||
## Available versions of Python, PyPy and GraalPy
|
||||
### Python
|
||||
@ -469,9 +470,9 @@ Such a requirement on side-effect could be because you don't want your composite
|
||||
- Preinstalled versions of Python in the tool cache on GitHub-hosted runners.
|
||||
- For detailed information regarding the available versions of Python that are installed, see [Supported software](https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-software).
|
||||
- For every minor version of Python, expect only the latest patch to be preinstalled.
|
||||
- If `3.8.1` is installed for example, and `3.8.2` is released, expect `3.8.1` to be removed and replaced by `3.8.2` in the tool cache.
|
||||
- If the exact patch version doesn't matter to you, specifying just the major and minor versions will get you the latest preinstalled patch version. In the previous example, the version spec `3.8` will use the `3.8.2` Python version found in the cache.
|
||||
- Use `-dev` instead of a patch number (e.g., `3.12-dev`) to install the latest patch version release for a given minor version, *alpha and beta releases included*.
|
||||
- If `3.12.1` is installed for example, and `3.12.2` is released, expect `3.12.1` to be removed and replaced by `3.12.2` in the tool cache.
|
||||
- If the exact patch version doesn't matter to you, specifying just the major and minor versions will get you the latest preinstalled patch version. In the previous example, the version spec `3.12` will use the `3.12.2` Python version found in the cache.
|
||||
- Use `-dev` instead of a patch number (e.g., `3.14-dev`) to install the latest patch version release for a given minor version, *alpha and beta releases included*.
|
||||
- Downloadable Python versions from GitHub Releases ([actions/python-versions](https://github.com/actions/python-versions/releases)).
|
||||
- All available versions are listed in the [version-manifest.json](https://github.com/actions/python-versions/blob/main/versions-manifest.json) file.
|
||||
- If there is a specific version of Python that is not available, you can open an issue here
|
||||
@ -485,7 +486,7 @@ Such a requirement on side-effect could be because you don't want your composite
|
||||
- Preinstalled versions of PyPy in the tool cache on GitHub-hosted runners
|
||||
- For detailed information regarding the available versions of PyPy that are installed, see [Supported software](https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-software).
|
||||
- For the latest PyPy release, all versions of Python are cached.
|
||||
- Cache is updated with a 1-2 week delay. If you specify the PyPy version as `pypy3.7` or `pypy-3.7`, the cached version will be used although a newer version is available. If you need to start using the recently released version right after release, you should specify the exact PyPy version using `pypy3.7-v7.3.3` or `pypy-3.7-v7.3.3`.
|
||||
- Cache is updated with a 1-2 week delay. If you specify the PyPy version as `pypy3.10` or `pypy-3.10`, the cached version will be used although a newer version is available. If you need to start using the recently released version right after release, you should specify the exact PyPy version using `pypy3.10-v7.3.17` or `pypy-3.10-v7.3.17`.
|
||||
|
||||
- Downloadable PyPy versions from the [official PyPy site](https://downloads.python.org/pypy/).
|
||||
- All available versions that we can download are listed in [versions.json](https://downloads.python.org/pypy/versions.json) file.
|
||||
@ -596,7 +597,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [Ubuntu, Windows, macOS]
|
||||
python_version: ["3.11", "3.12"]
|
||||
python_version: ["3.11", "3.12", "3.13"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
Reference in New Issue
Block a user