Skip to content

Commit 13f17b6

Browse files
committed
-> uv
1 parent 40bc2db commit 13f17b6

File tree

4 files changed

+80
-85
lines changed

4 files changed

+80
-85
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,30 @@ name: CI
22

33
on:
44
push:
5+
branches-ignore:
6+
- "wip*"
7+
tags:
8+
- "v*"
59
pull_request:
6-
release:
7-
types: [published]
810
schedule:
911
# Daily at 5:41
1012
- cron: "41 5 * * *"
1113

12-
env:
13-
PIP_DISABLE_PIP_VERSION_CHECK: "1"
14-
PIP_NO_PYTHON_VERSION_WARNING: "1"
15-
1614
jobs:
17-
pre-commit:
18-
runs-on: ubuntu-latest
19-
steps:
20-
- uses: actions/checkout@v4
21-
- uses: actions/setup-python@v5
22-
with:
23-
python-version: "3.x"
24-
- uses: pre-commit/[email protected]
25-
2615
list:
2716
runs-on: ubuntu-latest
2817
outputs:
2918
noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }}
3019
steps:
3120
- uses: actions/checkout@v4
32-
- name: Set up nox
33-
uses: wntrblm/[email protected]
21+
- name: Set up uv
22+
uses: astral-sh/setup-uv@v6
23+
with:
24+
enable-cache: true
3425
- id: noxenvs-matrix
3526
run: |
3627
echo >>$GITHUB_OUTPUT noxenvs=$(
37-
nox --list-sessions --json | jq '[.[].session]'
28+
uvx nox --list-sessions --json | jq '[.[].session]'
3829
)
3930
4031
ci:
@@ -48,7 +39,7 @@ jobs:
4839
posargs: [""]
4940
include:
5041
- os: ubuntu-latest
51-
noxenv: "tests-3.11"
42+
noxenv: "tests-3.13"
5243
posargs: coverage github
5344

5445
steps:
@@ -63,38 +54,44 @@ jobs:
6354
uses: actions/setup-python@v5
6455
with:
6556
python-version: |
66-
3.8
6757
3.9
6858
3.10
6959
3.11
7060
3.12
61+
3.13
7162
pypy3.10
7263
allow-prereleases: true
73-
- name: Set up nox
74-
uses: wntrblm/[email protected]
64+
65+
- name: Set up uv
66+
uses: astral-sh/setup-uv@v6
67+
with:
68+
enable-cache: true
69+
7570
- name: Run nox
76-
run: nox -s "${{ matrix.noxenv }}" -- ${{ matrix.posargs }}
71+
run: uvx nox -s "${{ matrix.noxenv }}" -- ${{ matrix.posargs }}
7772

7873
packaging:
7974
needs: ci
8075
runs-on: ubuntu-latest
8176
environment:
8277
name: PyPI
8378
url: https://pypi.org/p/referencing-http
79+
8480
permissions:
8581
contents: write
8682
id-token: write
8783

8884
steps:
8985
- uses: actions/checkout@v4
90-
- name: Set up Python
91-
uses: actions/setup-python@v5
86+
87+
- name: Set up uv
88+
uses: astral-sh/setup-uv@v6
9289
with:
93-
python-version: "3.x"
94-
- name: Install dependencies
95-
run: python -m pip install build
96-
- name: Create packages
97-
run: python -m build .
90+
enable-cache: true
91+
92+
- name: Build our distributions
93+
run: uv run --with 'build[uv]' -m build --installer=uv
94+
9895
- name: Publish to PyPI
9996
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
10097
uses: pypa/gh-action-pypi-publish@release/v1

