From c242fc955108229d5836c5624c30346a53e624db Mon Sep 17 00:00:00 2001 From: Dario Curreri Date: Tue, 6 Jun 2023 16:51:04 +0200 Subject: [PATCH] Add examples for version ranges and pyproject.toml --- docs/advanced-usage.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md index 1483da99..1ed6d934 100644 --- a/docs/advanced-usage.md +++ b/docs/advanced-usage.md @@ -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: +- **[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): ```yaml @@ -251,6 +262,16 @@ steps: python-version-file: '.python-version' # Read python version from a file .python-version - 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 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.