Skip to content

Commit 910c077

Browse files
Fully pin lint workflow
1 parent daf39ad commit 910c077

5 files changed

Lines changed: 79 additions & 42 deletions

File tree

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ on:
55

66
jobs:
77
Lint:
8-
uses: tskit-dev/.github/.github/workflows/lint.yml@main
8+
uses: tskit-dev/.github/.github/workflows/lint.yml@v11

prek.toml

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
# Configuration file for `prek`, a git hook framework written in Rust.
2-
# See https://prek.j178.dev for more information.
3-
#:schema https://www.schemastore.org/prek.json
1+
# The prek configuration defining linting requirements. This
2+
# setup is optimised for long-term stability and determinism,
3+
# and therefore only uses either "builtin" rules or "local"
4+
# rules implementing lint workflows. We do not use any remote
5+
# workflow repos.
6+
7+
files = { glob = [
8+
"msprime/**",
9+
"benchmarks/**",
10+
"tests/**",
11+
"*.toml",
12+
"docs/**",
13+
"lib/*.[c,h]",
14+
"lib/tests/*.[c,h]",
15+
]}
16+
17+
exclude = { glob = ["lib/avl.*"]}
418

519
[[repos]]
620
repo = "builtin"
@@ -16,46 +30,38 @@ hooks = [
1630
]
1731

1832
[[repos]]
19-
repo = "https://github.com/pre-commit/pre-commit-hooks"
20-
rev = "v6.0.0"
21-
hooks = [
22-
{ id = "debug-statements" },
23-
]
24-
25-
[[repos]]
26-
repo = "https://github.com/astral-sh/uv-pre-commit"
27-
rev = "0.10.3"
28-
hooks = [
29-
{ id = "uv-lock" }
30-
]
31-
32-
[[repos]]
33-
repo = "https://github.com/benjeffery/pre-commit-clang-format"
34-
rev = "1.0"
33+
repo = "local"
3534
hooks = [
3635
{
37-
id = "clang-format",
38-
exclude = "avl|subprojects|dev-tools",
39-
verbose = true
40-
}
36+
id = "ruff-check",
37+
name = "ruff check",
38+
language = "system",
39+
entry = "ruff check --fix --force-exclude",
40+
types = ["python"],
41+
},
4142
]
4243

4344
[[repos]]
44-
repo = "https://github.com/asottile/blacken-docs"
45-
rev = "1.20.0"
45+
repo = "local"
4646
hooks = [
4747
{
48-
id = "blacken-docs",
49-
args = ["--skip-errors"],
50-
additional_dependencies = ["black==22.3.0"],
51-
language_version = "python3"
52-
}
48+
id = "ruff-format",
49+
name = "ruff format",
50+
language = "system",
51+
entry = "ruff format --force-exclude",
52+
types = ["python"],
53+
},
5354
]
5455

5556
[[repos]]
56-
repo = "https://github.com/astral-sh/ruff-pre-commit"
57-
rev = "v0.15.0" # Ruff version.
57+
repo = "local"
5858
hooks = [
59-
{ id = "ruff-check", args = ["--fix"], types_or = ["python", "pyi"] },
60-
{ id = "ruff-format", types_or = ["python", "pyi"] },
59+
{
60+
id = "clang-format",
61+
name = "clang-format",
62+
language = "system",
63+
entry = "clang-format -i",
64+
types = ["c", "header"],
65+
verbose = true,
66+
},
6167
]

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,11 @@ docs = [
9898
"scipy"
9999
]
100100

101+
# Fully pin lint requirements for determinism.
101102
lint = [
102103
"clang-format==21.1.8",
103-
"prek",
104+
"ruff==0.15.1",
105+
"prek==0.3.3",
104106
]
105107

106108
dev = [
@@ -154,15 +156,15 @@ ignore = [
154156
"PT009", # pytest.raises(ValueError) too broad
155157
"PT011", # pytest.raises(ValueError) too broad
156158
"PT012", # pytest.raises() block should contain a single simple statement
157-
"B018", # Found useless expression. Either assign it
158159
"B028", # No stacklevel for warnings
160+
"B018", # Found useless expression. Either assign it
159161
]
160162

161163
fixable = ["ALL"]
162164
unfixable = []
163165

164166
[tool.ruff.lint.isort]
165-
known-first-party = ["_msprime", "msprime"]
167+
known-first-party = ["_msprime", "msprime", "lwt_interface"]
166168
known-third-party = [
167169
"tskit",
168170
"numpy",

tests/test_dict_encoding.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Test cases for the low-level dictionary encoding used to move
22
# data around in C.
33
import lwt_interface.dict_encoding_testlib
4-
from msprime import _msprime
4+
import msprime
55

6-
lwt_interface.dict_encoding_testlib.lwt_module = _msprime
6+
lwt_interface.dict_encoding_testlib.lwt_module = msprime._msprime
77

88
# Bring the tests defined in dict_encoding_testlib into the current namespace
99
# so pytest will find and execute them.

uv.lock

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

0 commit comments

Comments
 (0)