Title: fix(cli): stop bittensor argparse from hijacking click --help - #853
Merged
anderdc merged 4 commits intoMay 4, 2026
Merged
Conversation
`gitt --help` and `gitt <subcmd> --help` printed bittensor's bt.config argparse output instead of click's command tree, because importing bittensor at module load parses sys.argv and exits on -h/--help before click runs. Bare `gitt` worked. Extend the existing stub gate (PR entrius#704, used for shell completion) to also fire when -h/--help is in argv. Help-only invocations don't need the real bittensor — click resolves help text from decorators without running command bodies.
Ruff flagged the previous form (two assignments + if-block before later imports) with E402 'module level import not at top of file'. Collapsing the gate back to a single conditional preserves the conditional-import idiom that ruff E402 looks past, matching the pre-existing pattern from PR entrius#704.
Collaborator
|
hi I can't see the images you have |
Contributor
Author
|
@anderdc I've fixed the PR description and you can check images here |
anderdc
approved these changes
May 4, 2026
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
gitt --helpand everygitt <subcommand> --helpinvocation printed bittensor'sbt.configargparse output instead of click's command tree. Only baregitt(no args) showed the correct help. New users hitting--helpfirst saw a screen with--logging.debugflags and none of the actual commands —miner,issues,vote,admin,harvest,config,completionwere all invisible.Type of Change
Reproduction (before this PR)
Before

After
