Skip to content

Commit e9eceaf

Browse files
authored
Use just as command runner, replacing nox (#112)
1 parent a66dbea commit e9eceaf

File tree

6 files changed

+59
-158
lines changed

6 files changed

+59
-158
lines changed

.devcontainer/devcontainer.json

+4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
{
22
"name": "Python 3",
33
"image": "ghcr.io/astral-sh/uv:python3.11-bookworm",
4+
"features": {
5+
"ghcr.io/guiyomh/features/just:0": {}
6+
},
47
"customizations": {
58
"vscode": {
69
"extensions": [
710
"ms-python.python",
811
"charliermarsh.ruff",
912
"fill-labs.dependi",
13+
"nefrob.vscode-just-syntax",
1014
"EditorConfig.EditorConfig"
1115
]
1216
}

.github/CONTRIBUTING.md

+12-10
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,24 @@ For users of IDEs with support for devcontainers, it's usage is recommended.
2626

2727
### Other
2828

29-
Ensure you have Python 3.11 or greater with recent versions of [uv] and [nox] in your environment.
29+
Ensure you have Python 3.11 or greater with recent versions of [uv] and [just] in your environment.
3030

3131
## Coding Standards
3232

33-
All tests need to pass before a PR can be merged. Using [nox] to lint your code and run tests
33+
All tests need to pass before a PR can be merged. Using [just] to lint your code and run tests
3434
before creating a PR is advised to avoid being reprimanded by CI.
3535

3636
```sh
37-
$ nox
38-
nox > Running session lint-3.11
37+
$ just
38+
uv lock --locked
39+
Resolved 54 packages in 3ms
40+
uv run ruff check src tests
41+
All checks passed!
42+
uv run ruff format --check src tests
43+
57 files already formatted
44+
uv run mypy src
45+
Success: no issues found in 30 source files
3946
...
40-
nox > Ran multiple sessions:
41-
nox > * lint-3.11: success
42-
nox > * lint-3.12: skipped
43-
nox > * test-3.11: success
44-
nox > * test-3.12: skipped
4547
```
4648

4749
Since some integration tests use real dependencies, docker is required to run them. If docker is not available in your environment, those tests will be skipped and only run in CI.
@@ -88,6 +90,6 @@ as well as [mypy] for static type checks.
8890
```
8991

9092
[uv]: https://github.com/astral-sh/uv
91-
[nox]: https://github.com/wntrblm/nox
93+
[just]: https://github.com/casey/just
9294
[ruff]: https://github.com/astral-sh/ruff
9395
[mypy]: https://github.com/python/mypy

.github/workflows/test.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,14 @@ jobs:
3333
with:
3434
enable-cache: true
3535
- run: uv python install ${{ matrix.python_version }}
36-
- run: uvx nox -s test
36+
- uses: extractions/setup-just@v2
37+
38+
- run: just test
39+
3740
- name: Upload coverage reports to Codecov
3841
uses: codecov/[email protected]
3942
with:
40-
files: ./coverage.xml,!./nox
43+
files: ./coverage.xml
4144
env_vars: PYTHON
4245
use_oidc: true
4346
fail_ci_if_error: true

.github/workflows/verify.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ jobs:
1717
with:
1818
enable-cache: true
1919
- run: uv python install ${{ env.PYTHON_VERSION }}
20-
- run: uvx nox -s lint
20+
- uses: extractions/setup-just@v2
21+
22+
- run: just lint
2123
check-lockfile:
2224
runs-on: ubuntu-latest
2325
steps:
@@ -26,7 +28,9 @@ jobs:
2628
with:
2729
enable-cache: true
2830
- run: uv python install ${{ env.PYTHON_VERSION }}
29-
- run: uvx nox -s lockfile
31+
- uses: extractions/setup-just@v2
32+
33+
- run: just check-lockfile
3034
type-check:
3135
runs-on: ubuntu-latest
3236
steps:
@@ -35,7 +39,9 @@ jobs:
3539
with:
3640
enable-cache: true
3741
- run: uv python install ${{ env.PYTHON_VERSION }}
38-
- run: uvx nox -s mypy
42+
- uses: extractions/setup-just@v2
43+
44+
- run: just type-check
3945
spellcheck:
4046
runs-on: ubuntu-latest
4147
steps:

justfile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FRR_LATEST_MAJOR_VERSION := "9.1.0"
2+
3+
default: check-lockfile lint type-check test
4+
5+
# Check if the lockfile is up to date
6+
check-lockfile:
7+
uv lock --locked
8+
9+
# Lint code and check formatting using ruff
10+
lint +dirs="src tests":
11+
uv run ruff check {{ dirs }}
12+
uv run ruff format --check {{ dirs }}
13+
14+
# Validate static types using mypy
15+
type-check +dirs="src":
16+
uv run mypy {{ dirs }}
17+
18+
# Run tests using pytest
19+
test $COV=env("CI", "false") $FRR_VERSION=FRR_LATEST_MAJOR_VERSION:
20+
#!/usr/bin/env bash
21+
set -euxo pipefail
22+
23+
args=()
24+
( $COV == "true" ) && args+=( "--cov" )
25+
uv run pytest tests ${args[@]}
26+
27+
if [ $COV = "true" ]; then
28+
uv run coverage xml
29+
fi

noxfile.py

-143
This file was deleted.

0 commit comments

Comments
 (0)