Skip to content

Commit 747b9de

Browse files
authored
Simplify CI and use .python-version (#1140)
* Simplify CI and use .python-version * Test CI on pypy 3.9 too * We don't need .gitignore to keep the dir anymore
1 parent 2b3a427 commit 747b9de

File tree

6 files changed

+23
-15
lines changed

6 files changed

+23
-15
lines changed

.github/CONTRIBUTING.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,17 @@ The official tag is `python-attrs` and helping out in support frees us up to imp
4141

4242
You can (and should) run our test suite using [*tox*].
4343
However, you’ll probably want a more traditional environment as well.
44-
We highly recommend to develop using the latest Python release because we try to take advantage of modern features whenever possible.
45-
Also, running [*pre-commit*] later on will require the latest Python version.
4644

47-
First [fork](https://github.com/python-attrs/attrs/fork) the repository on GitHub.
45+
First, create a [virtual environment](https://virtualenv.pypa.io/) so you don't break your system-wide Python installation.
46+
We recommend using the Python version from the `.python-version` file in project's root directory.
47+
48+
If you're using [*direnv*](https://direnv.net), you can automate the creation of a virtual environment with the correct Python version by adding the following `.envrc` to the project root after you've cloned it to your computer:
49+
50+
```bash
51+
layout python python$(cat .python-version)
52+
```
53+
54+
Then, [fork](https://github.com/python-attrs/attrs/fork) the repository on GitHub.
4855

4956
Clone the fork to your computer:
5057

.github/workflows/ci.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ env:
1414
TOX_TESTENV_PASSENV: FORCE_COLOR
1515
PIP_DISABLE_PIP_VERSION_CHECK: "1"
1616
PIP_NO_PYTHON_VERSION_WARNING: "1"
17-
# Keep in sync with .pre-commit-config.yaml/default_language_version/python.
18-
PYTHON_LATEST: "3.11"
1917
# Use oldest version used in doctests / examples.
2018
SETUPTOOLS_SCM_PRETEND_VERSION: "19.2.0"
19+
# N.B. default Python version for setup-python comes from the .python-version
20+
# file at the root of the project.
2121

2222
permissions:
2323
contents: read
@@ -36,9 +36,10 @@ jobs:
3636
- "3.9"
3737
- "3.10"
3838
- "3.11"
39-
- "~3.12.0-0"
39+
- "3.12"
4040
- "pypy-3.7"
4141
- "pypy-3.8"
42+
- "pypy-3.9"
4243

4344
continue-on-error: >-
4445
${{ contains(matrix.python-version, '~') && true || false }}
@@ -48,6 +49,8 @@ jobs:
4849
- uses: actions/setup-python@v4
4950
with:
5051
python-version: ${{ matrix.python-version }}
52+
allow-prereleases: true
53+
5154
- run: python -Im pip install --upgrade wheel tox
5255

5356
- name: Determine Python version for tox
@@ -82,9 +85,6 @@ jobs:
8285
steps:
8386
- uses: actions/checkout@v3
8487
- uses: actions/setup-python@v4
85-
with:
86-
# Use latest Python, so it understands all syntax.
87-
python-version: ${{env.PYTHON_LATEST}}
8888

8989
- run: python -Im pip install --upgrade coverage[toml]
9090

@@ -131,12 +131,14 @@ jobs:
131131
- "3.9"
132132
- "3.10"
133133
- "3.11"
134+
- "3.12"
134135

135136
steps:
136137
- uses: actions/checkout@v3
137138
- uses: actions/setup-python@v4
138139
with:
139140
python-version: ${{ matrix.python-version }}
141+
allow-prereleases: true
140142

141143
- run: python -Im pip install --upgrade wheel tox
142144
- run: python -Im tox run -e mypy
@@ -147,8 +149,6 @@ jobs:
147149
steps:
148150
- uses: actions/checkout@v3
149151
- uses: actions/setup-python@v4
150-
with:
151-
python-version: ${{env.PYTHON_LATEST}}
152152

153153
- run: python -Im pip install --upgrade wheel tox
154154
- run: python -Im tox run -e pyright
@@ -163,8 +163,7 @@ jobs:
163163
steps:
164164
- uses: actions/checkout@v3
165165
- uses: actions/setup-python@v4
166-
with:
167-
python-version: ${{env.PYTHON_LATEST}}
166+
168167
- run: python -Im pip install -e .[dev]
169168
- run: python -Ic 'import attr; print(attr.__version__)'
170169
- run: python -Ic 'import attrs; print(attrs.__version__)'

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ci:
33
autoupdate_schedule: monthly
44

55
default_language_version:
6-
# Keep in sync with ci.yml/PYTHON_LATEST
6+
# Keep in-sync with .python-version
77
python: python3.11
88

99
repos:

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

changelog.d/.gitignore

Whitespace-only changes.

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ isolated_build = True
44

55

66
[testenv:docs]
7-
# Keep basepython in sync with ci.yml/docs and .readthedocs.yaml.
7+
# Keep basepython in-sync with ci.yml/docs and .readthedocs.yaml.
88
basepython = python3.11
99
extras = docs
1010
commands =
@@ -31,6 +31,7 @@ commands = coverage run -m pytest {posargs:-n auto}
3131

3232

3333
[testenv:coverage-report]
34+
# Keep basepython in-sync with .python-version
3435
basepython = python3.11
3536
depends = py3{7,10,11}
3637
skip_install = true

0 commit comments

Comments
 (0)