Skip to content

Commit 21584e1

Browse files
authored
Repair pre-commit, drop pixi.lock, point .gitattributes at uv.lock (#67)
.pre-commit-config.yaml had rotted into a trap. It ran ruff-format while CI enforces black, and the two disagree: black reports the tree clean, ruff format rewrites five files, and black then rejects one of them. Any contributor who ran `pre-commit install` would have had their commits reformatted into a state that fails the lint job. It went unnoticed only because nothing runs it -- no git hook is installed and no workflow invokes it -- despite pre-commit sitting in the lint dependency group. Formatting is now black's alone, running after ruff-check so the formatter has the last word. Hook revs are current: ruff was pinned at 0.12.1 against a project on 0.16.3, and prettier pointed at pre-commit/mirrors-prettier, which upstream archived; that moves to the maintained rbubley fork. A pre-commit ecosystem is added to dependabot so these stop drifting silently. Deleting the config instead would have been simpler but would have dropped codespell, validate-pyproject, and prettier, none of which CI runs. With the hooks working, codespell found eleven hits. Five were false positives -- `lamda` is the LAMDA lab's domain in author emails, `anc` a local for "ancestors" -- and are now in ignore-words-list with a note. The other six are corrected, including "Subsequnce" in IKTOD's class docstring and a misspelled variable in a doctest example, both user-facing. prettier also normalized indentation in three workflow files and removed a blank line from mkdocs.yml, the first time it has run over them. Verified the parsed YAML is identical before and after, and that the docs still build under --strict. pixi.lock is removed: 438K of lockfile with no pixi.toml and no [tool.pixi] section, orphaned since the move to uv. .gitattributes existed only to mark it generated, so it now does the same for uv.lock, which collapses that file in diffs and keeps it out of language stats.
1 parent 6b3905a commit 21584e1

14 files changed

Lines changed: 72 additions & 8774 deletions

File tree

.gitattributes

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
# GitHub syntax highlighting
2-
pixi.lock linguist-language=YAML linguist-generated=true
3-
# SCM syntax highlighting
4-
pixi.lock linguist-language=YAML linguist-generated=true
1+
# Collapse the lockfile in diffs and keep it out of language statistics.
2+
uv.lock linguist-language=TOML linguist-generated=true

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,16 @@ updates:
2222
github-actions:
2323
patterns:
2424
- "*"
25+
26+
# Without this the hook revs in .pre-commit-config.yaml drift silently, which
27+
# is how they ended up pinned to ruff 0.12.1 and an archived prettier mirror.
28+
- package-ecosystem: "pre-commit"
29+
directory: "/"
30+
schedule:
31+
interval: "weekly"
32+
labels:
33+
- "dependencies"
34+
groups:
35+
pre-commit:
36+
patterns:
37+
- "*"

.github/workflows/deploy-gh-pages.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Documentation
33
on:
44
push:
55
branches:
6-
- main
6+
- main
77
tags:
88
- "v*"
99
pull_request:
@@ -31,35 +31,35 @@ jobs:
3131
contents: write
3232

3333
steps:
34-
- uses: actions/checkout@v7
35-
with:
36-
fetch-depth: 0
34+
- uses: actions/checkout@v7
35+
with:
36+
fetch-depth: 0
3737

38-
- name: Set up Python
39-
uses: actions/setup-python@v7
40-
with:
41-
python-version: "3.13"
38+
- name: Set up Python
39+
uses: actions/setup-python@v7
40+
with:
41+
python-version: "3.13"
4242

43-
- name: Set up uv
44-
uses: astral-sh/setup-uv@v7
45-
with:
46-
enable-cache: true
43+
- name: Set up uv
44+
uses: astral-sh/setup-uv@v7
45+
with:
46+
enable-cache: true
4747

48-
- name: Install docs dependencies
49-
run: uv sync --locked --no-default-groups --group docs
48+
- name: Install docs dependencies
49+
run: uv sync --locked --no-default-groups --group docs
5050

51-
- name: Deploy docs as dev
52-
if: ${{ github.ref == 'refs/heads/main' }}
53-
run: |
54-
git config user.name "github-actions[bot]"
55-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
56-
uv run mike deploy --push --update-aliases dev
51+
- name: Deploy docs as dev
52+
if: ${{ github.ref == 'refs/heads/main' }}
53+
run: |
54+
git config user.name "github-actions[bot]"
55+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
56+
uv run mike deploy --push --update-aliases dev
5757
58-
- name: Deploy versioned docs and update latest
59-
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
60-
run: |
61-
VERSION="${GITHUB_REF_NAME#v}"
62-
git config user.name "github-actions[bot]"
63-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
64-
uv run mike deploy --push --update-aliases "$VERSION" latest
65-
uv run mike set-default --push latest
58+
- name: Deploy versioned docs and update latest
59+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
60+
run: |
61+
VERSION="${GITHUB_REF_NAME#v}"
62+
git config user.name "github-actions[bot]"
63+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
64+
uv run mike deploy --push --update-aliases "$VERSION" latest
65+
uv run mike set-default --push latest

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
run: uv sync --locked --no-default-groups --group docs
3030

3131
- name: Build documentation (strict, execute notebooks)
32-
run: uv run mkdocs build --strict
32+
run: uv run mkdocs build --strict

.github/workflows/fresh-resolution.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: Fresh Resolution
1111

1212
on:
1313
schedule:
14-
- cron: '0 3 * * 1' # Monday at 03:00
14+
- cron: "0 3 * * 1" # Monday at 03:00
1515
workflow_dispatch:
1616

1717
permissions:

.pre-commit-config.yaml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,44 @@ fail_fast: false
22

33
repos:
44
- repo: https://github.com/abravalheri/validate-pyproject
5-
rev: v0.24.1
5+
rev: v0.25
66
hooks:
77
- id: validate-pyproject
88

9-
- repo: https://github.com/pre-commit/mirrors-prettier
10-
rev: v3.1.0
9+
# pre-commit/mirrors-prettier was archived upstream; this is the maintained fork.
10+
- repo: https://github.com/rbubley/mirrors-prettier
11+
rev: v3.9.6
1112
hooks:
1213
- id: prettier
1314
types_or: [yaml, json5]
1415

1516
- repo: https://github.com/astral-sh/ruff-pre-commit
16-
# Ruff version.
17-
rev: v0.12.1
17+
rev: v0.16.3
1818
hooks:
19-
# Run the linter.
19+
# Linting only. Formatting is black's job below -- running ruff-format
20+
# here as well rewrote files in ways black then rejected, so a commit made
21+
# with these hooks installed would fail the lint job in CI.
2022
- id: ruff-check
2123
args: [--fix, --exit-non-zero-on-fix]
22-
# Run the formatter.
23-
- id: ruff-format
24+
25+
# Runs after ruff so the formatter has the last word. Keep this rev in sync
26+
# with the black pin in pyproject.toml; CI enforces that version.
27+
- repo: https://github.com/psf/black-pre-commit-mirror
28+
rev: 26.5.1
29+
hooks:
30+
- id: black
2431

2532
- repo: https://github.com/pre-commit/pre-commit-hooks
2633
rev: v6.0.0
2734
hooks:
35+
# Redundant with branch protection on main, but fails locally and
36+
# immediately rather than at push time.
2837
- id: no-commit-to-branch
2938
name: prevent commits to main
3039
args: [--branch, main]
3140

3241
- repo: https://github.com/codespell-project/codespell
33-
rev: v2.4.1
42+
rev: v2.4.3
3443
hooks:
3544
- id: codespell # See pyproject.toml for args
3645
additional_dependencies:

docs/contributing/contribution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Tips
4747
- Anything in the `dev` branch should be deployable (no failing tests).
4848
- Never use `git add .`: it can add unwanted files;
4949
- Avoid using `git commit -a` unless you know what you're doing;
50-
- Check every change with `git diff` before adding then to the index (stage area) and with `git diff --cached` before commiting;
50+
- Check every change with `git diff` before adding then to the index (stage area) and with `git diff --cached` before committing;
5151
- If you have push access to the main repository, please do not commit directly to `dev`: your access should be used only to accept pull requests; if you want to make a new feature, you should use the same process as other developers so that your code can be reviewed.
5252

5353
Documentation Guidelines
@@ -68,7 +68,7 @@ Code Guidelines
6868
Tests
6969
-----
7070

71-
We use [Github Actions](https://github.com/features/actions)for continous integration
71+
We use [Github Actions](https://github.com/features/actions)for continuous integration
7272
and python [pytest](https://docs.pytest.org/en/stable/index.html) for writing tests.
7373
You should write tests for every feature you add or bug you solve in the code.
7474
Having automated tests for every line of our code let us make big changes

ikpykit/graph/_ikgod.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class IKGOD(BaseEstimator):
8585
>>> # Fit model
8686
>>> model = IKGOD(n_estimators=100, h=2).fit(adj, features)
8787
>>> # Predict outliers
88-
>>> lables = model.predict(features)
88+
>>> labels = model.predict(features)
8989
"""
9090

9191
def __init__(

ikpykit/stream/cluster/_inode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def _delete_ancestors_ikv(self):
140140
def _find_and_delete_point(self, current_node, pt_id):
141141
while current_node.is_internal():
142142
current_node.pts.remove(pt_id)
143-
# assert (p_id in curr_node.children[0].pts[0]) != (p_id in curr_node.children[1].pts[0]), "Except: Exsiting only in one subtree, \
143+
# assert (p_id in curr_node.children[0].pts[0]) != (p_id in curr_node.children[1].pts[0]), "Except: Existing only in one subtree, \
144144
# Get: %s %s" % (p_id in curr_node.children[0].pts[0],
145145
# p_id in curr_node.children[1].pts[0])
146146
if pt_id in current_node.children[0].pts:

ikpykit/stream/cluster/utils/deltasep_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def create_dataset(dims, size, num_clusters=20):
5555
a dataset of all points.
5656
5757
Args:
58-
dims - (int) the dimention of all data points.
58+
dims - (int) the dimension of all data points.
5959
size - (int) the number of points to generate for each cluster.
6060
num_clusters - (int) the number of clusters.
6161
"""

0 commit comments

Comments
 (0)