Skip to content

Commit 0c1666d

Browse files
swap to using uv for project management
1 parent b61f01d commit 0c1666d

10 files changed

Lines changed: 3043 additions & 237 deletions

File tree

.github/workflows/release.yml

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,69 +2,47 @@ name: release
22

33
on:
44
release:
5-
types: [released]
5+
types: [published]
66

77
jobs:
8-
check:
9-
runs-on: ubuntu-latest
10-
permissions:
11-
actions: read
12-
contents: read
13-
env:
14-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15-
steps:
16-
- uses: actions/checkout@v4
17-
18-
- name: Check most recent test run on `main`
19-
id: latest-test-result
20-
run: |
21-
echo "result=$(gh run list \
22-
--branch=main \
23-
--workflow=test.yml \
24-
--json headBranch,workflowName,conclusion \
25-
--jq '.[] | select(.headBranch=="main" and .conclusion=="success") | .conclusion' \
26-
| head -n 1)" >> $GITHUB_OUTPUT
27-
28-
- name: OK
29-
if: ${{ (contains(steps.latest-test-result.outputs.result, 'success')) }}
30-
run: exit 0
31-
32-
- name: Fail
33-
if: ${{ !contains(steps.latest-test-result.outputs.result, 'success') }}
34-
run: exit 1
8+
test:
9+
uses: ./.github/workflows/test.yml
10+
secrets: inherit
3511

3612
pypi:
37-
if: ${{ github.event_name == 'release' }}
3813
runs-on: ubuntu-latest
39-
needs: check
14+
needs: test
4015
environment: release
4116
permissions:
42-
contents: read
17+
contents: write
4318
id-token: write
4419
steps:
45-
- uses: actions/checkout@v4
46-
with:
47-
persist-credentials: false
48-
49-
- uses: westerveltco/setup-ci-action@v0
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v5
5022
with:
51-
python-version: 3.12
52-
extra-python-dependencies: hatch
53-
use-uv: true
23+
enable-cache: true
24+
pyproject-file: pyproject.toml
5425

