Skip to content

Commit c6ec4d4

Browse files
authored
chore: switch to uv and nox (#145)
- Removes `just` as the default task runner in favor of `nox`. - Uses `uv` to manage dependencies, which is also used by `nox`. - Updated CI and docs/README accordingly. - Removed all requirements.txt files in favor of using `uv` to lock dependencies. - Modified dependabot config to use the new uv.lock file. - Modified RTD config to use `uv` and `nox`. - bump cargo deps - bump npm deps - bump python deps
1 parent 851a435 commit c6ec4d4

25 files changed

+1787
-1166
lines changed

.config/.readthedocs.yaml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ build:
1010
tools:
1111
rust: latest
1212
python: latest
13-
14-
mkdocs:
15-
configuration: docs/mkdocs.yml
16-
17-
18-
# Optionally declare the Python requirements required to build your docs
19-
20-
python:
21-
install:
22-
- requirements: docs/requirements.txt
23-
- method: pip
24-
path: docs/
13+
jobs:
14+
pre_create_environment:
15+
- >-
16+
UV_INSTALL_DIR="${HOME}/.local/bin" &&
17+
curl -LsSf https://astral.sh/uv/install.sh | sh
18+
build:
19+
html:
20+
- ${HOME}/.local/bin/uvx nox -s docs-build
21+
post_build:
22+
- mkdir -p $READTHEDOCS_OUTPUT/html/
23+
- mv docs/site/* $READTHEDOCS_OUTPUT/html

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ updates:
1313
actions:
1414
patterns:
1515
- "*"
16-
- package-ecosystem: pip
16+
- package-ecosystem: uv
1717
directory: /
1818
schedule:
1919
interval: "weekly"
2020
groups:
21-
pip:
21+
uv-pip:
2222
patterns:
2323
- "*"
2424
- package-ecosystem: cargo

.github/workflows/build-docs.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,13 @@ jobs:
4848
with:
4949
path: ~/.cargo
5050
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
51-
- uses: actions/setup-python@v5
51+
- name: Install uv
52+
uses: astral-sh/setup-uv@v5
5253
with:
53-
python-version: 3.x
54-
cache: 'pip'
55-
cache-dependency-path: docs/requirements.txt
56-
- name: Install workflow deps
57-
run: |
58-
pip install -r docs/requirements.txt
59-
pip install --force-reinstall -v docs/
54+
enable-cache: true
55+
cache-dependency-glob: "uv.lock"
6056
- name: Build docs
61-
working-directory: docs
62-
run: mkdocs build
57+
run: uvx nox -s docs-build
6358
- name: Upload docs build as artifact
6459
uses: actions/upload-artifact@v4
6560
with:
@@ -84,11 +79,9 @@ jobs:
8479
with:
8580
path: ~/.cargo
8681
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
87-
- name: Install just
88-
uses: taiki-e/install-action@v2
89-
with:
90-
tool: just
91-
- run: just docs-rs
82+
- name: Install uv
83+
uses: astral-sh/setup-uv@v5
84+
- run: uvx nox -s docs-rs
9285
- name: upload rustdoc build as artifact
9386
uses: actions/upload-artifact@v4
9487
with:

.github/workflows/bump-n-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
workflow_dispatch:
1313
inputs:
1414
component:
15+
description: The version component to increase
1516
type: choice
1617
required: true
1718
default: patch

.github/workflows/run-dev-tests.yml

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
steps:
3232
- uses: actions/checkout@v4
3333

34+
- run: rustup update --no-self-update
3435
- run: rustup component add llvm-tools-preview
3536

3637
# https://docs.rs/openssl/latest/openssl/#automatic
@@ -56,8 +57,11 @@ jobs:
5657
with:
5758
python-version: 3.x
5859

59-
- name: Install workflow deps
60-
run: python3 -m pip install meson
60+
- name: Install uv
61+
uses: astral-sh/setup-uv@v6
62+
with:
63+
enable-cache: true
64+
cache-dependency-glob: "uv.lock"
6165

6266
# # https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages
6367
- name: Install ninja (Linux)
@@ -78,18 +82,6 @@ jobs:
7882
- if: runner.os == 'Linux'
7983
run: sudo apt-get update
8084

81-
- name: Install clang v7
82-
if: runner.os == 'Linux'
83-
uses: ./.github/install-clang-action
84-
with:
85-
version: '7'
86-
87-
- name: Collect Coverage for clang v7
88-
if: runner.os == 'Linux'
89-
env:
90-
CLANG_VERSION: '7'
91-
run: just test ci
92-
9385
- name: Install clang v8
9486
if: runner.os == 'Linux'
9587
uses: ./.github/install-clang-action
@@ -100,7 +92,7 @@ jobs:
10092
if: runner.os == 'Linux'
10193
env:
10294
CLANG_VERSION: '8'
103-
run: just test ci
95+
run: uvx nox -s test -- --profile ci
10496

10597
- name: Install clang v9
10698
uses: ./.github/install-clang-action
@@ -110,7 +102,7 @@ jobs:
110102
- name: Collect Coverage for clang v9
111103
env:
112104
CLANG_VERSION: '9'
113-
run: just test ci
105+
run: uvx nox -s test -- --profile ci
114106

115107
- name: Install clang v10
116108
uses: ./.github/install-clang-action
@@ -120,7 +112,7 @@ jobs:
120112
- name: Collect Coverage for clang v10
121113
env:
122114
CLANG_VERSION: '10'
123-
run: just test ci
115+
run: uvx nox -s test -- --profile ci
124116

125117
- name: Install clang 11
126118
uses: ./.github/install-clang-action
@@ -130,7 +122,7 @@ jobs:
130122
- name: Collect Coverage for clang v11
131123
env:
132124
CLANG_VERSION: '11'
133-
run: just test ci
125+
run: uvx nox -s test -- --profile ci
134126

135127
- name: Install clang 12
136128
uses: ./.github/install-clang-action
@@ -140,7 +132,7 @@ jobs:
140132
- name: Collect Coverage for clang v12
141133
env:
142134
CLANG_VERSION: '12'
143-
run: just test ci
135+
run: uvx nox -s test -- --profile ci
144136

145137
- name: Install clang 13
146138
uses: ./.github/install-clang-action
@@ -150,7 +142,7 @@ jobs:
150142
- name: Collect Coverage for clang v13
151143
env:
152144
CLANG_VERSION: '13'
153-
run: just test ci
145+
run: uvx nox -s test -- --profile ci
154146

155147
- name: Install clang 14
156148
uses: ./.github/install-clang-action
@@ -160,7 +152,7 @@ jobs:
160152
- name: Collect Coverage for clang v14
161153
env:
162154
CLANG_VERSION: '14'
163-
run: just test ci
155+
run: uvx nox -s test -- --profile ci
164156

165157
- name: Install clang 15
166158
uses: ./.github/install-clang-action
@@ -170,7 +162,7 @@ jobs:
170162
- name: Collect Coverage for clang v15
171163
env:
172164
CLANG_VERSION: '15'
173-
run: just test ci
165+
run: uvx nox -s test -- --profile ci
174166

175167
- name: Install clang 16
176168
uses: ./.github/install-clang-action
@@ -180,7 +172,7 @@ jobs:
180172
- name: Collect Coverage for clang v16
181173
env:
182174
CLANG_VERSION: '16'
183-
run: just test ci
175+
run: uvx nox -s test -- --profile ci
184176

185177
- name: Install clang 17
186178
uses: ./.github/install-clang-action
@@ -190,7 +182,7 @@ jobs:
190182
- name: Collect Coverage for clang v17
191183
env:
192184
CLANG_VERSION: '17'
193-
run: just test ci
185+
run: uvx nox -s test -- --profile ci
194186

195187
- name: Install clang 18
196188
uses: ./.github/install-clang-action
@@ -200,10 +192,10 @@ jobs:
200192
- name: Collect Coverage for clang v18
201193
env:
202194
CLANG_VERSION: '18'
203-
run: just test all
195+
run: uvx nox -s test -- --profile all
204196

205197
- name: Generate Coverage HTML report
206-
run: just pretty-cov
198+
run: uvx nox -s pretty-cov
207199

208200
- name: Upload coverage data
209201
uses: actions/upload-artifact@v4
@@ -214,7 +206,7 @@ jobs:
214206
- name: Generate Coverage lcov report
215207
run: |
216208
rm coverage.json
217-
just lcov
209+
uvx nox -s lcov
218210
219211
- uses: codecov/codecov-action@v5
220212
with:

CONTRIBUTING.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Contributing
2+
3+
This project requires the following tools installed:
4+
5+
- :simple-rust: [rust](https://rustup.rs/)
6+
- :simple-uv: [`uv` (Python Project management tool)](https://docs.astral.sh/uv/)
7+
8+
## Getting started
9+
10+
After checking out the repo locally, use
11+
12+
```sh
13+
uv sync
14+
```
15+
16+
This creates a venv at ".venv/" in repo root (if it doesn't exist).
17+
It also installs dev dependencies like `pre-commit`, `nox`, `ruff`, and `mypy`.
18+
19+
See [`uv sync` docs](https://docs.astral.sh/uv/reference/cli/#uv-sync)
20+
for more detailed usage.
21+
22+
> [!TIP]
23+
> To register the pre-commit hooks, use:
24+
>
25+
> ```shell
26+
> uv run pre-commit install
27+
> ```
28+
29+
## Running tests
30+
31+
First ensure that the following cargo-managed binaries are installed:
32+
33+
- [`cargo-llvm-cov`](https://github.com/taiki-e/cargo-llvm-cov)
34+
- [`cargo-nextest`](https://nexte.st/docs/installation/pre-built-binaries/)
35+
- [`llvm-cov-pretty`](https://crates.io/crates/llvm-cov-pretty) is used only for the optional `nox -s pretty-cov` task. Without this installed, `nox -s llvm-cov` will suffice.
36+
37+
Use nox to run tests:
38+
39+
```sh
40+
uv run nox -s test
41+
```
42+
43+
Different test profiles are still defined in .config/nextest.toml.
44+
The above command uses the "default" profile, but to mimic the CI, use:
45+
46+
```sh
47+
uv run nox -s test -- --profile ci
48+
```
49+
50+
To generate a coverage report:
51+
52+
```sh
53+
uv run nox -s llvm-cov -- --open
54+
```
55+
56+
The `-- --open` part is optional. It opens the built coverage report in your default browser.
57+
58+
The uploaded codecov report is generated with
59+
60+
```sh
61+
uv run nox -s lcov
62+
```
63+
64+
## Generating docs
65+
66+
To view the docs locally, use
67+
68+
```sh
69+
uv run nox -s docs -- --open
70+
```
71+
72+
The `-- --open` part is optional. It opens the built docs in your default browser.
73+
74+
In CI, docs are built using
75+
76+
```sh
77+
uv run nox -s docs-build
78+
```

0 commit comments

Comments
 (0)