Skip to content

Make CLI/logging dependencies optional behind a cli feature#2

Open
cjfields wants to merge 1 commit into
COMBINE-lab:mainfrom
HPCBio:feat/gate-cli-deps
Open

Make CLI/logging dependencies optional behind a cli feature#2
cjfields wants to merge 1 commit into
COMBINE-lab:mainfrom
HPCBio:feat/gate-cli-deps

Conversation

@cjfields

Copy link
Copy Markdown
Contributor

Summary

clap, tracing, and tracing-subscriber are used only by the align_benchmark binary (everything under src/bin/), but they were declared as non-optional [dependencies]. As a result every library consumer of wfa2lib-rs inherits the full CLI + logging dependency tree even though none of the library modules reference those crates.

This PR makes the four binary-only crates optional and gates them behind features:

  • cli → enables clap + tracing + tracing-subscriber
  • mimalloc-alloc → enables mimalloc (now via dep: syntax)

Both remain in default, so cargo build / cargo run still produce the benchmark binary exactly as before. The binary declares required-features = ["cli"], so library-only builds (--no-default-features) cleanly skip it.

Why

Library consumers (e.g. embedding the WFA aligner in another tool) can now depend with default-features = false and get a minimal dependency graph.

Verification

  • cargo build (default) — still builds align_benchmark.
  • cargo build --no-default-features — builds the library only.
  • cargo tree --no-default-features -e normal — no longer lists clap, tracing, or mimalloc.

Notes

No library source changes — this is a manifest-only change (confirmed clap/tracing have zero references outside src/bin/).

clap, tracing, and tracing-subscriber are used only by the align_benchmark
binary (src/bin/), but were non-optional dependencies, so every library
consumer inherited the full CLI/logging dependency tree.

Make all four binary-only crates optional and gate them behind features:
- `cli` enables clap + tracing + tracing-subscriber
- `mimalloc-alloc` enables mimalloc (now via `dep:` syntax)

Both are kept in `default` so `cargo build`/`cargo run` still produce the
benchmark binary unchanged, and the binary declares `required-features =
["cli"]` so library-only builds (`--no-default-features`) skip it.

Library consumers can now depend with `default-features = false` to get a
clean dependency graph (verified: `cargo tree --no-default-features` no
longer lists clap/tracing/mimalloc).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant