Skip to content

Commit 3ee6dfe

Browse files
edgarribaclaude
andauthored
chore(release): bump workspace-dependency pins to 0.1.15-rc.5 (#1039)
* chore(release): bump workspace-dependency version pins to 0.1.15-rc.5 The rc.5 cut bumped workspace.package.version but left the 11 [workspace.dependencies] kornia-* pins at rc.4 — locally the path component wins so builds pass, but published crates would declare ^0.1.15-rc.4 inter-crate requirements instead of rc.5, diverging from release practice (rc.4's cut bumped both). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore(release): guard workspace-dependency pins against version drift scripts/check_version_pins.py fails when any kornia-* pin in [workspace.dependencies] disagrees with workspace.package.version; wired as a pre-commit hook on Cargo.toml. Release skill step 4 now spells out the both-places rule and the diff-shape sanity check. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(cargo): explain the version-pin bump rule at the point of edit Replaces the stale kornia-py note (kornia-py inherits workspace.package.version since the workspace=true migration — verified via cargo metadata) with the actual trap: the kornia-* dependency pins below cannot inherit the workspace version and must be bumped with it, enforced by scripts/check_version_pins.py. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore(release): regenerate kornia-cpp version.hpp; guard covers it kornia-cpp commits its build.rs-generated version header for pure-CMake consumers — it was still rc.4. Regenerated to rc.5; check_version_pins.py now also validates it, and the release skill documents the cpp step (kornia-py needs nothing: workspace-inherited + pyproject dynamic version). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(release): version.hpp is gitignored — correct the guard/skill wording The header is regenerated by build.rs and never committed; the stale copy was a local artifact, not a shipped bug. Keep the guard's check as a pre-release freshness sanity for by-hand CMake builds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 6e69fd3 commit 3ee6dfe

4 files changed

Lines changed: 80 additions & 14 deletions

File tree

.claude/skills/release/SKILL.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,18 @@ Create one todo per step.
5757
release tag**: `[X.Y.Z]: https://github.com/kornia/kornia-rs/compare/<prev-tag>...vX.Y.Z`.
5858
This is what keeps the changelog navigable across releases.
5959
- Dates: ask the human or read from the environment; never invent one.
60-
4. **Bump version** in root `Cargo.toml`. Run `cargo update -p <workspace crate>`
61-
/ `cargo check` so `Cargo.lock` reflects the bump.
60+
4. **Bump version** in root `Cargo.toml` — BOTH places: `workspace.package.version`
61+
AND every kornia-* pin in `[workspace.dependencies]` (11 lines; Cargo cannot
62+
inherit those, and locally `path` wins so a stale pin builds fine and only
63+
ships a wrong requirement at publish — this bit the rc.5 cut).
64+
`sed -i 's/version = "<old>"/version = "<new>"/g' Cargo.toml` covers both;
65+
`python3 scripts/check_version_pins.py` (also a pre-commit hook on
66+
Cargo.toml) verifies. Then `cargo check` so `Cargo.lock` reflects the bump.
67+
Sanity: the release commit's Cargo.toml diff should touch ~12 version lines,
68+
not 1 — compare against the previous release commit's diff shape.
69+
kornia-cpp/version.hpp is gitignored + regenerated by build.rs (run
70+
`cargo check -p kornia-cpp` if doing by-hand CMake builds); kornia-py
71+
needs nothing (workspace-inherited version, pyproject dynamic).
6272
5. **Release branch + PR:** `release/vX.Y.Z`, commit `chore(release): vX.Y.Z`
6373
with the version bump + CHANGELOG. Open PR, let CI pass, get it merged. Never
6474
force-push a contributor's fork branch — release commits go on a repo branch.

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ repos:
1717
rev: v1.0
1818
hooks:
1919
- id: fmt
20+
- repo: local
21+
hooks:
22+
- id: check-version-pins
23+
name: workspace dependency pins match workspace.package.version
24+
entry: python3 scripts/check_version_pins.py
25+
language: system
26+
files: ^Cargo\.toml$
27+
pass_filenames: false

Cargo.toml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,22 @@ image = "0.25"
5454
imageproc = "0.27"
5555
indicatif = { version = "0.18.4", features = ["rayon"] }
5656
kiddo = "5.3"
57-
# NOTE: remember to update the kornia-py package version in `kornia-py/Cargo.toml` when updating the Rust package version
58-
kornia = { path = "crates/kornia", version = "0.1.15-rc.4" }
59-
kornia-3d = { path = "crates/kornia-3d", version = "0.1.15-rc.4" }
60-
kornia-algebra = { path = "crates/kornia-algebra", version = "0.1.15-rc.4" }
61-
kornia-apriltag = { path = "crates/kornia-apriltag", version = "0.1.15-rc.4" }
62-
kornia-bow = { path = "crates/kornia-bow", version = "0.1.15-rc.4" }
63-
kornia-image = { path = "crates/kornia-image", version = "0.1.15-rc.4" }
64-
kornia-imgproc = { path = "crates/kornia-imgproc", version = "0.1.15-rc.4" }
65-
kornia-io = { path = "crates/kornia-io", version = "0.1.15-rc.4" }
66-
kornia-tensor = { path = "crates/kornia-tensor", version = "0.1.15-rc.4" }
67-
kornia-tensor-ops = { path = "crates/kornia-tensor-ops", version = "0.1.15-rc.4" }
68-
kornia-vlm = { path = "crates/kornia-vlm", version = "0.1.15-rc.4" }
57+
# RELEASE NOTE: these kornia-* version pins CANNOT inherit
58+
# workspace.package.version (Cargo limitation) and must be bumped together
59+
# with it on every release — locally `path` wins so a stale pin builds fine
60+
# and only ships a wrong dependency requirement at publish time. Enforced by
61+
# scripts/check_version_pins.py (pre-commit hook on this file).
62+
kornia = { path = "crates/kornia", version = "0.1.15-rc.5" }
63+
kornia-3d = { path = "crates/kornia-3d", version = "0.1.15-rc.5" }
64+
kornia-algebra = { path = "crates/kornia-algebra", version = "0.1.15-rc.5" }
65+
kornia-apriltag = { path = "crates/kornia-apriltag", version = "0.1.15-rc.5" }
66+
kornia-bow = { path = "crates/kornia-bow", version = "0.1.15-rc.5" }
67+
kornia-image = { path = "crates/kornia-image", version = "0.1.15-rc.5" }
68+
kornia-imgproc = { path = "crates/kornia-imgproc", version = "0.1.15-rc.5" }
69+
kornia-io = { path = "crates/kornia-io", version = "0.1.15-rc.5" }
70+
kornia-tensor = { path = "crates/kornia-tensor", version = "0.1.15-rc.5" }
71+
kornia-tensor-ops = { path = "crates/kornia-tensor-ops", version = "0.1.15-rc.5" }
72+
kornia-vlm = { path = "crates/kornia-vlm", version = "0.1.15-rc.5" }
6973
log = "0.4"
7074
minijinja = { version = "2.20", features = ["loader"] }
7175
nalgebra = "0.35"

scripts/check_version_pins.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env python3
2+
"""Fail if any kornia-* pin in [workspace.dependencies] disagrees with
3+
workspace.package.version.
4+
5+
The workspace crates inherit their own version via `version.workspace =
6+
true`, but the inter-crate dependency pins in [workspace.dependencies]
7+
are plain strings Cargo cannot inherit — and locally the `path`
8+
component wins, so a stale pin builds fine and only ships a wrong
9+
requirement at publish time (this bit the v0.1.15-rc.5 cut). Run from
10+
pre-commit / CI so a release bump can never touch one without the
11+
other.
12+
"""
13+
import re
14+
import sys
15+
from pathlib import Path
16+
17+
root = Path(__file__).resolve().parent.parent / "Cargo.toml"
18+
text = root.read_text()
19+
20+
m = re.search(r'^\[workspace\.package\]$.*?^version = "([^"]+)"', text, re.M | re.S)
21+
if not m:
22+
sys.exit("workspace.package.version not found in Cargo.toml")
23+
ws_version = m.group(1)
24+
25+
bad = []
26+
for line in text.splitlines():
27+
pin = re.match(r'^(kornia[a-z0-9-]*)\s*=.*path = "crates/.*version = "([^"]+)"', line)
28+
if pin and pin.group(2) != ws_version:
29+
bad.append(f" {pin.group(1)}: {pin.group(2)} (workspace is {ws_version})")
30+
31+
# kornia-cpp's version.hpp is gitignored and regenerated by build.rs, but a
32+
# stale local copy can leak into by-hand CMake builds that skip cargo — flag
33+
# it so release builds start from a regenerated header.
34+
hpp = root.parent / "kornia-cpp" / "include" / "kornia" / "version.hpp"
35+
if hpp.exists() and f'#define KORNIA_VERSION "{ws_version}"' not in hpp.read_text():
36+
bad.append(f" kornia-cpp/include/kornia/version.hpp (workspace is {ws_version})")
37+
38+
if bad:
39+
print("version pins out of sync with workspace.package.version:")
40+
print("\n".join(bad))
41+
print(f'fix: sed -i \'s/version = "<stale>"/version = "{ws_version}"/g\' Cargo.toml'
42+
" && cargo check -p kornia-cpp # regenerates version.hpp")
43+
sys.exit(1)
44+
print(f"version pins OK ({ws_version})")

0 commit comments

Comments
 (0)