Gate CLI dependencies behind optional cli feature flag#848
Merged
benfred merged 1 commit intobenfred:masterfrom May 4, 2026
Merged
Gate CLI dependencies behind optional cli feature flag#848benfred merged 1 commit intobenfred:masterfrom
cli feature flag#848benfred merged 1 commit intobenfred:masterfrom
Conversation
25bee6e to
cda1d85
Compare
py-spy is used as a library in pyroscope-rs where CLI dependencies (clap, inferno, console, ctrlc, indicatif, env_logger) are unnecessary. This adds a `cli` feature flag (enabled by default) that guards all CLI-only dependencies, allowing library consumers to opt out with `default-features = false`. Changes: - Make clap, clap_complete, console, ctrlc, indicatif, inferno, and env_logger optional dependencies gated by the `cli` feature - Add `[[bin]]` with `required-features = ["cli"]` so the binary is skipped when building without CLI - Gate clap-dependent code in config.rs (ArgEnum derive, from_commandline, from_args, CLI tests) behind cli feature - Add CI step to build library without cli feature - Gate coredump and dump modiles behind cli feature
cda1d85 to
764395f
Compare
benfred
approved these changes
May 4, 2026
Owner
benfred
left a comment
There was a problem hiding this comment.
thanks for the PR!
This does make me wonder if the dump/coredump code should even be exported from src/lib.rs at all - but I think we can leave as is for now
Contributor
Author
|
@benfred Thanks for prompt review 🙏 💘 |
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.
py-spy is used as a library in pyroscope-rs where CLI dependencies
(clap, inferno, console, ctrlc, indicatif, env_logger) are unnecessary.
This adds a
clifeature flag (enabled by default) that guards allCLI-only dependencies, allowing library consumers to opt out with
default-features = false.Changes:
env_logger optional dependencies gated by the
clifeature[[bin]]withrequired-features = ["cli"]so the binary isskipped when building without CLI
from_args, CLI tests) behind cli feature