Skip to content

Commit ac8667a

Browse files
authored
Merge pull request #76 from fedi-libs/ci/pre-commit-prek
ci: replace pre-commit with prek
2 parents 397406c + 22e0389 commit ac8667a

6 files changed

Lines changed: 128 additions & 108 deletions

File tree

.github/workflows/check.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Prek Auto Fix
2+
3+
on:
4+
pull_request:
5+
branches: [main,stable]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
prek-fix:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
ref: ${{ github.head_ref }}
17+
fetch-depth: 0
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
21+
22+
- name: Check lock file consistency
23+
run: uv sync --locked --all-extras --all-groups
24+
25+
- name: Run prek on PR changes
26+
run: |
27+
uv run prek run --origin origin/${{ github.base_ref }} --source HEAD || true
28+
29+
- name: Auto Commit Fixes
30+
uses: stefanzweifel/git-auto-commit-action@v7
31+
with:
32+
commit_message: "chore: auto fixes by prek"

.pre-commit-config.yaml

Lines changed: 21 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,22 @@
11
repos:
2-
- hooks:
3-
- additional_dependencies:
4-
- aiohttp>=3.12.15
5-
- apmodel>=0.5.1
6-
- apsig>=0.6.0
7-
- charset-normalizer>=3.4.3
8-
- coverage>=7.10.7
9-
- fastapi>=0.116.1
10-
- httpcore[http2,socks]>=1.0.9
11-
- httpx>=0.28.1
12-
- pytest-cov>=7.0.0
13-
- pytest>=8.4.1
14-
- redis>=5.0.4
15-
- requests>=2.32.5
16-
- types-requests>=2.32.4.20250913
17-
- uvicorn>=0.35.0
18-
args:
19-
- --fix
20-
description: Run 'ruff' for extremely fast Python linting
21-
entry: ruff check --force-exclude
22-
id: ruff
23-
language: python
24-
minimum_pre_commit_version: 2.9.2
25-
name: ruff
26-
require_serial: true
27-
types_or:
28-
- python
29-
- pyi
30-
- additional_dependencies:
31-
- aiohttp>=3.12.15
32-
- apmodel>=0.5.1
33-
- apsig>=0.6.0
34-
- charset-normalizer>=3.4.3
35-
- coverage>=7.10.7
36-
- fastapi>=0.116.1
37-
- httpcore[http2,socks]>=1.0.9
38-
- httpx>=0.28.1
39-
- pytest-cov>=7.0.0
40-
- pytest>=8.4.1
41-
- redis>=5.0.4
42-
- requests>=2.32.5
43-
- types-requests>=2.32.4.20250913
44-
- uvicorn>=0.35.0
45-
args: []
46-
description: Run 'ruff format' for extremely fast Python formatting
47-
entry: ruff format --force-exclude
48-
id: ruff-format
49-
language: python
50-
minimum_pre_commit_version: 2.9.2
51-
name: ruff-format
52-
require_serial: true
53-
types_or:
54-
- python
55-
- pyi
56-
repo: https://github.com/astral-sh/ruff-pre-commit
57-
rev: v0.15.1
58-
- hooks:
59-
- additional_dependencies:
60-
- aiohttp>=3.12.15
61-
- apmodel>=0.5.1
62-
- apsig>=0.6.0
63-
- charset-normalizer>=3.4.3
64-
- coverage>=7.10.7
65-
- fastapi>=0.116.1
66-
- httpcore[http2,socks]>=1.0.9
67-
- httpx>=0.28.1
68-
- pytest-cov>=7.0.0
69-
- pytest>=8.4.1
70-
- redis>=5.0.4
71-
- requests>=2.32.5
72-
- types-requests>=2.32.4.20250913
73-
- uvicorn>=0.35.0
74-
id: pyrefly-check
75-
name: Pyrefly (type checking)
76-
pass_filenames: false
77-
repo: https://github.com/facebook/pyrefly-pre-commit
78-
rev: 0.52.0
2+
- repo: local
3+
hooks:
4+
- id: ruff
5+
name: ruff
6+
entry: ruff check --force-exclude --fix
7+
language: system
8+
types_or: [python, pyi]
9+
require_serial: true
10+
11+
- id: ruff-format
12+
name: ruff-format
13+
entry: ruff format --force-exclude
14+
language: system
15+
types_or: [python, pyi]
16+
require_serial: true
17+
18+
- id: pyrefly-check
19+
name: Pyrefly (type checking)
20+
entry: pyrefly check
21+
language: system
22+
pass_filenames: false