docs/requirements.txt

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
#
2-
# This file is autogenerated by pip-compile with Python 3.12
3-
# by the following command:
4-
#
5-
# pip-compile --strip-extras docs/requirements.in
6-
#
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile --output-file /Users/julian/Development/referencing-http/docs/requirements.txt docs/requirements.in
73
alabaster==1.0.0
84
# via sphinx
95
attrs==25.3.0
@@ -12,7 +8,7 @@ babel==2.17.0
128
# via sphinx
139
beautifulsoup4==4.13.4
1410
# via furo
15-
certifi==2025.4.26
11+
certifi==2025.6.15
1612
# via requests
1713
charset-normalizer==3.4.2
1814
# via requests
@@ -34,7 +30,7 @@ pyenchant==3.3.0rc1
3430
# via
3531
# -r docs/requirements.in
3632
# sphinxcontrib-spelling
37-
pygments==2.19.1
33+
pygments==2.19.2
3834
# via
3935
# furo
4036
# pygments-github-lexers
@@ -45,17 +41,17 @@ pyyaml==6.0.2
4541
# via referencing-http
4642
referencing==0.36.2
4743
# via referencing-http
48-
file:.#egg=referencing-http
44+
referencing-http @ file:.#egg=referencing-http
4945
# via -r docs/requirements.in
50-
requests==2.32.3
46+
requests==2.32.4
5147
# via
5248
# sphinx
5349
# sphinxcontrib-spelling
5450
roman-numerals-py==3.1.0
5551
# via sphinx
56-
rpds-py==0.24.0
52+
rpds-py==0.25.1
5753
# via referencing
58-
snowballstemmer==2.2.0
54+
snowballstemmer==3.0.1
5955
# via sphinx
6056
soupsieve==2.7
6157
# via beautifulsoup4
@@ -87,9 +83,7 @@ sphinxcontrib-spelling==8.0.1
8783
# via -r docs/requirements.in
8884
sphinxext-opengraph==0.10.0
8985
# via -r docs/requirements.in
90-
typing-extensions==4.13.2
91-
# via
92-
# beautifulsoup4
93-
# referencing
94-
urllib3==2.4.0
86+
typing-extensions==4.14.0
87+
# via beautifulsoup4
88+
urllib3==2.5.0
9589
# via requests

noxfile.py

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
docs=DOCS / "requirements.txt",
1515
tests=ROOT / "test-requirements.txt",
1616
)
17-
REQUIREMENTS_IN = {
18-
path.parent / f"{path.stem}.in" for path in REQUIREMENTS.values()
19-
}
17+
REQUIREMENTS_IN = [ # this is actually ordered, as files depend on each other
18+
(path.parent / f"{path.stem}.in", path) for path in REQUIREMENTS.values()
19+
]
2020

21-
22-
SUPPORTED = ["pypy3.10", "3.10", "3.11", "3.12"]
21+
SUPPORTED = ["pypy3.10", "3.10", "3.11", "3.12", "3.13"]
2322
LATEST = SUPPORTED[-1]
2423

24+
nox.options.default_venv_backend = "uv|virtualenv"
2525
nox.options.sessions = []
2626

2727

@@ -37,7 +37,7 @@ def _session(fn):
3737
@session(python=SUPPORTED)
3838
def tests(session):
3939
"""
40-
Run the test suite.
40+
Run the test suite with a corresponding Python version.
4141
"""
4242
session.install("-r", REQUIREMENTS["tests"])
4343

@@ -65,7 +65,7 @@ def tests(session):
6565
session.run("python", "-m", "pytest", *session.posargs, PACKAGE)
6666

6767

