Skip to content

PY-CLI0001 · argparse_cli_construction

Count CLI parsers that bypass the configured Cyclopts foundation.

This is a deterministic rule for python. Read its implementation.

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.

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.

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.

Bad

`parser = argparse.ArgumentParser()` starts a hand-maintained parser command tree.
Good

app.command(project.build) exposes the typed callable as the command boundary.