Make CLI/logging dependencies optional behind a cli feature#2
Open
cjfields wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
clap,tracing, andtracing-subscriberare used only by thealign_benchmarkbinary (everything undersrc/bin/), but they were declared as non-optional[dependencies]. As a result every library consumer ofwfa2lib-rsinherits 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→ enablesclap+tracing+tracing-subscribermimalloc-alloc→ enablesmimalloc(now viadep:syntax)Both remain in
default, socargo build/cargo runstill produce the benchmark binary exactly as before. The binary declaresrequired-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 = falseand get a minimal dependency graph.Verification
cargo build(default) — still buildsalign_benchmark.cargo build --no-default-features— builds the library only.cargo tree --no-default-features -e normal— no longer listsclap,tracing, ormimalloc.Notes
No library source changes — this is a manifest-only change (confirmed
clap/tracinghave zero references outsidesrc/bin/).