Skip to main content

CLInspector

PyPI License Package status Monthly downloads Distribution format Wheel availability Python version Implementation Releases Github Contributors Github Forks Github Issues Github Issues Github Watchers Github Stars Github Repository size Github last commit Github release date Github language count Github commits this month Package status PyUp

Read the documentation!

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.Typer instances
  • Click: click.Command / click.Group instances
  • Cleo: cleo.application.Application instances
  • Cappa: classes decorated with @cappa.command
  • Cyclopts: cyclopts.App instances
  • argparse: ArgumentParser instances

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, epilog
  • params: list[Param]
  • subcommands: dict[str, CommandInfo] (also reachable via info["name"])
  • deprecated, hidden, callback (the framework callback, not serialized or compared)
  • full_path / full_command: the command path including parents
  • walk(): iterate over the command and all nested subcommands
  • to_dict() / CommandInfo.from_dict(): plain-dict (JSON) round trip
  • build_cli_command(), execute_cli(): run the command as a subprocess

Param (clinspector.Param), among others:

  • name, help, default, opts (e.g. ["-f", "--flag"]), secondary_opts
  • required, is_flag, multiple, nargs, choices, metavar
  • envvar, 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 (markdown extra).
  • 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. Pass handler= (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, tldr extra) and man pages (clinspector.help_providers.man_pages.ManPageProvider, man-pages extra).
  • Help text parser: clinspector.parse_help_text(text) turns raw --help output (argparse, click/typer, rich-click, docopt, cement, cliff, plac, fire layouts) into a CommandInfo. Heuristic: prefer get_cmd_info when you have the CLI object.

Metadata

Release files for clinspector 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clinspector 2.2.0
File Size Uploaded Provenance Actions
clinspector-2.2.0.tar.gz 29.9 kB With provenance Details for clinspector-2.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for clinspector 2.2.0
File Interpreter ABI Platform Actions
clinspector-2.2.0-py3-none-any.whl Python 3 none any Details for clinspector-2.2.0-py3-none-any.whl

Total release size: 68.3 kB

Release files / clinspector-2.2.0.tar.gz

Download URL clinspector-2.2.0.tar.gz
Size 29.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a778666d6ac364d7847cd8001507b9fd1407bf86da5a833a69a66a579614f9ef
BLAKE2b-256 checksum
How to use checksums
0eccc0747eb9452628b152baae62a3731beab99936e01287c9db3290385fcc48
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 26, 2026.

Transparency log

Release files / clinspector-2.2.0-py3-none-any.whl

Download URL clinspector-2.2.0-py3-none-any.whl
Size 38.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aaf2631e5acaf0cc397ff972e3511609398376e8e8b87437f9f5f51327f4d00b
BLAKE2b-256 checksum
How to use checksums
ea5798a3c541fa4c12c397df80951c087d2b033bce944459422d7197a1346aba
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 26, 2026.

Transparency log

Security for clinspector 2.2.0

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.

Select from 2 files

Attestation for clinspector-2.2.0.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 26, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page