Skip to content

Commit 48995f6

Browse files
add pre commit hooks
1 parent 8bf16e1 commit 48995f6

File tree

4 files changed

+166
-36
lines changed

4 files changed

+166
-36
lines changed

.pre-commit-config.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
default_install_hook_types:
3+
- commit-msg
4+
- pre-commit
5+
- pre-push
6+
exclude: ^(.*(\.?venv.*)/)
7+
repos:
8+
- repo: local
9+
hooks:
10+
- id: ruff-format
11+
name: ☕️ Use Ruff to format code
12+
language: system
13+
types: [python]
14+
entry: uv run ruff format
15+
require_serial: true
16+
- id: ruff-linting
17+
name: ☕️ Use Ruff to lint code
18+
language: system
19+
types: [python]
20+
entry: uv run ruff check --fix
21+
require_serial: true
22+
- repo: https://github.com/pre-commit/pre-commit-hooks
23+
rev: v5.0.0
24+
hooks:
25+
- id: check-json
26+
name: ☕️ Check for JSON syntax errors
27+
- repo: https://github.com/koalaman/shellcheck-precommit
28+
rev: v0.10.0
29+
hooks:
30+
- id: shellcheck
31+
name: ☕️ Ensure Shell Scripts are good with ShellCheck
32+
files: .*\.sh$
33+
args: [-x]
34+
- repo: https://github.com/pre-commit/mirrors-mypy
35+
rev: v1.15.0
36+
hooks:
37+
- id: mypy
38+
name: ☕️ Ensure types are correct with mypy
39+
args:
40+
- '--config-file=pyproject.toml'
41+
- '--python-version=3.11'
42+
additional_dependencies:
43+
- types-pyyaml>=6.0.12
44+
- types-requests>=2.32.0
45+
pass_filenames: false

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ dev-dependencies = [
4141
"ruff>=0.9.1",
4242
"mkdocs-material>=9.5.49",
4343
"mkdocs>=1.6.1",
44-
"mypy>=1.14.1",
44+
"mypy>=1.15.0",
4545
"ipykernel>=6.29.5",
4646
"pytest>=8.3.4",
4747
"pytest-cov>=6.0.0",
48+
"pre-commit>=4.2.0",
4849
]
4950
# This is a workaround for the missing support of aarch64 in pyqt5, need to install this over apt +
5051
# include this with system site packages

readme.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ See also at the [dev notes](./docs/.devnotes.md) section for a complete run down
150150
uv sync --all-extras
151151
```
152152

153+
We also use pre-commits to check the code style and run some tests before every commit.
154+
You can install them with:
155+
156+
```bash
157+
uv run pre-commit install --install-hooks
158+
```
159+
153160
This will install all dependencies and you can start developing.
154161
Then just run:
155162

0 commit comments

Comments
 (0)