I want to update my GitHub Actions workflow to reflect the availability of Python 3.11.
This is the list of available Python versions, which include:
- “3.11.0-beta.3”
- “3.11.0-beta.2”
This is the test matrix:
JavaScript
x
40
40
1
name: Python package
2
3
on:
4
push:
5
branches: [ master ]
6
pull_request:
7
branches: [ master ]
8
9
jobs:
10
build:
11
12
runs-on: ubuntu-latest
13
strategy:
14
fail-fast: false
15
matrix:
16
python-version: ["3.8", "3.9", "3.10"]
17
18
steps:
19
- uses: actions/checkout@v2
20
- name: Set up Python ${{ matrix.python-version }}
21
uses: actions/setup-python@v2
22
with:
23
python-version: ${{ matrix.python-version }}
24
- name: Install dependencies
25
run: |
26
python -m pip install --upgrade pip
27
python -m pip install flake8 pytest
28
pip install -r requirements.txt
29
- name: Lint with flake8
30
run: |
31
# stop the build if there are Python syntax errors or undefined names
32
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
33
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
34
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
35
- name: Test with pytest
36
run: |
37
python -m pytest tests --timesensitive
38
39
40
How do I add the latest Python release?
This doesn’t work:
JavaScript
1
3
1
matrix:
2
python-version: ["3.8", "3.9", "3.10", "3.11"]
3
Error:
JavaScript
1
9
1
Run actions/setup-python@v2
2
with:
3
python-version: 3.11
4
token: ***
5
Version 3.11 was not found in the local cache
6
Error: Version 3.11 with arch x64 not found
7
The list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
8
9
Advertisement
Answer
The error was using 3.11 without further specification as 3.11 doesn’t exist.
This solves the issue:
JavaScript
1
3
1
matrix:
2
python-version: ["3.8", "3.9", "3.10", "3.11.0-beta.3"]
3