Taskfile.yaml

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,74 @@
11
version: '3'
22

3+
vars:
4+
UV_SYNC: uv sync --all-extras --all-groups
5+
36
tasks:
47
default:
8+
desc: Install dependencies using lockfile
9+
cmds:
10+
- "{{.UV_SYNC}} --locked"
11+
silent: true
12+
13+
prepare:
14+
desc: Setup development environment (uv, Python, and dependencies)
515
cmds:
6-
- uv sync --locked --all-extras --all-groups
16+
- task: default
17+
- |
18+
if [ -f .git/hooks/pre-commit ]; then
19+
echo "WARNING: .git/hooks/pre-commit already exists."
20+
echo "Please remove or back it up before installing prek."
21+
else
22+
uv run prek install
23+
fi
724
silent: true
25+
826
sync:
27+
desc: Sync dependencies
928
cmds:
10-
- uv sync --all-extras --all-groups
29+
- "{{.UV_SYNC}}"
1130
silent: true
31+
1232
upgrade:
33+
desc: Upgrade dependencies
1334
cmds:
1435
- uv lock --upgrade
15-
- uv sync --locked --all-extras --all-groups
36+
- task: default
1637
silent: true
38+
1739
test:
18-
deps:
19-
- default
40+
desc: Run tests
41+
deps: [default]
2042
cmds:
2143
- uv run pytest
2244
silent: true
23-
test-coverage:
24-
deps:
25-
- default
45+
46+
test:cov:
47+
desc: Run tests with coverage
48+
deps: [default]
2649
cmds:
2750
- uv run coverage run -m pytest
2851
- uv run coverage html
2952
silent: true
53+
3054
docs:
55+
desc: Build documentation
3156
cmds:
3257
- uv run mkdocs build
3358
silent: true
59+
3460
docs:serve:
61+
desc: Serve documentation
3562
cmds:
3663
- uv run mkdocs serve
3764
silent: true
65+
3866
build:
67+
desc: Build package
3968
cmds:
40-
- cmd: rm --rf dist
69+
- cmd: rm -rf dist
4170
platforms: [linux, darwin]
42-
- cmd: rmdir /s /q dist
71+
- cmd: powershell -Command "if (Test-Path dist) { Remove-Item -Recurse -Force dist }"
4372
platforms: [windows]
4473
- uv build
45-
silent: true
46-
changelog:
47-
cmds:
48-
- uv run git cliff -o CHANGELOG.md
49-
- git add CHANGELOG.md
50-
- 'git commit -m "chore: update changelog [skip ci]"'
51-
silent: true
74+
silent: true

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@ dev = [
5555
"pytest>=8.4.1",
5656
"pytest-asyncio>=1.3.0",
5757
"pytest-cov>=7.0.0",
58+
"pyrefly>=0.46.0",
59+
"ruff>=0.14.10",
60+
"prek>=0.3.3"
5861
]
5962
docs = [
6063
"mkdocs>=1.6.1",
6164
"mkdocs-material==9.6.20",
6265
]
63-
lint = [
64-
"pyrefly>=0.46.0",
65-
"ruff>=0.14.10",
66-
]
6766

6867
[tool.ruff]
6968
exclude = [

src/apkit/_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
commit_id: COMMIT_ID
2929
__commit_id__: COMMIT_ID
3030

31-
__version__ = version = '0.3.3.post1.dev58+ge5df88041.d20260127'
32-
__version_tuple__ = version_tuple = (0, 3, 3, 'post1', 'dev58', 'ge5df88041.d20260127')
31+
__version__ = version = '0.3.8.post1.dev10+g892881c3c'
32+
__version_tuple__ = version_tuple = (0, 3, 8, 'post1', 'dev10', 'g892881c3c')
3333

3434
__commit_id__ = commit_id = None

uv.lock

Lines changed: 30 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)