refactor: remove obipipeline crate and migrate dependencies
Release / create-release (push) Successful in 32s
Release / build-linux-x86_64 (push) Successful in 6m51s
Release / build-macos-arm64 (push) Failing after 40s

Delete the `obipipeline` crate and update all dependent crates to use the
published `obipipeline` version 0.2 from the `obi` registry. Migrate
specific pipeline logic into consuming crates: move error handling to
`obikindexer` and batch iteration logic to `obiskio`. Update build
scripts to support MSRV checking and improved dependency management.

- Delete `src/obipipeline/` entirely, removing the pipeline runtime,
  scheduler, macros, and throttle implementations.
- Move `fmt` (now `pipeline_error`) from `obipipeline` error handling to
  `src/obikindexer/src/graph_pipeline.rs` for graph building errors.
- Move `apply` (now `iter_canonical_kmer_batches_owned`) from
  `obipipeline` pipe logic to `src/obiskio/src/unitig_index/reader.rs`
  to provide lazy batch iteration for canonical kmers.
- Update `src/obikindexer`, `src/obikmerge`, `src/obikphylo`, and
  `src/obiskim` to depend on `obipipeline` version 0.2 from the `obi`
  registry instead of the local path.
- Refactor `src/obikindexer/src/graph_pipeline.rs` to use the new
  `pipeline_error` function and update `build_graph` to accept an
  iterator-returning `open` function.
- Refactor `src/obikmerge` to use `iter_canonical_kmer_batches_owned`
  for streaming batches in `merge_partition` and `run_pass2`, replacing
  previous pipeline stage logic.
- Refactor `src/obikphylo` to handle errors via `OKIError::InvalidData`
  in `build_layer_sibling_annex` and `scan_layer_families`.
- Refactor `src/obiskim` to use `.expect("pipeline error")` for batch
  processing in `query` and `superkmer` commands.
- Add `src/obiskio/src/unitig_index/reader.rs` method
  `iter_canonical_kmer_batches_owned` for lazy batch iteration.
- Add `.crate-kit/scripts/msrv-check.sh` to verify the declared
  `rust-version` builds successfully with the specified toolchain.
- Update `.crate-kit/scripts/deps-check.sh` and `deps-lib.sh` to
  support `cargo update` with specific arguments and improved lockfile
  handling.
- Update `.crate-kit/scripts/bump-version.sh` to use `sed -E` for
  robust version string replacement in `README.md`.
- Update `.crate-kit/scripts/publish-guard.sh` and `publish.sh` to
  enforce registry settings and exclude internal files from packages.
- Update `.gitea/workflows/release.yml` to pass the private cargo
  registry index environment variable during macOS binary builds.
- Remove `Cargo.lock` from the repository root and update
  `src/Cargo.lock` to reflect the new `obipipeline` dependency version.
- Update `src/Cargo.toml` workspace members to remove `obikseq` and
  add `obifastwrite`.
This commit is contained in:
Eric Coissac committed 2026-12-02 16:16:40 +01:00
1 parent e4528725d4
commit b2222afbe3
39 files changed
+304 -1304

No files matched your search