68-
@session(python=SUPPORTED)
68+
@session()
6969
def audit(session):
7070
"""
7171
Audit Python dependencies for vulnerabilities.
@@ -79,9 +79,15 @@ def build(session):
7979
"""
8080
Build a distribution suitable for PyPI and check its validity.
8181
"""
82-
session.install("build", "twine")
82+
session.install("build[uv]", "twine")
8383
with TemporaryDirectory() as tmpdir:
84-
session.run("python", "-m", "build", ROOT, "--outdir", tmpdir)
84+
session.run(
85+
"pyproject-build",
86+
"--installer=uv",
87+
ROOT,
88+
"--outdir",
89+
tmpdir,
90+
)
8591
session.run("twine", "check", "--strict", tmpdir + "/*")
8692

8793

@@ -97,7 +103,7 @@ def secrets(session):
97103
@session(tags=["style"])
98104
def style(session):
99105
"""
100-
Check for coding style.
106+
Check Python code style.
101107
"""
102108
session.install("ruff")
103109
session.run("ruff", "check", ROOT)
@@ -106,10 +112,10 @@ def style(session):
106112
@session()
107113
def typing(session):
108114
"""
109-
Statically check typing annotations.
115+
Check static typing.
110116
"""
111117
session.install("pyright", ROOT)
112-
session.run("pyright", PACKAGE)
118+
session.run("pyright", *session.posargs, PACKAGE)
113119

114120

115121
@session(tags=["docs"])
@@ -128,9 +134,9 @@ def typing(session):
128134
)
129135
def docs(session, builder):
130136
"""
131-
Build the documentation using various Sphinx builders.
137+
Build the documentation using a specific Sphinx builder.
132138
"""
133-
session.install("-r", DOCS / "requirements.txt")
139+
session.install("-r", REQUIREMENTS["docs"])
134140
with TemporaryDirectory() as tmpdir_str:
135141
tmpdir = Path(tmpdir_str)
136142
argv = ["-n", "-T", "-W"]
@@ -152,7 +158,7 @@ def docs(session, builder):
152158
@session(tags=["docs", "style"], name="docs(style)")
153159
def docs_style(session):
154160
"""
155-
Check the documentation source style.
161+
Check the documentation style.
156162
"""
157163
session.install(
158164
"doc8",
@@ -165,15 +171,17 @@ def docs_style(session):
165171
@session(default=False)
166172
def requirements(session):
167173
"""
168-
Update requirements files.
174+
Update the project's pinned requirements.
175+
176+
You should commit the result afterwards.
169177
"""
170-
session.install("pip-tools")
171-
for each in REQUIREMENTS_IN:
172-
session.run(
173-
"pip-compile",
174-
"--resolver",
175-
"backtracking",
176-
"--strip-extras",
177-
"-U",
178-
each.relative_to(ROOT),
179-
)
178+
if session.venv_backend == "uv":
179+
cmd = ["uv", "pip", "compile"]
180+
else:
181+
session.install("pip-tools")
182+
cmd = ["pip-compile", "--resolver", "backtracking", "--strip-extras"]
183+
184+
for each, out in REQUIREMENTS_IN:
185+
# otherwise output files end up with silly absolute path comments...
186+
relative = each.relative_to(ROOT)
187+
session.run(*cmd, "--upgrade", "--output-file", out, relative)

test-requirements.txt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
#
2-
# This file is autogenerated by pip-compile with Python 3.12
3-
# by the following command:
4-
#
5-
# pip-compile --strip-extras test-requirements.in
6-
#
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile --output-file /Users/julian/Development/referencing-http/test-requirements.txt test-requirements.in
73
attrs==25.3.0
84
# via referencing
95
iniconfig==2.1.0
106
# via pytest
117
packaging==25.0
128
# via pytest
13-
pluggy==1.5.0
9+
pluggy==1.6.0
1410
# via pytest
15-
pytest==8.3.5
11+
pygments==2.19.2
12+
# via pytest
13+
pytest==8.4.1
1614
# via -r test-requirements.in
1715
pyyaml==6.0.2
1816
# via referencing-http
1917
referencing==0.36.2
2018
# via referencing-http
21-
file:.#egg=referencing_http
19+
referencing-http @ file:.#egg=referencing_http
2220
# via -r test-requirements.in
23-
rpds-py==0.24.0
24-
# via referencing
25-
typing-extensions==4.13.2
21+
rpds-py==0.25.1
2622
# via referencing

0 commit comments

Comments
 (0)