Skip to content

Commit 64d2f24

Browse files
authored
Merge pull request #24401 from cclauss/patch-2
Update building-and-testing-python.md
2 parents 65c8204 + 7fdffd8 commit 64d2f24

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

content/actions/automating-builds-and-tests/building-and-testing-python.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
runs-on: ubuntu-latest
5858
strategy:
5959
matrix:
60-
python-version: ["3.7", "3.8", "3.9", "3.10"]
60+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
6161
6262
steps:
6363
- uses: {% data reusables.actions.action-checkout %}
@@ -68,14 +68,14 @@ jobs:
6868
- name: Install dependencies
6969
run: |
7070
python -m pip install --upgrade pip
71-
pip install flake8 pytest
71+
pip install ruff pytest
7272
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
73-
- name: Lint with flake8
73+
- name: Lint with ruff
7474
run: |
7575
# stop the build if there are Python syntax errors or undefined names
76-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
77-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
78-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
76+
ruff --format=github --select=E9,F63,F7,F82 --target-version=py37 .
77+
# default set of ruff rules with GitHub Annotations
78+
ruff --format=github --target-version=py37 .
7979
- name: Test with pytest
8080
run: |
8181
pytest
@@ -112,9 +112,9 @@ jobs:
112112
runs-on: ubuntu-latest
113113
strategy:
114114
# You can use PyPy versions in python-version.
115-
# For example, {% ifversion actions-node16-action %}pypy-2.7 and pypy-3.8{% else %}pypy2 and pypy3{% endif %}
115+
# For example, {% ifversion actions-node16-action %}pypy2.7 and pypy3.9{% else %}pypy2 and pypy3{% endif %}
116116
matrix:
117-
python-version: ["2.7", "3.7", "3.8", "3.9", "3.10"]
117+
python-version: ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11"]
118118
119119
steps:
120120
- uses: {% data reusables.actions.action-checkout %}
@@ -129,7 +129,7 @@ jobs:
129129

130130
### Using a specific Python version
131131

132-
You can configure a specific version of python. For example, 3.9. Alternatively, you can use semantic version syntax to get the latest minor release. This example uses the latest minor release of Python 3.
132+
You can configure a specific version of Python. For example, 3.10. Alternatively, you can use semantic version syntax to get the latest minor release. This example uses the latest minor release of Python 3.
133133

134134
```yaml{:copy}
135135
name: Python package
@@ -157,7 +157,7 @@ jobs:
157157

158158
### Excluding a version
159159

160-
If you specify a version of Python that is not available, `setup-python` fails with an error such as: `##[error]Version 3.4 with arch x64 not found`. The error message includes the available versions.
160+
If you specify a version of Python that is not available, `setup-python` fails with an error such as: `##[error]Version 3.6 with arch x64 not found`. The error message includes the available versions.
161161

162162
You can also use the `exclude` keyword in your workflow if there is a configuration of Python that you do not wish to run. For more information, see "[AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategy)."
163163

@@ -173,7 +173,7 @@ jobs:
173173
strategy:
174174
matrix:
175175
os: [ubuntu-latest, macos-latest, windows-latest]
176-
python-version: ["3.7", "3.8", "3.9", "3.10", {% ifversion actions-node16-action %}pypy-2.7, pypy-3.8{% else %}pypy2, pypy3{% endif %}]
176+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", {% ifversion actions-node16-action %}pypy2.7, pypy3.9{% else %}pypy2, pypy3{% endif %}]
177177
exclude:
178178
- os: macos-latest
179179
python-version: "3.7"
@@ -238,7 +238,7 @@ steps:
238238
- uses: {% data reusables.actions.action-checkout %}
239239
- uses: {% data reusables.actions.action-setup-python %}
240240
with:
241-
python-version: '3.10'
241+
python-version: '3.11'
242242
cache: 'pip'
243243
- run: pip install -r requirements.txt
244244
- run: pip test
@@ -271,14 +271,13 @@ steps:
271271
pip install -r requirements.txt
272272
- name: Test with pytest
273273
run: |
274-
pip install pytest
275-
pip install pytest-cov
274+
pip install pytest pytest-cov
276275
pytest tests.py --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
277276
```
278277

279-
### Using Flake8 to lint code
278+
### Using Ruff to lint code
280279

281-
The following example installs or upgrades `flake8` and uses it to lint all files. For more information, see [Flake8](http://flake8.pycqa.org/en/latest/).
280+
The following example installs or upgrades `ruff` and uses it to lint all files. For more information, see [Ruff](https://beta.ruff.rs/docs).
282281

283282
```yaml{:copy}
284283
steps:
@@ -291,10 +290,10 @@ steps:
291290
run: |
292291
python -m pip install --upgrade pip
293292
pip install -r requirements.txt
294-
- name: Lint with flake8
293+
- name: Lint with Ruff
295294
run: |
296-
pip install flake8
297-
flake8 .
295+
pip install ruff
296+
ruff --format=github --target-version=py37 .
298297
continue-on-error: true
299298
```
300299

@@ -315,7 +314,7 @@ jobs:
315314
runs-on: ubuntu-latest
316315
strategy:
317316
matrix:
318-
python: ["3.8", "3.9", "3.10"]
317+
python: ["3.9", "3.10", "3.11"]
319318
320319
steps:
321320
- uses: {% data reusables.actions.action-checkout %}
@@ -347,7 +346,7 @@ jobs:
347346
runs-on: ubuntu-latest
348347
strategy:
349348
matrix:
350-
python-version: ["3.7", "3.8", "3.9", "3.10"]
349+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
351350
352351
steps:
353352
- uses: {% data reusables.actions.action-checkout %}

0 commit comments

Comments
 (0)