5526
- name: Build package
5627
run: |
57-
hatch build
28+
uv build
29+
30+
- name: Upload release assets to GitHub
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: |
34+
gh release upload ${{ github.event.release.tag_name }} ./dist/*
5835
5936
- name: Publish to PyPI
60-
uses: pypa/gh-action-pypi-publish@release/v1
37+
run: |
38+
uv publish
6139
6240
docker:
6341
runs-on: ubuntu-latest
6442
needs: check
6543
environment: release
6644
permissions:
67-
contents: read
45+
contents: write
6846
packages: write
6947
steps:
7048
- uses: actions/checkout@v4

.github/workflows/test.yml

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,16 @@ jobs:
2020
matrix: ${{ steps.set-matrix.outputs.matrix }}
2121
steps:
2222
- uses: actions/checkout@v4
23-
with:
24-
persist-credentials: false
2523

26-
- uses: westerveltco/setup-ci-action@v0
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v5
2726
with:
28-
python-version: 3.9
29-
extra-python-dependencies: nox
30-
use-uv: true
27+
enable-cache: true
28+
pyproject-file: pyproject.toml
3129

3230
- id: set-matrix
3331
run: |
34-
echo "matrix=$(python -m nox -l --json | jq -c '[.[] | select(.name == "tests") | {"python-version": .python, "django-version": .call_spec.django}] | {include: .}')" >> $GITHUB_OUTPUT
32+
uv run nox --session "gha_matrix"
3533
3634
test:
3735
name: Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}
@@ -42,18 +40,16 @@ jobs:
4240
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
4341
steps:
4442
- uses: actions/checkout@v4
45-
with:
46-
persist-credentials: false
4743

48-
- uses: westerveltco/setup-ci-action@v0
44+
- name: Install uv
45+
uses: astral-sh/setup-uv@v5
4946
with:
50-
python-version: ${{ matrix.python-version }}
51-
extra-python-dependencies: nox
52-
use-uv: true
47+
enable-cache: true
48+
pyproject-file: pyproject.toml
5349

5450
- name: Run tests
5551
run: |
56-
python -m nox --session "tests(python='${{ matrix.python-version }}', django='${{ matrix.django-version }}')"
52+
uv run nox --session "tests(python='${{ matrix.python-version }}', django='${{ matrix.django-version }}')" -- --slow
5753
5854
tests:
5955
runs-on: ubuntu-latest
@@ -71,32 +67,28 @@ jobs:
7167
runs-on: ubuntu-latest
7268
steps:
7369
- uses: actions/checkout@v4
74-
with:
75-
persist-credentials: false
7670

77-
- uses: westerveltco/setup-ci-action@v0
71+
- name: Install uv
72+
uses: astral-sh/setup-uv@v5
7873
with:
79-
python-version: 3.9
80-
extra-python-dependencies: nox
81-
use-uv: true
74+
enable-cache: true
75+
pyproject-file: pyproject.toml
8276

83-
- name: Run mypy
77+
- name: Run type checks
8478
run: |
85-
python -m nox --session "mypy"
79+
uv run nox --session "mypy"
8680
8781
coverage:
8882
runs-on: ubuntu-latest
8983
steps:
9084
- uses: actions/checkout@v4
91-
with:
92-
persist-credentials: false
9385

94-
- uses: westerveltco/setup-ci-action@v0
86+
- name: Install uv
87+
uses: astral-sh/setup-uv@v5
9588
with:
96-
python-version: 3.9
97-
extra-python-dependencies: nox
98-
use-uv: true
89+
enable-cache: true
90+
pyproject-file: pyproject.toml
9991

100-
- name: Run coverage
92+
- name: Generate code coverage
10193
run: |
102-
python -m nox --session "coverage"
94+
uv run nox --session "coverage"

.just/copier.just

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
set unstable := true
2+
3+
justfile := justfile_directory() + "/.just/copier.just"
4+
5+
[private]
6+
default:
7+
@just --list --justfile {{ justfile }}
8+
9+
[private]
10+
fmt:
11+
@just --fmt --justfile {{ justfile }}
12+
13+
# Create a copier answers file
14+
[no-cd]
15+
copy TEMPLATE_PATH DESTINATION_PATH=".":
16+
uv run copier copy --trust {{ TEMPLATE_PATH }} {{ DESTINATION_PATH }}
17+
18+
# Recopy the project from the original template
19+
[no-cd]
20+
recopy ANSWERS_FILE *ARGS:
21+
uv run copier recopy --trust --answers-file {{ ANSWERS_FILE }} {{ ARGS }}
22+
23+
# Loop through all answers files and recopy the project using copier
24+
[no-cd]
25+
@recopy-all *ARGS:
26+
for file in `ls .copier/`; do just copier recopy .copier/$file "{{ ARGS }}"; done
27+
28+
# Update the project using a copier answers file
29+
[no-cd]
30+
update ANSWERS_FILE *ARGS:
31+
uv run copier update --trust --answers-file {{ ANSWERS_FILE }} {{ ARGS }}
32+
33+
# Loop through all answers files and update the project using copier
34+
[no-cd]
35+
@update-all *ARGS:
36+
for file in `ls .copier/`; do just copier update .copier/$file "{{ ARGS }}"; done

.just/documentation.just

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
set unstable := true
2+
3+
justfile := justfile_directory() + "/.just/documentation.just"
4+
5+
[private]
6+
default:
7+
@just --list --justfile {{ justfile }}
8+
9+
[private]
10+
fmt:
11+
@just --fmt --justfile {{ justfile }}
12+
13+
# Build documentation using Sphinx
14+
[no-cd]
15+
build LOCATION="docs/_build/html": cog
16+
uv run --group docs sphinx-build docs {{ LOCATION }}
17+
18+
# Serve documentation locally
19+
[no-cd]
20+
serve PORT="8000": cog
21+
#!/usr/bin/env sh
22+
HOST="localhost"
23+
if [ -f "/.dockerenv" ]; then
24+
HOST="0.0.0.0"
25+
fi
26+
uv run --group docs sphinx-autobuild docs docs/_build/html --host "$HOST" --port {{ PORT }}
27+
28+
[no-cd]
29+
[private]
30+
cog:
31+
uv run --with cogapp cog -r CONTRIBUTING.md docs/development/just.md

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/
2222

2323
- Added support for Python 3.13.
2424

25+
### Changed
26+
27+
- Now using `uv` for project management.
28+
2529
### Removed
2630

2731
- Dropped support for Django 5.0.

0 commit comments

Comments
 (0)