mirror of
https://github.com/actions/setup-python.git
synced 2024-12-27 01:50:35 +01:00
Fix review points
This commit is contained in:
parent
72394d1a3e
commit
c318b92fd6
3 changed files with 23 additions and 23 deletions
|
@ -4,7 +4,7 @@
|
||||||
<a href="https://github.com/actions/setup-python"><img alt="GitHub Actions status" src="https://github.com/actions/setup-python/workflows/Main%20workflow/badge.svg"></a>
|
<a href="https://github.com/actions/setup-python"><img alt="GitHub Actions status" src="https://github.com/actions/setup-python/workflows/Main%20workflow/badge.svg"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
This action provides the following functionalities for GitHub Actions users:
|
This action provides the following functionality for GitHub Actions users:
|
||||||
|
|
||||||
- Optionally installing and adding to PATH a version of Python that is already installed in the runner's tool cache.
|
- Optionally installing and adding to PATH a version of Python that is already installed in the runner's tool cache.
|
||||||
- Downloading, installing and adding to PATH an available version of Python from GitHub Releases ([actions/python-versions](https://github.com/actions/python-versions/releases)) if a specific version is not available in the runner's tool cache.
|
- Downloading, installing and adding to PATH an available version of Python from GitHub Releases ([actions/python-versions](https://github.com/actions/python-versions/releases)) if a specific version is not available in the runner's tool cache.
|
||||||
|
@ -35,11 +35,11 @@ steps:
|
||||||
python-version: 'pypy3.9'
|
python-version: 'pypy3.9'
|
||||||
- run: python my_script.py
|
- run: python my_script.py
|
||||||
```
|
```
|
||||||
The `python-version` input is optional. If not supplied, the action will try to resolve the version from the default `.python-version` file. If the `.python-version` file doesn't exist Python/PyPy version from the PATH will be used. The default version of Python/PyPy in PATH varies between runners and can be changed unexpectedly so we recommend always using `setup-python`.
|
The `python-version` input is optional. If not supplied, the action will try to resolve the version from the default `.python-version` file. If the `.python-version` file doesn't exist Python or PyPy version from the PATH will be used. The default version of Python or PyPy in PATH varies between runners and can be changed unexpectedly so we recommend always using `setup-python`.
|
||||||
|
|
||||||
The action will first check the local [tool cache](docs/advanced-usage.md#hosted-tool-cache) for a [semver](https://github.com/npm/node-semver#versions) match. If unable to find a specific version in the tool cache, the action will attempt to download a version of Python from [GitHub Releases](https://github.com/actions/python-versions/releases) and for PyPy from the official [PyPy's dist](https://downloads.python.org/pypy/).
|
The action will first check the local [tool cache](docs/advanced-usage.md#hosted-tool-cache) for a [semver](https://github.com/npm/node-semver#versions) match. If unable to find a specific version in the tool cache, the action will attempt to download a version of Python from [GitHub Releases](https://github.com/actions/python-versions/releases) and for PyPy from the official [PyPy's dist](https://downloads.python.org/pypy/).
|
||||||
|
|
||||||
For information regarding locally cached versions of Python/PyPy on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments).
|
For information regarding locally cached versions of Python or PyPy on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments).
|
||||||
|
|
||||||
## Supported version syntax
|
## Supported version syntax
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ The `python-version` input supports the [Semantic Versioning Specification](http
|
||||||
|
|
||||||
## Supported architectures
|
## Supported architectures
|
||||||
|
|
||||||
Using `architecture` input it is possible to specify the required Python/PyPy interpreter architecture: `x86` or `x64`. If the input is not specified the architecture defaults to `x64`.
|
Using `architecture` input it is possible to specify the required Python or PyPy interpreter architecture: `x86` or `x64`. If the input is not specified the architecture defaults to `x64`.
|
||||||
|
|
||||||
## Caching packages dependencies
|
## Caching packages dependencies
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,14 @@ description: "Set up a specific version of Python and add the command-line tools
|
||||||
author: "GitHub"
|
author: "GitHub"
|
||||||
inputs:
|
inputs:
|
||||||
python-version:
|
python-version:
|
||||||
description: "Version range or exact version of Python/PyPy to use, using SemVer's version range syntax. Reads from .python-version if unset."
|
description: "Version range or exact version of Python or PyPy to use, using SemVer's version range syntax. Reads from .python-version if unset."
|
||||||
python-version-file:
|
python-version-file:
|
||||||
description: "File containing the Python version to use. Example: .python-version"
|
description: "File containing the Python version to use. Example: .python-version"
|
||||||
cache:
|
cache:
|
||||||
description: "Used to specify a package manager for caching in the default directory. Supported values: pip, pipenv, poetry."
|
description: "Used to specify a package manager for caching in the default directory. Supported values: pip, pipenv, poetry."
|
||||||
required: false
|
required: false
|
||||||
architecture:
|
architecture:
|
||||||
description: "The target architecture (x86, x64) of the Python/PyPy interpreter."
|
description: "The target architecture (x86, x64) of the Python or PyPy interpreter."
|
||||||
check-latest:
|
check-latest:
|
||||||
description: "Set this option if you want the action to check for the latest available version that satisfies the version spec."
|
description: "Set this option if you want the action to check for the latest available version that satisfies the version spec."
|
||||||
default: false
|
default: false
|
||||||
|
@ -25,11 +25,11 @@ inputs:
|
||||||
default: true
|
default: true
|
||||||
outputs:
|
outputs:
|
||||||
python-version:
|
python-version:
|
||||||
description: "The installed Python/PyPy version. Useful when given a version range as input."
|
description: "The installed Python or PyPy version. Useful when given a version range as input."
|
||||||
cache-hit:
|
cache-hit:
|
||||||
description: "A boolean value to indicate a cache entry was found"
|
description: "A boolean value to indicate a cache entry was found"
|
||||||
python-path:
|
python-path:
|
||||||
description: "The absolute path to the Python/PyPy executable."
|
description: "The absolute path to the Python or PyPy executable."
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'dist/setup/index.js'
|
main: 'dist/setup/index.js'
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
- [Using `setup-python` with a self-hosted runner](advanced-usage.md#using-setup-python-with-a-self-hosted-runner)
|
- [Using `setup-python` with a self-hosted runner](advanced-usage.md#using-setup-python-with-a-self-hosted-runner)
|
||||||
- [Windows](advanced-usage.md#windows)
|
- [Windows](advanced-usage.md#windows)
|
||||||
- [Linux](advanced-usage.md#linux)
|
- [Linux](advanced-usage.md#linux)
|
||||||
- [MacOS](advanced-usage.md#macos)
|
- [macOS](advanced-usage.md#macos)
|
||||||
- [Using `setup-python` on GHES](advanced-usage.md#using-setup-python-on-ghes)
|
- [Using `setup-python` on GHES](advanced-usage.md#using-setup-python-on-ghes)
|
||||||
|
|
||||||
# Using python-version input
|
# Using python-version input
|
||||||
|
@ -32,8 +32,8 @@ steps:
|
||||||
- run: python my_script.py
|
- run: python my_script.py
|
||||||
```
|
```
|
||||||
|
|
||||||
- The only downside to this is that set-up will take a little longer since the exact version will have to be downloaded if the exact version is not already installed on the runner due to more recent versions.
|
- The only downside to this is that setup may take a little longer. If the exact version is not already installed on the runner due to more recent versions, the exact version will have to be downloaded.
|
||||||
- MSI installers are used on Windows for this, so runs will take a little longer to set up vs MacOS and Linux.
|
- MSI installers are used on Windows for this, so runs will take a little longer to set up vs macOS and Linux.
|
||||||
|
|
||||||
You can specify **only a major and minor version** if you are okay with the most recent patch version being used:
|
You can specify **only a major and minor version** if you are okay with the most recent patch version being used:
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ More details on PyPy syntax can be found in the [Available versions of PyPy](#py
|
||||||
|
|
||||||
## Matrix Testing
|
## Matrix Testing
|
||||||
|
|
||||||
Using `setup-python` it's possible to use [matrix syntax](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix) to install several versions of Python/PyPy:
|
Using `setup-python` it's possible to use [matrix syntax](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix) to install several versions of Python or PyPy:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -178,7 +178,7 @@ jobs:
|
||||||
|
|
||||||
# Using python-version-file input
|
# Using python-version-file input
|
||||||
|
|
||||||
`setup-python` action can read Python/PyPy version from a version file. `python-version-file` input is used for specifying the path to the version file. If the file that was supplied to `python-version-file` input doesn't exist, the action will fail with error.
|
`setup-python` action can read Python or PyPy version from a version file. `python-version-file` input is used for specifying the path to the version file. If the file that was supplied to `python-version-file` input doesn't exist, the action will fail with error.
|
||||||
|
|
||||||
>In case both `python-version` and `python-version-file` inputs are supplied, the `python-version-file` input will be ignored due to its lower priority.
|
>In case both `python-version` and `python-version-file` inputs are supplied, the `python-version-file` input will be ignored due to its lower priority.
|
||||||
|
|
||||||
|
@ -192,9 +192,9 @@ steps:
|
||||||
```
|
```
|
||||||
# Check latest version
|
# Check latest version
|
||||||
|
|
||||||
The `check-latest` flag defaults to `false`. Use the default or set `check-latest` to `false` if you prefer stability and if you want to ensure a specific `Python/PyPy` version is always used.
|
The `check-latest` flag defaults to `false`. Use the default or set `check-latest` to `false` if you prefer stability and if you want to ensure a specific `Python or PyPy` version is always used.
|
||||||
|
|
||||||
If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, a `Python/PyPy` version will then be downloaded. Set `check-latest` to `true` if you want the most up-to-date `Python/PyPy` version to always be used.
|
If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, a `Python or PyPy` version will then be downloaded. Set `check-latest` to `true` if you want the most up-to-date `Python or PyPy` version to always be used.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
|
@ -205,7 +205,7 @@ steps:
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- run: python my_script.py
|
- run: python my_script.py
|
||||||
```
|
```
|
||||||
> Setting `check-latest` to `true` has performance implications as downloading `Python/PyPy` versions is slower than using cached versions.
|
> Setting `check-latest` to `true` has performance implications as downloading `Python or PyPy` versions is slower than using cached versions.
|
||||||
|
|
||||||
|
|
||||||
# Caching packages data
|
# Caching packages data
|
||||||
|
@ -284,7 +284,7 @@ steps:
|
||||||
|
|
||||||
### `python-version`
|
### `python-version`
|
||||||
|
|
||||||
Using **python-version** output it's possible to get the installed by action Python/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.10.0 ), but down in a workflow you need to operate with the exact installed version (e.g. 3.10.1).
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -301,7 +301,7 @@ jobs:
|
||||||
|
|
||||||
### `python-path`
|
### `python-path`
|
||||||
|
|
||||||
**python-path** output is available with the absolute path of the Python/PyPy interpreter executable if you need it:
|
**python-path** output is available with the absolute path of the Python or PyPy interpreter executable if you need it:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -347,10 +347,10 @@ These environment variables become available after setup-python action execution
|
||||||
## Using `update-environment` flag
|
## Using `update-environment` flag
|
||||||
|
|
||||||
The `update-environment` flag defaults to `true`.
|
The `update-environment` flag defaults to `true`.
|
||||||
With this setting, the action will add/update environment variables (e.g. `PATH`, `PKG_CONFIG_PATH`, `pythonLocation`) for Python/PyPy to just work out of the box.
|
With this setting, the action will add/update environment variables (e.g. `PATH`, `PKG_CONFIG_PATH`, `pythonLocation`) for Python or PyPy to just work out of the box.
|
||||||
|
|
||||||
If `update-environment` is set to `false`, the action will not add/update environment variables.
|
If `update-environment` is set to `false`, the action will not add/update environment variables.
|
||||||
This can prove useful if you want the only side-effect to be to ensure Python/PyPy is installed and rely on the `python-path` output to run executable.
|
This can prove useful if you want the only side-effect to be to ensure Python or PyPy is installed and rely on the `python-path` output to run executable.
|
||||||
Such a requirement on side-effect could be because you don't want your composite action messing with your user's workflows.
|
Such a requirement on side-effect could be because you don't want your composite action messing with your user's workflows.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
@ -378,7 +378,7 @@ Such a requirement on side-effect could be because you don't want your composite
|
||||||
- All available versions are listed in the [version-manifest.json](https://github.com/actions/python-versions/blob/main/versions-manifest.json) file.
|
- 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
|
- If there is a specific version of Python that is not available, you can open an issue here
|
||||||
|
|
||||||
>**Note:** Python versions used in this action are generated in the [python-versions](https://github.com/actions/python-versions) repository. For MacOS and Ubuntu images, python versions are built from the source code. For Windows, the python-versions repository uses installation executable. For more information please refer to the [python-versions](https://github.com/actions/python-versions) repository.
|
>**Note:** Python versions used in this action are generated in the [python-versions](https://github.com/actions/python-versions) repository. For macOS and Ubuntu images, python versions are built from the source code. For Windows, the python-versions repository uses installation executable. For more information please refer to the [python-versions](https://github.com/actions/python-versions) repository.
|
||||||
|
|
||||||
## PyPy
|
## PyPy
|
||||||
|
|
||||||
|
@ -447,9 +447,9 @@ One quick way to grant access is to change the user and group of the non-default
|
||||||
> If your runner is configured as a service and you run into problems, make sure the user that the service is running as is correct. For more information, you can [check the status of your self-hosted runner](https://docs.github.com/en/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service#checking-the-status-of-the-service).
|
> If your runner is configured as a service and you run into problems, make sure the user that the service is running as is correct. For more information, you can [check the status of your self-hosted runner](https://docs.github.com/en/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service#checking-the-status-of-the-service).
|
||||||
|
|
||||||
|
|
||||||
## MacOS
|
## macOS
|
||||||
|
|
||||||
The Python packages for MacOS that are downloaded from `actions/python-versions` are originally compiled from the source in `/Users/runner/hostedtoolcache`. Due to the fixed shared library path, these Python packages are non-relocatable and require to be installed only in `/Users/runner/hostedtoolcache`. Before the use of `setup-python` on the MacOS self-hosted runner:
|
The Python packages for macOS that are downloaded from `actions/python-versions` are originally compiled from the source in `/Users/runner/hostedtoolcache`. Due to the fixed shared library path, these Python packages are non-relocatable and require to be installed only in `/Users/runner/hostedtoolcache`. Before the use of `setup-python` on the macOS self-hosted runner:
|
||||||
|
|
||||||
- Create a directory called `/Users/runner/hostedtoolcache`
|
- Create a directory called `/Users/runner/hostedtoolcache`
|
||||||
- Change the permissions of `/Users/runner/hostedtoolcache` so that the runner has write access
|
- Change the permissions of `/Users/runner/hostedtoolcache` so that the runner has write access
|
||||||
|
|
Loading…
Reference in a new issue