mirror of
https://github.com/actions/setup-python.git
synced 2025-04-24 15:32:13 +00:00
Add examples for version ranges and pyproject.toml
This commit is contained in:
parent
0422415e8a
commit
c242fc9551
1 changed files with 21 additions and 0 deletions
|
@ -78,6 +78,17 @@ steps:
|
||||||
|
|
||||||
You can also use several types of ranges that are specified in [semver](https://github.com/npm/node-semver#ranges), for instance:
|
You can also use several types of ranges that are specified in [semver](https://github.com/npm/node-semver#ranges), for instance:
|
||||||
|
|
||||||
|
- **[ranges](https://github.com/npm/node-semver#ranges)** to download and set up the latest available version of Python satisfying a range:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '>=3.9 <3.10'
|
||||||
|
- run: python my_script.py
|
||||||
|
```
|
||||||
|
|
||||||
- **[hyphen ranges](https://github.com/npm/node-semver#hyphen-ranges-xyz---abc)** to download and set up the latest available version of Python (includes both pre-release and stable versions):
|
- **[hyphen ranges](https://github.com/npm/node-semver#hyphen-ranges-xyz---abc)** to download and set up the latest available version of Python (includes both pre-release and stable versions):
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
@ -251,6 +262,16 @@ steps:
|
||||||
python-version-file: '.python-version' # Read python version from a file .python-version
|
python-version-file: '.python-version' # Read python version from a file .python-version
|
||||||
- run: python my_script.py
|
- run: python my_script.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version-file: 'pyproject.toml' # Read python version from a file pyproject.toml
|
||||||
|
- run: python my_script.py
|
||||||
|
```
|
||||||
|
|
||||||
## 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 or 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.
|
||||||
|
|
Loading…
Add table
Reference in a new issue