PY-CLI0001 · argparse_cli_construction
Count CLI parsers that bypass the configured Cyclopts foundation.
This is a deterministic rule for python. Read its implementation.
Definition
Section titled “Definition”Resolve module, direct, and aliased imports of argparse.ArgumentParser. Count each proven
construction. The project preference is to register typed callables with cyclopts.App
instead of maintaining a second command schema in parser-building code.
Evidence
Section titled “Evidence”Each finding identifies the constructor call and records both the observed and preferred CLI
framework. Lexical assignments and parameters that shadow an import suppress the finding. The
value is the number of proven argparse.ArgumentParser constructions.
Exceptions
Section titled “Exceptions”Libraries that extend an external argparse parser, compatibility shims, and generated or vendored code may disable this project preference. Merely importing argparse for a compatible formatter or namespace does not count.
Examples
Section titled “Examples”Bad
`parser = argparse.ArgumentParser()` starts a hand-maintained parser command tree.
Goodapp.command(project.build) exposes the typed callable as the command boundary.
References
Section titled “References”- Cites “Cyclopts documentation”. Open reference
- Cites “The Python Standard Library”, argparse. Open reference