CLInspector
CLInspector introspects Python CLI applications and returns their command tree
(commands, subcommands, options and arguments) as plain, framework-independent
dataclasses. Use it to generate CLI documentation, build completions or wrappers,
or analyze CLI interfaces without parsing --help output.
Installation
pip install clinspector
Framework support is optional; install the extras for the frameworks you use:
pip install "clinspector[click]" # or: typer, cleo, cappa, cyclopts
pip install "clinspector[all]" # all frameworks and optional features
pip install "clinspector[markdown]" # Markdown rendering (jinja2)
pip install "clinspector[tldr]" # tldr page help provider (also: man-pages)
Quickstart
import click
from clinspector import get_cmd_info
@click.group()
@click.option("-v", "--verbose", is_flag=True, help="Enable verbose output")
def cli(verbose: bool) -> None:
"""Example CLI tool."""
@cli.command()
@click.argument("target")
@click.option("--release", is_flag=True, help="Build in release mode")
def build(target: str, release: bool) -> None:
"""Build the project."""
info = get_cmd_info(cli)
print(info.name, "-", info.description) # cli - Example CLI tool.
for param in info.params:
print(param.opts, param.help) # ['-v', '--verbose'] Enable verbose output, ...
build_info = info["build"] # subcommands via item access
print(build_info.full_command) # cli build
print([p.name for p in build_info.params]) # ['target', 'release', ...]
Supported frameworks
get_cmd_info(instance, command=None) accepts:
- Typer:
typer.Typerinstances - Click:
click.Command/click.Groupinstances - Cleo:
cleo.application.Applicationinstances - Cappa: classes decorated with
@cappa.command - Cyclopts:
cyclopts.Appinstances - argparse:
ArgumentParserinstances
Pass command to get a specific subcommand directly. Nested subcommands use dot
notation ("group.sub"); a leading root command name is ignored ("cli.group.sub").
If no such subcommand exists, the root command is returned. get_cmd_info returns
None for unsupported objects.
Data model
CommandInfo (clinspector.CommandInfo):
name,description,usage,epilogparams: list[Param]subcommands: dict[str, CommandInfo](also reachable viainfo["name"])deprecated,hidden,callback(the framework callback, not serialized or compared)full_path/full_command: the command path including parentswalk(): iterate over the command and all nested subcommandsto_dict()/CommandInfo.from_dict(): plain-dict (JSON) round tripbuild_cli_command(),execute_cli(): run the command as a subprocess
Param (clinspector.Param), among others:
name,help,default,opts(e.g.["-f", "--flag"]),secondary_optsrequired,is_flag,multiple,nargs,choices,metavarenvvar,hidden,param_type_name("option"or"argument")type: normalized type name ("str","int","bool","path","choice", ...)
More features
- Markdown docs:
clinspector.introspect.markdown.get_cmd_markdown(instance, command=None, include_subcommands=False)renders a command as Markdown (markdownextra). - Synthesis: create a CLI from a
CommandInfo, e.g.clinspector.synthesis.synth_click.create_group,synth_typer.create_app,synth_cleo.create_app,synth_argparse.create_parser,synth_cappa.create_class. Passhandler=(handler(command_info, values)) to run code when a command is invoked (all except argparse, which only parses). - Help providers: async lookups of command examples from tldr pages
(
clinspector.help_providers.tldr_pages.TldrProvider,tldrextra) and man pages (clinspector.help_providers.man_pages.ManPageProvider,man-pagesextra). - Help text parser:
clinspector.parse_help_text(text)turns raw--helpoutput (argparse, click/typer, rich-click, docopt, cement, cliff, plac, fire layouts) into aCommandInfo. Heuristic: preferget_cmd_infowhen you have the CLI object.
Metadata
Release files for clinspector 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clinspector-2.0.1.tar.gz | 29.8 kB | With provenance | Details for clinspector-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clinspector-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for clinspector-2.0.1-py3-none-any.whl |
Total release size: 68.3 kB
Release files / clinspector-2.0.1.tar.gz
| Download URL | clinspector-2.0.1.tar.gz |
|---|---|
| Size | 29.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42fdeef78f6418bbdd9e0b0bcac45c7f83b957b62c9c612c267ec28b2ab76c8d
|
|
BLAKE2b-256 checksum How to use checksums |
40df47e16a7a4bf65acd69c443461938fb5d7105de4973713bb99daac2d381c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logRelease files / clinspector-2.0.1-py3-none-any.whl
| Download URL | clinspector-2.0.1-py3-none-any.whl |
|---|---|
| Size | 38.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a84396376e75b0ba977b9955fdb2b465306465419da0f369f99ee32d96192410
|
|
BLAKE2b-256 checksum How to use checksums |
4e7803f3299d9c5d9b84b7c736c980868d6394dbddafe595015b6240452473db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logSecurity for clinspector 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for clinspector-2.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.