Skip to content

Commit efecd13

Browse files
committed
add poe tasks and update precommit config
Signed-off-by: Thijs Baaijen <[email protected]>
1 parent afbc4c6 commit efecd13

File tree

3 files changed

+64
-119
lines changed

3 files changed

+64
-119
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,10 @@
33
# SPDX-License-Identifier: MPL-2.0
44

55
repos:
6-
- repo: https://github.com/fsfe/reuse-tool
7-
rev: v4.0.3
8-
hooks:
9-
- id: reuse
10-
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
# Ruff version.
12-
rev: v0.8.2
13-
hooks:
14-
# Run the linter.
15-
- id: ruff
16-
args: [ --fix ]
17-
# Run the formatter.
18-
- id: ruff-format
19-
- repo: https://github.com/pre-commit/mirrors-mypy
20-
rev: v1.11.2
21-
hooks:
22-
- id: mypy
23-
additional_dependencies: [numpy, pandas]
246
- repo: local
257
hooks:
26-
- id: pylint
27-
name: pylint
28-
entry: pylint
29-
files: ^src/.+\.py$
30-
language: system
31-
types: [ python ]
32-
args: [ "--rcfile=pyproject.toml" ]
33-
require_serial: true
34-
- id: pytest
35-
name: pytest
36-
entry: pytest
8+
- id: quality-checks
9+
name: Run all quality checks
10+
entry: poe all --check
3711
language: system
38-
pass_filenames: false
39-
always_run: true
40-
args: []
12+
types: [python]

pyproject.toml

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,16 @@ dynamic = ["version"]
3636
[dependency-groups]
3737
pandas = ["pandas>=2.2.1"]
3838
dev = [
39-
"pylint>=3.1.0",
40-
"pytest>=8.1.1",
41-
"coverage>=7.4.4",
42-
"black>=24.3.0",
43-
"ruff>=0.3.5",
44-
"isort>=5.13.2",
45-
"mypy>=1.9.0",
46-
"pre-commit>=4",
39+
"pylint",
40+
"pytest",
41+
"coverage",
42+
"ruff",
43+
"mypy",
44+
"pre-commit",
4745
# Visualization (make sure these stay equalivalent to the 'visualizer' group)
48-
"dash>=3.0.0",
49-
"dash-bootstrap-components>=2.0.3",
50-
"dash-cytoscape>=1.0.2",
46+
"dash",
47+
"dash-bootstrap-components",
48+
"dash-cytoscape",
5149
]
5250

5351
visualizer = [
@@ -123,17 +121,34 @@ disable_error_code = ["assignment", "import-untyped"]
123121

124122
[tool.coverage.run]
125123
relative_files = true
126-
branch = true
124+
source = ["src"]
125+
command_line = '--module pytest'
127126

128127
[tool.coverage.report]
128+
fail_under = 90
129129
exclude_also = [
130130
'if TYPE_CHECKING:',
131131
]
132132

133+
[tool.poe.tasks.all]
134+
help = "Run all CI calls"
135+
control.expr = "check"
136+
args = [{name = "check", type="boolean", help= "Does not correct files, only warns"}]
137+
[[tool.poe.tasks.all.switch]]
138+
case = "True"
139+
sequence = ["lint --check", "format --check", "lock", "type", "cover", "report"]
140+
141+
[[tool.poe.tasks.all.switch]]
142+
sequence = ["lint", "format", "lock", "type", "cover", "report"]
143+
144+
133145
[tool.poe.tasks.lint]
134-
help = "Lint code (with ruff)"
146+
help = "Lint code (with ruff & pylint)"
135147
# --no-fix does override --fix in ruff, if --check is given to poe.
136-
cmd = 'ruff check --fix --show-fixes ${check:+ --no-fix}'
148+
sequence = [
149+
{cmd='ruff check --fix --show-fixes ${check:+ --no-fix}'},
150+
{cmd="pylint src"},
151+
]
137152
args=[{name = "check", type="boolean", help= "Does not correct files, only warns"}]
138153

139154
[tool.poe.tasks.format]
@@ -146,10 +161,18 @@ help = "Sort imports (with ruff)"
146161
cmd = 'ruff check --select I --fix --show-fixes ${check:+ --no-fix}'
147162
args=[{name = "check", type="boolean", help= "Does not correct files, only warns"}]
148163

164+
[tool.poe.tasks.type]
165+
help = "Type check code (with mypy)"
166+
cmd = "mypy src tests"
167+
149168
[tool.poe.tasks.tests]
150169
help = "Run tests"
151170
cmd = "pytest"
152171

172+
[tool.poe.tasks.lock]
173+
help = "Asserts that dependencies are locked"
174+
cmd = "uv lock --check"
175+
153176
[tool.poe.tasks.cover]
154177
help = "Run tests (and gather coverage)"
155178
cmd = "coverage run"

uv.lock

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

0 commit comments

Comments
 (0)