Skip to content

Commit cfcafa5

Browse files
author
IvanZosimov
committed
Fix review points
1 parent c318b92 commit cfcafa5

File tree

2 files changed

+21
-23
lines changed

2 files changed

+21
-23
lines changed

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
This action provides the following functionality for GitHub Actions users:
88

9-
- Optionally installing and adding to PATH a version of Python that is already installed in the runner's tool cache.
10-
- 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.
11-
- Failing if a specific version of Python is not preinstalled or available for download.
9+
- Installing a version of Python or PyPy and (by default) adding it to the PATH
1210
- Optionally caching dependencies for pip, pipenv and poetry
1311
- Registering problem matchers for error output
1412

docs/advanced-usage.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contents
1+
# Advanced Usage
22
- [Using python-version input](advanced-usage.md#using-python-version-input)
33
- [Specifying a Python version](advanced-usage.md#specifying-a-python-version)
44
- [Specifying a PyPy version](advanced-usage.md#specifying-a-pypy-version)
@@ -17,9 +17,9 @@
1717
- [macOS](advanced-usage.md#macos)
1818
- [Using `setup-python` on GHES](advanced-usage.md#using-setup-python-on-ghes)
1919

20-
# Using python-version input
20+
## Using the `python-version` input
2121

22-
## Specifying a Python version
22+
### Specifying a Python version
2323

2424
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`):
2525

@@ -96,7 +96,7 @@ steps:
9696
```
9797
Please refer to the [Advanced range syntax section](https://github.com/npm/node-semver#advanced-range-syntax) of the [semver](https://github.com/npm/node-semver) to check other available range syntaxes.
9898
99-
## Specifying a PyPy version
99+
### Specifying a PyPy version
100100
The version of PyPy should be specified in the format `pypy<python_version>[-v<pypy_version>]` or `pypy-<python_version>[-v<pypy_version>]`.
101101
The `-v<pypy_version>` parameter is optional and can be skipped. The latest PyPy version will be used in this case.
102102

@@ -129,7 +129,7 @@ jobs:
129129
```
130130
More details on PyPy syntax can be found in the [Available versions of PyPy](#pypy) section.
131131

132-
## Matrix Testing
132+
### Matrix Testing
133133

134134
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:
135135

@@ -176,7 +176,7 @@ jobs:
176176
run: python --version
177177
```
178178
179-
# Using python-version-file input
179+
## Using the `python-version-file` input
180180

181181
`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.
182182

@@ -190,7 +190,7 @@ steps:
190190
python-version-file: '.python-version' # Read python version from a file .python-version
191191
- run: python my_script.py
192192
```
193-
# Check latest version
193+
## Check latest version
194194

195195
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.
196196

@@ -208,7 +208,7 @@ steps:
208208
> Setting `check-latest` to `true` has performance implications as downloading `Python or PyPy` versions is slower than using cached versions.
209209

210210

211-
# Caching packages data
211+
## Caching packages
212212

213213
**Caching pipenv dependencies:**
214214
```yaml
@@ -278,9 +278,9 @@ steps:
278278
- run: pip install -e . -r subdirectory/requirements-dev.txt
279279
```
280280

281-
# Environment variables and action's outputs
281+
# Outputs and environment variables
282282

283-
## Action's outputs
283+
## Outputs
284284

285285
### `python-version`
286286

@@ -363,8 +363,8 @@ Such a requirement on side-effect could be because you don't want your composite
363363
update-environment: false
364364
- run: ${{ steps.cp310.outputs.python-path }} my_script.py
365365
```
366-
# Available versions of Python and PyPy
367-
## Python
366+
## Available versions of Python and PyPy
367+
### Python
368368

369369
`setup-python` is able to configure **Python** from two sources:
370370

@@ -380,7 +380,7 @@ Such a requirement on side-effect could be because you don't want your composite
380380

381381
>**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.
382382
383-
## PyPy
383+
### PyPy
384384

385385
`setup-python` is able to configure **PyPy** from two sources:
386386

@@ -394,7 +394,7 @@ Such a requirement on side-effect could be because you don't want your composite
394394
- PyPy < 7.3.3 are not available to install on-flight.
395395
- If some versions are not available, you can open an issue in https://foss.heptapod.net/pypy/pypy/
396396

397-
# Hosted tool cache
397+
## Hosted tool cache
398398

399399
GitHub hosted runners have a tool cache that comes with a few versions of Python + PyPy already installed. This tool cache helps speed up runs and tool setup by not requiring any new downloads. There is an environment variable called `RUNNER_TOOL_CACHE` on each runner that describes the location of the tool cache with Python and PyPy installed. `setup-python` works by taking a specific version of Python or PyPy from this tool cache and adding it to PATH.
400400

@@ -409,14 +409,14 @@ GitHub virtual environments are set up in [actions/virtual-environments](https:/
409409
- Tool cache setup for Windows: [Install-Toolset.ps1](https://github.com/actions/virtual-environments/blob/main/images/win/scripts/Installers/Install-Toolset.ps1) [Configure-Toolset.ps1](https://github.com/actions/virtual-environments/blob/main/images/win/scripts/Installers/Configure-Toolset.ps1)
410410

411411

412-
# Using `setup-python` with a self-hosted runner
412+
## Using `setup-python` with a self-hosted runner
413413

414414
Python distributions are only available for the same [environments](https://github.com/actions/virtual-environments#available-environments) that GitHub Actions hosted environments are available for. If you are using an unsupported version of Ubuntu such as `19.04` or another Linux distribution such as Fedora, `setup-python` may not work.
415415

416416
If you have a supported self-hosted runner and you would like to use `setup-python`, there are a few extra things you need to make sure are set up so that new versions of Python can be downloaded and configured on your runner.
417417

418418

419-
## Windows
419+
### Windows
420420

421421
- Your runner needs to be running with administrator privileges so that the appropriate directories and files can be set up when downloading and installing a new version of Python for the first time.
422422
- If your runner is configured as a service, make sure the account that is running the service has the appropriate write permissions so that Python can get installed. The default `NT AUTHORITY\NETWORK SERVICE` should be sufficient.
@@ -428,7 +428,7 @@ If you have a supported self-hosted runner and you would like to use `setup-pyth
428428
429429
>If you are experiencing problems while configuring Python on your self-hosted runner, turn on [step debugging](https://github.com/actions/toolkit/blob/main/docs/action-debugging.md#step-debug-logs) to see additional logs.
430430
431-
## Linux
431+
### Linux
432432

433433
By default runner downloads and installs tools into the folder set up by `RUNNER_TOOL_CACHE` environment variable. The environment variable called `AGENT_TOOLSDIRECTORY` can be set to change this location for Linux self-hosted runners:
434434
- In the same shell that your runner is using, type `export AGENT_TOOLSDIRECTORY=/path/to/folder`.
@@ -447,7 +447,7 @@ One quick way to grant access is to change the user and group of the non-default
447447
> 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).
448448
449449

450-
## macOS
450+
### macOS
451451

452452
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:
453453

@@ -466,8 +466,8 @@ One quick way to grant access is to change the user and group of `/Users/runner/
466466
467467

468468

469-
# Using `setup-python` on GHES
469+
## Using `setup-python` on GHES
470470

471471
`setup-python` comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading Python distributions, `setup-python` downloads distributions from [`actions/python-versions`](https://github.com/actions/python-versions) on github.com (outside of the appliance). These calls to `actions/python-versions` are made via unauthenticated requests, which are limited to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting). If more requests are made within the time frame, then you will start to see rate-limit errors during downloading that looks like: `##[error]API rate limit exceeded for...`.
472472

473-
To avoid hitting rate-limit problems, we recommend [setting up your own runner tool cache](https://docs.github.com/en/[email protected]/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access#about-the-included-setup-actions-and-the-runner-tool-cache).
473+
To avoid hitting rate-limit problems, we recommend [setting up your own runner tool cache](https://docs.github.com/en/[email protected]/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access#about-the-included-setup-actions-and-the-runner-tool-cache).

0 commit comments

Comments
 (0)