Skip to content

Commit 46ab299

Browse files
committed
Stop using setup-python
And de-dup docs Python version handling.
1 parent 16504ca commit 46ab299

File tree

3 files changed

+15
-26
lines changed

3 files changed

+15
-26
lines changed

.github/workflows/ci.yml

+7-24
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ jobs:
5050
run: |
5151
tar xf dist/*.tar.gz --strip-components=1
5252
rm -rf src
53-
- uses: actions/setup-python@v5
54-
with:
55-
python-version: ${{ matrix.python-version }}
56-
allow-prereleases: true
5753
- uses: hynek/setup-cached-uv@v2
5854

5955
- name: Prepare & run Nox
@@ -86,9 +82,6 @@ jobs:
8682
- uses: actions/checkout@v4
8783
with:
8884
persist-credentials: false
89-
- uses: actions/setup-python@v5
90-
with:
91-
python-version-file: .python-version-default
9285
- uses: hynek/setup-cached-uv@v2
9386

9487
- uses: actions/download-artifact@v4
@@ -98,7 +91,7 @@ jobs:
9891

9992
- name: Combine coverage & fail if it's <100%.
10093
run: |
101-
uv tool install coverage
94+
uv tool install --python $(cat .python-version-default) coverage
10295
10396
coverage combine
10497
coverage html --skip-covered --skip-empty
@@ -134,10 +127,6 @@ jobs:
134127
name: Packages
135128
path: dist
136129
- run: tar xf dist/*.tar.gz --strip-components=1
137-
- uses: actions/setup-python@v5
138-
with:
139-
python-version: ${{ matrix.python-version }}
140-
allow-prereleases: true
141130
- uses: hynek/setup-cached-uv@v2
142131

143132
- name: Check using Mypy
@@ -168,13 +157,14 @@ jobs:
168157
name: Packages
169158
path: dist
170159
- run: tar xf dist/*.tar.gz --strip-components=1
171-
- uses: actions/setup-python@v5
172-
with:
173-
python-version-file: .python-version-default
174160
- uses: hynek/setup-cached-uv@v2
175161

176162
- name: Prepare & run Nox
177-
run: uvx nox --sessions mypy_pkg
163+
run: >
164+
uvx
165+
--python $(cat .python-version-default)
166+
nox
167+
--sessions mypy_pkg
178168
179169
docs:
180170
name: Run doctests
@@ -187,10 +177,6 @@ jobs:
187177
name: Packages
188178
path: dist
189179
- run: tar xf dist/*.tar.gz --strip-components=1
190-
- uses: actions/setup-python@v5
191-
with:
192-
# Keep in sync with .readthedocs.yaml
193-
python-version: "3.13"
194180
- uses: hynek/setup-cached-uv@v2
195181

196182
- name: Prepare & run Nox
@@ -207,14 +193,11 @@ jobs:
207193
- uses: actions/checkout@v4
208194
with:
209195
persist-credentials: false
210-
- uses: actions/setup-python@v5
211-
with:
212-
python-version-file: .python-version-default
213196
- uses: hynek/setup-cached-uv@v2
214197

215198
- name: Install in dev mode
216199
run: |
217-
uv venv
200+
uv venv --python $(cat .python-version-default)
218201
uv pip install -e .[dev]
219202
220203
- name: Try to import on Linux

.readthedocs.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version: 2
44
build:
55
os: ubuntu-lts-latest
66
tools:
7-
# Keep version in sync with tox.ini/docs and ci.yml/docs.
87
python: "3.13"
98
jobs:
109
create_environment:

noxfile.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import os
88
import pathlib
9+
import re
910
import shutil
1011
import sys
1112

@@ -39,6 +40,12 @@
3940
if pv.startswith("Programming Language :: Python :: ")
4041
]
4142

43+
DOCS_PYTHON = re.search( # type: ignore[union-attr]
44+
r'^ +python: "(3\.\d+)"$',
45+
pathlib.Path(".readthedocs.yaml").read_text(),
46+
flags=re.MULTILINE,
47+
).group(1)
48+
4249

4350
@nox.session
4451
def pre_commit(session: nox.Session) -> None:
@@ -107,7 +114,7 @@ def coverage_report(session: nox.Session) -> None:
107114
session.run("coverage", "report")
108115

109116

110-
@nox.session
117+
@nox.session(python=DOCS_PYTHON)
111118
def docs(session: nox.Session) -> None:
112119
shutil.rmtree("docs/_build", ignore_errors=True)
113120

0 commit comments

Comments
 (0)