Skip to main content

CLInspector

PyPI License Package status Monthly downloads Distribution format Wheel availability Python version Implementation Releases Github Contributors Github Discussions 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.0.1

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.0.1
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)

Table of built distributions (wheels) for clinspector 2.0.1
File Interpreter ABI Platform Actions
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 log

Release 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 log

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

Select from 2 files

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