+7 -3
View File
@@ -3,8 +3,8 @@
# break -> x.y+1.0 while x = 0, otherwise x+1.0.0
# additions -> x.y+1.0 once x >= 1 (SemVer: new feature), x.y.z+1 while x = 0
# otherwise -> x.y.z+1
# RELEASE=x.y.z forces the version. Updates Cargo.toml, version.txt and the
# dependency line `<crate> = "x.y"` of README.md when they exist.
# RELEASE=x.y.z forces the version. Updates Cargo.toml, version.txt and the dependency
# lines of README.md (`<crate> = "x.y"` or `<crate> = { version = "x.y", ... }`) when they exist.
set -euo pipefail
. "$(dirname "$0")/common.sh"
@@ -61,7 +61,11 @@ sed -i.bak "s/^version = \"$current\"/version = \"$new_version\"/" "$CARGO_TOML"
rm "$CARGO_TOML.bak"
[ -f version.txt ] && echo "$new_version" >version.txt
if [ -f README.md ]; then
sed -i.bak "s/^$name = \"[0-9][0-9.]*\"/$name = \"$(echo "$new_version" | cut -d. -f1,2)\"/" README.md
short=$(echo "$new_version" | cut -d. -f1,2)
sed -E -i.bak \
-e "s/^(${name}[[:space:]]*=[[:space:]]*\")[0-9][0-9.]*\"/\1$short\"/" \
-e "s/^(${name}[[:space:]]*=[[:space:]]*\{([^}]*[ ,])?version[[:space:]]*=[[:space:]]*\")[0-9][0-9.]*\"/\1$short\"/" \
README.md
rm README.md.bak
fi
ok "✓ Version $new_version written to $CARGO_TOML (and version.txt, README.md if they exist)"
+7 -9
View File
@@ -135,7 +135,7 @@ for manifest in "${manifests[@]}"; do
new=$(floor_for "$latest")
rewrite_req "$manifest" "$key" "$new"
info " $crate ($manifest): \"$req\" → \"$new\" (latest version: $latest)"
updates+="$crate "
updates+="$crate@$latest "
else
bad "$crate ($manifest): the requirement \"$req\" does not accept the latest version $latest → \"$(floor_for "$latest")\" (make deps-bump)"
fi
@@ -150,21 +150,21 @@ for manifest in "${manifests[@]}"; do
new=$(floor_for "$latest")
rewrite_req "$manifest" "$key" "$new"
info " $crate ($manifest): \"$req\" → \"$new\" (latest version: $latest)"
updates+="$crate "
updates+="$crate@$latest "
else
bad "$crate ($manifest): the requirement \"$req\" is behind the latest version $latest → \"$(floor_for "$latest")\" (make deps-bump)"
fi
fi
# Cargo.lock: on the latest version that the requirement accepts.
if [ -f Cargo.lock ]; then
if [ -f "$LOCKFILE" ]; then
locked=$(lock_entries | awk -v n="$crate" '$1 == n && index($3, "crates.io-index") { print $2 }' | sort -V | tail -n 1)
if [ -n "$locked" ] && [ "$locked" != "$latest" ] &&
[ "$(printf '%s\n%s\n' "$locked" "$latest" | sort -V | tail -n 1)" = "$latest" ]; then
if [ "$mode" = bump ]; then
updates+="$crate "
updates+="$crate@$latest "
else
bad "$crate: Cargo.lock is on $locked, the latest version is $latest → cargo update -p $crate (make deps-bump)"
bad "$crate: $LOCKFILE is on $locked, the latest version is $latest → cargo update $(lock_update_args "$crate" "$latest" crates.io-index) (make deps-bump)"
fi
fi
fi
@@ -180,10 +180,8 @@ if [ "$offline" -eq 1 ]; then
fi
if [ "$mode" = bump ] && [ -n "$updates" ]; then
for n in $(printf '%s\n' $updates | sort -u); do
info " cargo update -p $n"
"$CARGO" update -p "$n" >/dev/null
done
# shellcheck disable=SC2086 # list of words
lock_update crates.io-index $updates
fi
if [ "$fail" -ne 0 ]; then
+10 -12
View File
@@ -88,7 +88,7 @@ while IFS=$'\t' read -r manifest line; do
sed -E "/^${name}[[:space:]]*=.*registry[[:space:]]*=[[:space:]]*\"$REGISTRY\"/ s/(version[[:space:]]*=[[:space:]]*\")[^\"]*/\1$new/" "$manifest" >"$manifest.tmp" &&
mv "$manifest.tmp" "$manifest"
info " $name ($manifest): \"$req\" → \"$new\" (latest published version: $latest)"
updates+="$name "
updates+="$name@$latest "
else
bad "$name ($manifest): the requirement \"$req\" does not accept the latest published version $latest → $name = { version = \"$(req_for "$latest")\", registry = \"$REGISTRY\" } (make deps-bump)"
fi
@@ -99,13 +99,13 @@ while IFS=$'\t' read -r manifest line; do
esac
# Cargo.lock: on the latest version if the dependency comes from the registry.
if [ -f Cargo.lock ]; then
if [ -f "$LOCKFILE" ]; then
locked=$(lock_entries | awk -v n="$name" -v r="/api/packages/$REGISTRY/" '$1 == n && index($3, r) { print $2 }' | sort -V | tail -n 1)
if [ -n "$locked" ] && [ "$locked" != "$latest" ] && [ "$acc" -eq 0 ]; then
if [ "$mode" = bump ]; then
updates+="$name "
updates+="$name@$latest "
else
bad "$name: Cargo.lock is on $locked, the latest published version is $latest → cargo update -p $name (make deps-bump)"
bad "$name: $LOCKFILE is on $locked, the latest published version is $latest → cargo update $(lock_update_args "$name" "$latest" "/api/packages/$REGISTRY/") (make deps-bump)"
fi
fi
fi
@@ -132,14 +132,14 @@ if [ "$offline" -eq 1 ]; then
fi
# Cargo.lock: ignored patch and duplicates.
if [ -f Cargo.lock ]; then
if [ -f "$LOCKFILE" ]; then
unused=$(awk '
/^\[\[patch.unused\]\]/ { u = 1; next }
/^\[/ { u = 0 }
u && /^name = / { gsub(/"/, "", $3); print $3 }
' Cargo.lock | sort -u | paste -sd' ' -)
' "$LOCKFILE" | sort -u | paste -sd' ' -)
if [ -n "$unused" ] && [ "$mode" = check ]; then
bad "Cargo.lock: local patch ignored for $unused — the project's requirement does not accept the version of the neighbouring folder"
bad "$LOCKFILE: local patch ignored for $unused — the project's requirement does not accept the version of the neighbouring folder"
fi
dups=$(lock_entries | awk -v r="/api/packages/$REGISTRY/" '
{ c[$1]++; vs[$1] = vs[$1] " " $2; if ($3 == "-" || index($3, r)) p[$1] = 1 }
@@ -147,16 +147,14 @@ if [ -f Cargo.lock ]; then
')
if [ -n "$dups" ]; then
while IFS= read -r d; do
bad "Cargo.lock: several versions of ${d%%:*} in the build (${d#*: }) — align the requirements of the crates that depend on it"
bad "$LOCKFILE: several versions of ${d%%:*} in the build (${d#*: }) — align the requirements of the crates that depend on it"
done <<<"$dups"
fi
fi
if [ "$mode" = bump ] && [ -n "$updates" ]; then
for n in $(printf '%s\n' $updates | sort -u); do
info " cargo update -p $n"
"$CARGO" update -p "$n" >/dev/null
done
# shellcheck disable=SC2086 # list of words
lock_update "/api/packages/$REGISTRY/" $updates
fi
if [ "$fail" -ne 0 ]; then
+49 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Functions shared by the dependency checks (deps-check.sh, deps-check-external.sh).
# To be sourced after common.sh. Nothing here writes a file.
# To be sourced after common.sh. Only lock_update writes a file (Cargo.lock, through cargo).
index_url="${REGISTRY_INDEX#sparse+}"
index_url="${index_url%/}"
@@ -53,6 +53,15 @@ req_for() {
esac
}
# Cargo.lock of the project and the cargo option that designates its workspace. The workspace is the
# root, unless MEMBERS_DIR holds it (a Cargo.toml with a [workspace] table).
LOCKFILE=Cargo.lock
workspace_args=""
if [ -n "${MEMBERS_DIR:-}" ] && grep -q '^\[workspace[].]' "$MEMBERS_DIR/Cargo.toml" 2>/dev/null; then
LOCKFILE="$MEMBERS_DIR/Cargo.lock"
workspace_args="--manifest-path $MEMBERS_DIR/Cargo.toml "
fi
# Packages of Cargo.lock, one per line: "name version source" ("-" without source). The
# [[patch.unused]] blocks are excluded.
lock_entries() {
@@ -64,7 +73,45 @@ lock_entries() {
inpkg && /^version = / { gsub(/"/, "", $3); v = $3 }
inpkg && /^source = / { gsub(/"/, "", $3); s = $3 }
END { flush() }
' Cargo.lock
' "$LOCKFILE"
}
# Semver-compatible series of version $1: x (≥ 1), 0.y, or 0.0.z itself.
series() {
case "$1" in
0.0.*) echo "$1" ;;
0.*) echo "$1" | cut -d. -f1,2 ;;
*) echo "$1" | cut -d. -f1 ;;
esac
}
# Arguments of `cargo update` that move crate $1, taken from the sources containing $3, to its latest
# version $2. When Cargo.lock holds several versions of the crate, the bare name is ambiguous: the one
# of the series of $2 is named. If there is none (the requirement has just been raised to a new
# series), `--workspace` makes cargo resolve the new requirement.
lock_update_args() {
local count=0 v old=""
[ -f "$LOCKFILE" ] && count=$(lock_entries | awk -v n="$1" '$1 == n' | wc -l)
if [ "$count" -le 1 ]; then
echo "$workspace_args-p $1"
return
fi
for v in $(lock_entries | awk -v n="$1" -v s="$3" '$1 == n && index($3, s) { print $2 }'); do
[ "$(series "$v")" = "$(series "$2")" ] && old="$v"
done
if [ -n "$old" ]; then echo "$workspace_args-p $1@$old"; else echo "$workspace_args--workspace"; fi
}
# Runs the `cargo update` of each "crate@latest" of $2…, taken from the sources containing $1.
lock_update() {
local source="$1" u args
shift
for u in $(printf '%s\n' "$@" | sort -u); do
args=$(lock_update_args "${u%@*}" "${u#*@}" "$source")
info " cargo update $args"
# shellcheck disable=SC2086 # list of words, without spaces inside
"$CARGO" update $args >/dev/null
done
}
manifests=("$CARGO_TOML")
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Checks the `rust-version` declared in Cargo.toml. It is a guarantee ("this crate builds with that toolchain"),
# so it must name a toolchain that is INSTALLED here and on which the crate really passes `cargo check`:
# a version nobody tested is a promise nobody can keep.
# - no rust-version: nothing to check (exit 0);
# - rust-version but no matching installed toolchain: refused, with the command to install it;
# - otherwise `cargo +<toolchain> check --all-targets` must pass.
# The toolchain is matched on the version as written: "1.100" matches 1.100.x, "1.100.0" matches only 1.100.0.
set -euo pipefail
. "$(dirname "$0")/common.sh"
[ -f "$CARGO_TOML" ] || exit 0
ver=$(sed -nE 's/^rust-version[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/p' "$CARGO_TOML" | head -n 1)
[ -n "$ver" ] || exit 0
if ! command -v rustup >/dev/null; then
err "✗ rust-version = \"$ver\" but rustup is absent: the claim cannot be tested here"
exit 1
fi
pat="^$(printf '%s' "$ver" | sed 's/\./\\./g')(\\.[0-9]+)?-"
tc=$(rustup toolchain list | awk '{print $1}' | grep -E "$pat" | head -n 1 || true)
if [ -z "$tc" ]; then
err "✗ rust-version = \"$ver\": no such toolchain installed, so it cannot be tested."
err " Install it (rustup toolchain install $ver) and re-run, or declare a version that is installed."
exit 1
fi
info "→ Checking the code with toolchain $tc (rust-version = \"$ver\")..."
"$CARGO" "+$tc" check --all-targets
+23 -5
View File
@@ -1,12 +1,30 @@
#!/usr/bin/env bash
# Safeguard: a crate published on a private registry declares `publish = ["<registry>"]` in its
# Cargo.toml, so that cargo itself refuses any publication elsewhere (crates.io for example).
# Safeguards before a publication:
# 1. a crate published on a private registry declares `publish = ["<registry>"]` in its Cargo.toml, so that
# cargo itself refuses any publication elsewhere (crates.io for example);
# 2. the published archive does not carry the kit's own files (.crate-kit/, .gitea/, api/, Makefile):
# development tooling, useless to the users of the crate. `exclude` in [package] keeps them out.
# Not applicable: kind without publication (PUBLISH=no), registry absent or crates-io.
set -euo pipefail
. "$(dirname "$0")/common.sh"
[ "${PUBLISH:-yes}" = no ] && exit 0
{ [ -n "$REGISTRY" ] && [ "$REGISTRY" != crates-io ]; } || exit 0
[ -f "$CARGO_TOML" ] || exit 0
grep -qE "^publish[[:space:]]*=[[:space:]]*\[[[:space:]]*\"$REGISTRY\"[[:space:]]*\]" "$CARGO_TOML" && exit 0
err "✗ $CARGO_TOML : publish = [\"$REGISTRY\"] missing in [package] (without it, cargo publish would accept crates.io)"
exit 1
if ! grep -qE "^publish[[:space:]]*=[[:space:]]*\[[[:space:]]*\"$REGISTRY\"[[:space:]]*\]" "$CARGO_TOML"; then
err "✗ $CARGO_TOML : publish = [\"$REGISTRY\"] missing in [package] (without it, cargo publish would accept crates.io)"
exit 1
fi
# What cargo would really put in the archive (not a reading of Cargo.toml).
if ! listing=$("$CARGO" package --allow-dirty --list --manifest-path "$CARGO_TOML" 2>&1); then
err "✗ cannot list the files of the package, so its content cannot be checked:"
printf '%s\n' "$listing" >&2
exit 1
fi
internal=$(printf '%s\n' "$listing" | grep -E '^(\.crate-kit/|\.gitea/|api/|Makefile$)' || true)
if [ -n "$internal" ]; then
err "✗ the published archive would contain the kit's internal files:"
printf '%s\n' "$internal" | head -n 5 | sed 's/^/ /' >&2
err " add to [package] of $CARGO_TOML: exclude = [\".crate-kit/\", \".gitea/\", \"api/\", \"Makefile\"]"
exit 1
fi
+2
View File
@@ -17,6 +17,8 @@ if [ "${PUBLISH:-yes}" = no ]; then
fi
[ -n "$REGISTRY" ] || { err "✗ no registry: declare the kit extension (KIT_OVERLAY in the Makefile, org.mk) or set REGISTRY = crates-io"; exit 1; }
# Same safeguards as `make check` (publish = [...] and no internal file in the archive): the CI runs this script.
"$(dirname "$0")/publish-guard.sh"
version=$(current_version)
name=$(crate_name)
if [ -n "${DRY_RUN:-}" ]; then