You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -9,7 +9,7 @@ This action sets up a Python environment for use in actions by:
9
9
- optionally installing and adding to PATH a version of Python that is already installed in the tools cache.
10
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 tools cache.
11
11
- failing if a specific version of Python is not preinstalled or available for download.
12
-
- optionally caching dependencies for pipand pipenv.
12
+
- optionally caching dependencies for pip, pipenv and poetry.
13
13
- registering problem matchers for error output.
14
14
15
15
# What's new
@@ -19,7 +19,7 @@ This action sets up a Python environment for use in actions by:
19
19
- Automatic setup and download of Python packages if using a self-hosted runner.
20
20
- Support for pre-release versions of Python.
21
21
- Support for installing any version of PyPy on-flight
22
-
- Support for built-in caching of pipand pipenv dependencies
22
+
- Support for built-in caching of pip, pipenv and poetry dependencies
23
23
24
24
# Usage
25
25
@@ -28,8 +28,8 @@ See [action.yml](action.yml)
28
28
Basic:
29
29
```yaml
30
30
steps:
31
-
- uses: actions/checkout@v2
32
-
- uses: actions/setup-python@v2
31
+
- uses: actions/checkout@v3
32
+
- uses: actions/setup-python@v3
33
33
with:
34
34
python-version: '3.x'# Version range or exact version of a Python version to use, using SemVer's version range syntax
35
35
architecture: 'x64'# optional x64 or x86. Defaults to x64 if not specified
The action has built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/toolkit/tree/main/packages/cache) under the hood for caching dependencies but requires less configuration settings. Supported package managers are `pip`and `pipenv`. The `cache` input is optional, and caching is turned off by default.
212
+
The action has built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/toolkit/tree/main/packages/cache) under the hood for caching dependencies but requires less configuration settings. Supported package managers are `pip`, `pipenv` and `poetry`. The `cache` input is optional, and caching is turned off by default.
213
213
214
-
The action defaults to searching for a dependency file (`requirements.txt` for pip or `Pipfile.lock` for pipenv) in the repository, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases where multiple dependency files are used, they are located in different subdirectories or different files for the hash want to be used.
214
+
The action defaults to searching for a dependency file (`requirements.txt` for pip, `Pipfile.lock` for pipenv or `poetry.lock` for poetry) in the repository, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases where multiple dependency files are used, they are located in different subdirectories or different files for the hash want to be used.
215
215
216
216
- For pip, the action will cache global cache directory
217
217
- For pipenv, the action will cache virtualenv directory
218
+
- For poetry, the action will cache virtualenv directory
218
219
219
220
**Please Note:** Restored cache will not be used if the requirements.txt file is not updated for a long time and a newer version of the dependency is available that can lead to an increase in total build time.
220
221
221
222
The requirements file format allows to specify dependency versions using logical operators (for example chardet>=3.0.4) or specify dependencies without any versions. In this case the pip install -r requirements.txt command will always try to install the latest available package version. To be sure that the cache will be used, please stick to a specific dependency version and update it manually if necessary.
222
223
223
-
**Caching pip dependencies:**
224
+
**Caching pip dependencies:**
224
225
225
226
```yaml
226
227
steps:
227
-
- uses: actions/checkout@v2
228
-
- uses: actions/setup-python@v2
228
+
- uses: actions/checkout@v3
229
+
- uses: actions/setup-python@v3
229
230
with:
230
231
python-version: '3.9'
231
232
cache: 'pip'
@@ -235,21 +236,35 @@ steps:
235
236
**Caching pipenv dependencies:**
236
237
```yaml
237
238
steps:
238
-
- uses: actions/checkout@v2
239
+
- uses: actions/checkout@v3
239
240
- name: Install pipenv
240
241
run: pipx install pipenv
241
-
- uses: actions/setup-python@v2
242
+
- uses: actions/setup-python@v3
242
243
with:
243
244
python-version: '3.9'
244
245
cache: 'pipenv'
245
246
- run: pipenv install
246
247
```
247
248
249
+
**Caching poetry dependencies:**
250
+
```yaml
251
+
steps:
252
+
- uses: actions/checkout@v3
253
+
- name: Install poetry
254
+
run: pipx install poetry
255
+
- uses: actions/setup-python@v3
256
+
with:
257
+
python-version: '3.9'
258
+
cache: 'poetry'
259
+
- run: poetry install
260
+
- run: poetry run pytest
261
+
```
262
+
248
263
**Using wildcard patterns to cache dependencies**
249
264
```yaml
250
265
steps:
251
-
- uses: actions/checkout@v2
252
-
- uses: actions/setup-python@v2
266
+
- uses: actions/checkout@v3
267
+
- uses: actions/setup-python@v3
253
268
with:
254
269
python-version: '3.9'
255
270
cache: 'pip'
@@ -260,10 +275,10 @@ steps:
260
275
**Using a list of file paths to cache dependencies**
0 commit comments