The argparse flag set is not complete for a command built with typer - #26
Merged
Merged
Conversation
This file's docstring promises the one thing that just happened cannot happen:
when it says no, a flag it has not seen is unjudged, and the reason given is the
incompleteness itself
It said yes, from the wrong parsers. `unslothai/unsloth` declares
`unsloth = unsloth_cli:app`, a typer application, and its README shows
`unsloth start claude --as-subagent`. That option is declared at
`unsloth_cli/commands/start.py:340` as `typer.Option(False, "--as-subagent", ...)`.
docproof reported it BROKEN with "no parser in this project defines it", because the
backend, tests and scripts elsewhere in the monorepo contain enough argparse for 153
flags and a complete verdict.
The datasette rule above catches a project with NO argparse. It cannot catch a monorepo
that has plenty, none of it behind the command being documented. So completeness is now
asked of the COMMAND rather than of the repository: the console script names its module,
and if that package imports typer, click, cleo, docopt or fire, the argparse set cannot
describe it.
Reads the package's own files only. A framework imported by a sibling tool in the same
repository says nothing about this command, and widening it to the whole tree would
silence the verifier on every repository that vendors an example.
docproof itself stays complete at 6 flags. rigout stays incomplete for the reason it
already was, a parser handed to helpers.
201 tests.
…osts Measured over 44 clones that declare a console script: 12 newly abstain, and SEVEN of those were already incomplete under the datasette rule with zero argparse found, so the new reason only makes theirs specific. Five genuinely change: openmed, opensre, nanobot, unsloth, mitmproxy. In those five the "complete" verdict was false, so this is not a recall cost. HKUDS/nanobot alone produced 93 findings, 90 of them cli-flag, and its console script is `nanobot.cli.entry:main` with every option declared as `typer.Option`. Spot-checked two: `--refresh` and `--wizard`, both at `nanobot/cli/commands.py:119-120`, both reported BROKEN. With the fix nanobot goes from 93 findings to ZERO. 93 of the 455 findings on disk across every corpus were this one defect. Two tests, one per direction: a typer console script beside plenty of argparse abstains, and an argparse console script keeps judging. 203 tests.
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.
parsers.pypromises this in its own docstring:It said yes, from the wrong parsers.
The case
unslothai/unslothdeclaresunsloth = unsloth_cli:app, a typer application. Its README shows:--as-subagentis declared atunsloth_cli/commands/start.py:340:docproof reported it BROKEN, with "no parser in this project defines it" and a list of 153 flags. Those came from the backend, the tests and the scripts elsewhere in the monorepo.
seen_a_parseris repository-wide, and a monorepo is not one program.The datasette rule above already catches a project with no argparse. It cannot catch one that has plenty, none of it behind the command being documented.
What changed
Completeness is asked of the command, not the repository. The console script names its module; if that package imports typer, click, cleo, docopt or fire, the argparse set cannot describe it. The package's own files only, because a framework imported by a sibling tool says nothing about this command.
Measured, over 44 clones that declare a console script
In all five the complete verdict was false, so this is not a recall cost.
HKUDS/nanobotis the size of it. 93 findings, 90 of them cli-flag, console scriptnanobot.cli.entry:main, every option atyper.Option. Two spot-checked:--refreshand--wizard, both declared atnanobot/cli/commands.py:119-120, both reported BROKEN. With this change nanobot goes from 93 findings to zero.93 of the 455 findings on disk across every sweep corpus were this one defect.
docproof itself stays complete at 6 flags. rigout stays incomplete for the reason it already was, a parser handed to helpers.
Two tests, one per direction. 203 tests.