Skip to content

Commit 4529d6c

Browse files
authored
Use UV and pre-commit.ci in CI suite (#359)
1 parent 5ecc9cf commit 4529d6c

File tree

14 files changed

+98
-120
lines changed

14 files changed

+98
-120
lines changed

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,17 @@ labels:
66
assignees:
77
- codingjoe
88
body:
9-
109
- type: markdown
1110
attributes:
1211
value: |
1312
Thank you for taking the time to report a bug.
1413
Please fill in as much of the template below as you're able.
15-
1614
- type: markdown
1715
attributes:
1816
value: |
1917
## Security issues
2018
Please do not report security issues here.
2119
Instead, disclose them as described in our [security policy](https://github.com/codingjoe/django-select2/security).
22-
2320
- type: textarea
2421
id: bug-description
2522
attributes:
@@ -28,7 +25,6 @@ body:
2825
placeholder: I found a bug
2926
validations:
3027
required: true
31-
3228
- type: textarea
3329
id: bug-steps
3430
attributes:
@@ -41,7 +37,6 @@ body:
4137
4. See error
4238
validations:
4339
required: true
44-
4540
- type: textarea
4641
id: bug-expected
4742
attributes:

.github/dependabot.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
version: 2
22
updates:
3-
- package-ecosystem: pip
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
- package-ecosystem: npm
8-
directory: "/"
9-
schedule:
10-
interval: daily
11-
- package-ecosystem: github-actions
12-
directory: "/"
13-
schedule:
14-
interval: daily
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
- package-ecosystem: npm
8+
directory: "/"
9+
schedule:
10+
interval: daily
11+
- package-ecosystem: github-actions
12+
directory: "/"
13+
schedule:
14+
interval: daily

.github/workflows/ci.yml

Lines changed: 11 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,17 @@ on:
44
branches:
55
- main
66
pull_request:
7-
87
jobs:
9-
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-
308
dist:
319
runs-on: ubuntu-latest
3210
steps:
3311
- uses: actions/checkout@v6
34-
- uses: actions/setup-python@v6
12+
- uses: astral-sh/setup-uv@v7
13+
- run: uvx --from build pyproject-build --sdist --wheel
14+
- run: uvx twine check dist/*
15+
- uses: actions/upload-artifact@v6
3516
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/*
40-
17+
path: dist/*
4118
standardjs:
4219
runs-on: ubuntu-latest
4320
steps:
@@ -47,21 +24,15 @@ jobs:
4724
node-version-file: '.nvmrc'
4825
- run: npm install -g standard
4926
- run: standard
50-
5127
docs:
5228
runs-on: ubuntu-latest
5329
steps:
5430
- uses: actions/checkout@v6
55-
- uses: actions/setup-python@v6
56-
with:
57-
python-version: "3.10"
5831
- 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
61-
32+
- uses: astral-sh/setup-uv@v7
33+
- run: uv run sphinx-build -W -b doctest -b html docs docs/_build
6234
PyTest:
6335
needs:
64-
- lint
6536
- standardjs
6637
strategy:
6738
matrix:
@@ -76,33 +47,21 @@ jobs:
7647
runs-on: ubuntu-latest
7748
steps:
7849
- uses: actions/checkout@v6
79-
- uses: actions/setup-python@v6
50+
- uses: astral-sh/setup-uv@v7
8051
with:
8152
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"
53+
- run: uv run --with Django~=${{ matrix.django-version }}.0 pytest -m "not selenium"
8554
- uses: codecov/codecov-action@v5
86-
8755
Selenium:
8856
needs:
89-
- lint
9057
- standardjs
91-
strategy:
92-
matrix:
93-
python-version:
94-
- "3.x"
9558
runs-on: ubuntu-latest
9659
steps:
9760
- uses: actions/checkout@v6
9861
- name: Install Selenium
9962
run: |
10063
curl -LsSfO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
10164
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
65+
- uses: astral-sh/setup-uv@v7
66+
- run: uv run pytest -m selenium
10867
- uses: codecov/codecov-action@v5

.github/workflows/release.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
name: Release
2-
32
on:
43
release:
54
types: [published]
65
workflow_dispatch:
7-
86
jobs:
97
pypi-build:
108
runs-on: ubuntu-latest
11-
129
steps:
1310
- uses: actions/checkout@v6
1411
- uses: actions/setup-python@v6
@@ -20,21 +17,18 @@ jobs:
2017
with:
2118
name: release-dists
2219
path: dist/
23-
2420
pypi-publish:
2521
runs-on: ubuntu-latest
2622
needs:
2723
- pypi-build
2824
permissions:
2925
id-token: write
30-
3126
steps:
3227
- uses: actions/download-artifact@v7
3328
with:
3429
name: release-dists
3530
path: dist/
3631
- uses: pypa/gh-action-pypi-publish@release/v1
37-
3832
npmjs:
3933
name: npmjs.org
4034
runs-on: ubuntu-latest

.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

.readthedocs.yaml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
# .readthedocs.yaml
22
# Read the Docs configuration file
33
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4-
54
version: 2
6-
75
build:
8-
os: ubuntu-20.04
6+
os: ubuntu-24.04
97
apt_packages:
108
- graphviz
119
tools:
12-
python: "3.10"
13-
14-
sphinx:
15-
configuration: docs/conf.py
16-
17-
18-
python:
19-
install:
20-
- method: pip
21-
path: .
22-
extra_requirements:
23-
- docs
10+
python: "3"
11+
jobs:
12+
install:
13+
- curl -LsSf https://astral.sh/uv/install.sh | sh
14+
build:
15+
html:
16+
- $HOME/.local/bin/uv run sphinx-build -b html docs $READTHEDOCS_OUTPUT/html

CONTRIBUTING.rst

Lines changed: 3 additions & 9 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:
12+
You may run the tests via::
1413

15-
python -m pip install -e .[test]
16-
17-
You may ran the tests via::
18-
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 -W -b doctest -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

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ include django_select2/static/django_select2/django_select2.js
22
include django_select2/static/django_select2/django_select2.css
33
prune .github
44
exclude .*
5-

docs/conf.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pathlib
33
import sys
44

5-
from pkg_resources import get_distribution
5+
from django_select2 import __version__ as release
66

77
BASE_DIR = pathlib.Path(__file__).resolve(strict=True).parent.parent
88

@@ -20,12 +20,9 @@
2020

2121

2222
project = "Django-Select2"
23-
author = "Johannes Hoppe"
24-
copyright = "2017-2020, Johannes Hoppe"
25-
release = get_distribution("django_select2").version
23+
author = "Johannes Maron"
2624
version = ".".join(release.split(".")[:2])
2725

28-
2926
master_doc = "index" # default in Sphinx v2
3027

3128

0 commit comments

Comments
 (0)