1- # setup-python V3
1+ # setup-python V4
22
33<p align =" left " >
44 <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:
2020- Support for pre-release versions of Python.
2121- Support for installing any version of PyPy on-flight
2222- Support for built-in caching of pip, pipenv and poetry dependencies
23+ - Support for ` .python-version ` file
2324
2425# Usage
2526
@@ -29,13 +30,23 @@ Basic:
2930``` yaml
3031steps :
3132- uses : actions/checkout@v3
32- - uses : actions/setup-python@v3
33+ - uses : actions/setup-python@v4
3334 with :
3435 python-version : ' 3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
3536 architecture : ' x64' # optional x64 or x86. Defaults to x64 if not specified
3637- run : python my_script.py
3738` ` `
3839
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+
3950Matrix Testing:
4051` ` ` yaml
4152jobs :
4859 steps :
4960 - uses : actions/checkout@v3
5061 - name : Set up Python
51- uses : actions/setup-python@v3
62+ uses : actions/setup-python@v4
5263 with :
5364 python-version : ${{ matrix.python-version }}
5465 architecture : x64
7283 steps :
7384 - uses : actions/checkout@v3
7485 - name : Set up Python
75- uses : actions/setup-python@v3
86+ uses : actions/setup-python@v4
7687 with :
7788 python-version : ${{ matrix.python-version }}
7889 - name : Display Python version
90101 python-version : ['3.7.4', '3.8', '3.9', '3.10']
91102 steps :
92103 - uses : actions/checkout@v3
93- - uses : actions/setup-python@v3
104+ - uses : actions/setup-python@v4
94105 with :
95106 python-version : ${{ matrix.python-version }}
96107 - run : python my_script.py
@@ -100,7 +111,7 @@ Download and set up an accurate pre-release version of Python:
100111` ` ` yaml
101112steps :
102113- uses : actions/checkout@v3
103- - uses : actions/setup-python@v3
114+ - uses : actions/setup-python@v4
104115 with :
105116 python-version : ' 3.11.0-alpha.1'
106117- run : python my_script.py
@@ -110,7 +121,7 @@ Download and set up the latest available version of Python (includes both pre-re
110121` ` ` yaml
111122steps :
112123- uses : actions/checkout@v3
113- - uses : actions/setup-python@v3
124+ - uses : actions/setup-python@v4
114125 with :
115126 python-version : ' 3.11.0-alpha - 3.11.0' # SemVer's version range syntax
116127- run : python my_script.py
@@ -130,7 +141,7 @@ jobs:
130141 - ' pypy3.8' # the latest available version of PyPy that supports Python 3.8
131142 steps :
132143 - uses : actions/checkout@v3
133- - uses : actions/setup-python@v3
144+ - uses : actions/setup-python@v4
134145 with :
135146 python-version : ${{ matrix.python-version }}
136147 - run : python my_script.py
@@ -144,7 +155,7 @@ jobs:
144155 runs-on : ubuntu-latest
145156 steps :
146157 - uses : actions/checkout@v3
147- - uses : actions/setup-python@v3
158+ - uses : actions/setup-python@v4
148159 id : cp310
149160 with :
150161 python-version : " 3.10"
@@ -245,7 +256,7 @@ The requirements file format allows to specify dependency versions using logical
245256```yaml
246257steps:
247258- uses: actions/checkout@v3
248- - uses: actions/setup-python@v3
259+ - uses: actions/setup-python@v4
249260 with:
250261 python-version: '3.9'
251262 cache: 'pip'
@@ -258,7 +269,7 @@ steps:
258269- uses : actions/checkout@v3
259270- name : Install pipenv
260271 run : pipx install pipenv
261- - uses : actions/setup-python@v3
272+ - uses : actions/setup-python@v4
262273 with :
263274 python-version : ' 3.9'
264275 cache : ' pipenv'
@@ -271,7 +282,7 @@ steps:
271282- uses : actions/checkout@v3
272283- name : Install poetry
273284 run : pipx install poetry
274- - uses : actions/setup-python@v3
285+ - uses : actions/setup-python@v4
275286 with :
276287 python-version : ' 3.9'
277288 cache : ' poetry'
@@ -283,7 +294,7 @@ steps:
283294` ` ` yaml
284295steps :
285296- uses : actions/checkout@v3
286- - uses : actions/setup-python@v3
297+ - uses : actions/setup-python@v4
287298 with :
288299 python-version : ' 3.9'
289300 cache : ' pip'
@@ -297,7 +308,7 @@ steps:
297308- uses : actions/checkout@v3
298309- name : Install pipenv
299310 run : pipx install pipenv
300- - uses : actions/setup-python@v3
311+ - uses : actions/setup-python@v4
301312 with :
302313 python-version : ' 3.9'
303314 cache : ' pipenv'
0 commit comments