1
- # setup-python V3
1
+ # setup-python V4
2
2
3
3
<p align =" left " >
4
4
<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 >
@@ -20,6 +20,7 @@ This action sets up a Python environment for use in actions by:
20
20
- Support for pre-release versions of Python.
21
21
- Support for installing any version of PyPy on-flight
22
22
- Support for built-in caching of pip, pipenv and poetry dependencies
23
+ - Support for ` .python-version ` file
23
24
24
25
# Usage
25
26
@@ -29,13 +30,23 @@ Basic:
29
30
``` yaml
30
31
steps :
31
32
- uses : actions/checkout@v3
32
- - uses : actions/setup-python@v3
33
+ - uses : actions/setup-python@v4
33
34
with :
34
35
python-version : ' 3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
35
36
architecture : ' x64' # optional x64 or x86. Defaults to x64 if not specified
36
37
- run : python my_script.py
37
38
` ` `
38
39
40
+ Read Python version from file:
41
+ ` ` ` yaml
42
+ steps :
43
+ - uses : actions/checkout@v3
44
+ - uses : actions/setup-python@v4
45
+ with :
46
+ python-version-file : ' .python-version' # Read python version from a file
47
+ - run : python my_script.py
48
+ ` ` `
49
+
39
50
Matrix Testing:
40
51
` ` ` yaml
41
52
jobs :
48
59
steps :
49
60
- uses : actions/checkout@v3
50
61
- name : Set up Python
51
- uses : actions/setup-python@v3
62
+ uses : actions/setup-python@v4
52
63
with :
53
64
python-version : ${{ matrix.python-version }}
54
65
architecture : x64
72
83
steps :
73
84
- uses : actions/checkout@v3
74
85
- name : Set up Python
75
- uses : actions/setup-python@v3
86
+ uses : actions/setup-python@v4
76
87
with :
77
88
python-version : ${{ matrix.python-version }}
78
89
- name : Display Python version
90
101
python-version : ['3.7.4', '3.8', '3.9', '3.10']
91
102
steps :
92
103
- uses : actions/checkout@v3
93
- - uses : actions/setup-python@v3
104
+ - uses : actions/setup-python@v4
94
105
with :
95
106
python-version : ${{ matrix.python-version }}
96
107
- run : python my_script.py
@@ -100,7 +111,7 @@ Download and set up an accurate pre-release version of Python:
100
111
` ` ` yaml
101
112
steps :
102
113
- uses : actions/checkout@v3
103
- - uses : actions/setup-python@v3
114
+ - uses : actions/setup-python@v4
104
115
with :
105
116
python-version : ' 3.11.0-alpha.1'
106
117
- run : python my_script.py
@@ -110,7 +121,7 @@ Download and set up the latest available version of Python (includes both pre-re
110
121
` ` ` yaml
111
122
steps :
112
123
- uses : actions/checkout@v3
113
- - uses : actions/setup-python@v3
124
+ - uses : actions/setup-python@v4
114
125
with :
115
126
python-version : ' 3.11.0-alpha - 3.11.0' # SemVer's version range syntax
116
127
- run : python my_script.py
@@ -130,7 +141,7 @@ jobs:
130
141
- ' pypy3.8' # the latest available version of PyPy that supports Python 3.8
131
142
steps :
132
143
- uses : actions/checkout@v3
133
- - uses : actions/setup-python@v3
144
+ - uses : actions/setup-python@v4
134
145
with :
135
146
python-version : ${{ matrix.python-version }}
136
147
- run : python my_script.py
@@ -144,7 +155,7 @@ jobs:
144
155
runs-on : ubuntu-latest
145
156
steps :
146
157
- uses : actions/checkout@v3
147
- - uses : actions/setup-python@v3
158
+ - uses : actions/setup-python@v4
148
159
id : cp310
149
160
with :
150
161
python-version : " 3.10"
@@ -245,7 +256,7 @@ The requirements file format allows to specify dependency versions using logical
245
256
```yaml
246
257
steps:
247
258
- uses: actions/checkout@v3
248
- - uses: actions/setup-python@v3
259
+ - uses: actions/setup-python@v4
249
260
with:
250
261
python-version: '3.9'
251
262
cache: 'pip'
@@ -258,7 +269,7 @@ steps:
258
269
- uses : actions/checkout@v3
259
270
- name : Install pipenv
260
271
run : pipx install pipenv
261
- - uses : actions/setup-python@v3
272
+ - uses : actions/setup-python@v4
262
273
with :
263
274
python-version : ' 3.9'
264
275
cache : ' pipenv'
@@ -271,7 +282,7 @@ steps:
271
282
- uses : actions/checkout@v3
272
283
- name : Install poetry
273
284
run : pipx install poetry
274
- - uses : actions/setup-python@v3
285
+ - uses : actions/setup-python@v4
275
286
with :
276
287
python-version : ' 3.9'
277
288
cache : ' poetry'
@@ -283,7 +294,7 @@ steps:
283
294
` ` ` yaml
284
295
steps :
285
296
- uses : actions/checkout@v3
286
- - uses : actions/setup-python@v3
297
+ - uses : actions/setup-python@v4
287
298
with :
288
299
python-version : ' 3.9'
289
300
cache : ' pip'
@@ -297,7 +308,7 @@ steps:
297
308
- uses : actions/checkout@v3
298
309
- name : Install pipenv
299
310
run : pipx install pipenv
300
- - uses : actions/setup-python@v3
311
+ - uses : actions/setup-python@v4
301
312
with :
302
313
python-version : ' 3.9'
303
314
cache : ' pipenv'
0 commit comments