Skip to content

Commit 3b7d045

Browse files
committed
Use UV and pre-commit.ci in CI suite
1 parent 5ecc9cf commit 3b7d045

File tree

5 files changed

+66
-58
lines changed

5 files changed

+66
-58
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,16 @@ on:
77

88
jobs:
99

10-
lint:
11-
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
lint-command:
15-
- bandit -r . -x ./tests
16-
- black --check --diff .
17-
- flake8 .
18-
- isort --check-only --diff .
19-
- pydocstyle .
20-
steps:
21-
- uses: actions/checkout@v6
22-
- uses: actions/setup-python@v6
23-
with:
24-
python-version: "3.x"
25-
cache: 'pip'
26-
cache-dependency-path: 'linter-requirements.txt'
27-
- run: python -m pip install -r linter-requirements.txt
28-
- run: ${{ matrix.lint-command }}
29-
3010
dist:
3111
runs-on: ubuntu-latest
3212
steps:
3313
- uses: actions/checkout@v6
34-
- uses: actions/setup-python@v6
14+
- uses: astral-sh/setup-uv@v7
15+
- run: uvx --from build pyproject-build --sdist --wheel
16+
- run: uvx twine check dist/*
17+
- uses: actions/upload-artifact@v6
3518
with:
36-
python-version: "3.x"
37-
- run: python -m pip install --upgrade pip build wheel twine readme-renderer
38-
- run: python -m build --sdist --wheel
39-
- run: python -m twine check dist/*
19+
path: dist/*
4020

4121
standardjs:
4222
runs-on: ubuntu-latest
@@ -52,16 +32,12 @@ jobs:
5232
runs-on: ubuntu-latest
5333
steps:
5434
- uses: actions/checkout@v6
55-
- uses: actions/setup-python@v6
56-
with:
57-
python-version: "3.10"
5835
- run: sudo apt-get install -y gettext graphviz
59-
- run: python -m pip install -e .[docs]
60-
- run: python -m sphinx -W -b doctest -b html docs docs/_build
36+
- uses: astral-sh/setup-uv@v7
37+
- run: uv run sphinx-build -W -b doctest -b html docs docs/_build
6138

6239
PyTest:
6340
needs:
64-
- lint
6541
- standardjs
6642
strategy:
6743
matrix:
@@ -76,33 +52,22 @@ jobs:
7652
runs-on: ubuntu-latest
7753
steps:
7854
- uses: actions/checkout@v6
79-
- uses: actions/setup-python@v6
55+
- uses: astral-sh/setup-uv@v7
8056
with:
8157
python-version: ${{ matrix.python-version }}
82-
- run: python -m pip install Django~="${{ matrix.django-version }}.0"
83-
- run: python -m pip install -e .[test]
84-
- run: python -m pytest -m "not selenium"
58+
- run: uv run --with Django~=${{ matrix.django-version }}.0 pytest -m "not selenium"
8559
- uses: codecov/codecov-action@v5
8660

8761
Selenium:
8862
needs:
89-
- lint
9063
- standardjs
91-
strategy:
92-
matrix:
93-
python-version:
94-
- "3.x"
9564
runs-on: ubuntu-latest
9665
steps:
9766
- uses: actions/checkout@v6
9867
- name: Install Selenium
9968
run: |
10069
curl -LsSfO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
10170
sudo dpkg -i google-chrome-stable_current_amd64.deb || sudo apt-get -f install -y
102-
- uses: actions/setup-python@v6
103-
with:
104-
python-version: ${{ matrix.python-version }}
105-
- run: python -m pip install Django
106-
- run: python -m pip install -e .[test,selenium]
107-
- run: python -m pytest -m selenium
71+
- uses: astral-sh/setup-uv@v7
72+
- run: uv run pytest -m selenium
10873
- uses: codecov/codecov-action@v5

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ coverage.xml
2525
db.sqlite3
2626

2727
_version.py
28+
29+
# uv
30+
uv.lock

.pre-commit-config.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: check-merge-conflict
7+
- id: check-ast
8+
- id: check-toml
9+
- id: check-yaml
10+
- id: check-symlinks
11+
- id: debug-statements
12+
- id: end-of-file-fixer
13+
- id: no-commit-to-branch
14+
args: [--branch, main]
15+
- repo: https://github.com/asottile/pyupgrade
16+
rev: v3.21.2
17+
hooks:
18+
- id: pyupgrade
19+
- repo: https://github.com/adamchainz/django-upgrade
20+
rev: 1.29.1
21+
hooks:
22+
- id: django-upgrade
23+
- repo: https://github.com/hukkin/mdformat
24+
rev: 1.0.0
25+
hooks:
26+
- id: mdformat
27+
additional_dependencies:
28+
- mdformat-ruff
29+
- mdformat-footnote
30+
- mdformat-gfm
31+
- mdformat-gfm-alerts
32+
- repo: https://github.com/astral-sh/ruff-pre-commit
33+
rev: v0.14.9
34+
hooks:
35+
- id: ruff-check
36+
args: [--fix, --exit-non-zero-on-fix]
37+
- id: ruff-format
38+
- repo: https://github.com/google/yamlfmt
39+
rev: v0.20.0
40+
hooks:
41+
- id: yamlfmt
42+
ci:
43+
autoupdate_schedule: weekly
44+
skip:
45+
- no-commit-to-branch

CONTRIBUTING.rst

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,13 @@ you have binary dependencies installed::
99
# macOS
1010
brew install -y gettext graphviz google-chrome-stable
1111

12-
To install the package and its dependencies for development
13-
including tests dependencies, please do:
14-
15-
python -m pip install -e .[test]
16-
1712
You may ran the tests via::
1813

19-
python -m pytest
14+
uv run pytest
2015

2116
Documentation pull requests welcome. The Sphinx documentation can be compiled via::
2217

23-
python -m pip install -e .[docs]
24-
python -m sphinx -W -b doctest -b html docs docs/_build
18+
uv run sphinx-build -b html docs docs/_build/html
2519

2620
Bug reports welcome, even more so if they include a correct patch. Much
2721
more so if you start your patch by adding a failing unit test, and correct

pyproject.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ dependencies = [
3535
"django-appconf>=0.6.0"
3636
]
3737

38-
[project.optional-dependencies]
38+
[dependency-groups]
39+
dev = [
40+
{ include-group = "test" },
41+
{ include-group = "docs" },
42+
]
3943
test = [
4044
"pytest",
4145
"pytest-cov",
4246
"pytest-django",
4347
"selenium",
4448
]
45-
selenium = [
46-
"selenium",
47-
]
4849
docs = [
4950
"sphinx",
5051
]

0 commit comments

Comments
 (0)