Skip to main content

CLI tool to statically analyze and visualize Click/Typer command trees.

Project description

CLI Dependency Graph

Statically analyze and visualize the structure of Python CLI apps built with Click or Typer.

Features

  • Detects click.Group, click.command, and Typer apps (Typer()) via static AST parsing (no code execution)
  • CLI commands:
    • scan <path>: Discover command tree
    • show: Print ASCII tree
    • export --format {dot,svg}: Save graph file (planned)
  • Renders CLI structure as ASCII (terminal) or DOT/SVG (export)

Installation

pip install .

Usage

1. Scan a Python CLI app

python -m cli_dependency_graph scan example_click_app.py

2. Show the discovered CLI structure

python -m cli_dependency_graph show

3. (Optional) Export the CLI graph

python -m cli_dependency_graph export --format dot --output cli_graph.dot

Example CLI App

import click

@click.group()
def cli():
    pass

@cli.command()
def hello():
    """Say hello"""
    print("Hello!")

@cli.command()
def goodbye():
    """Say goodbye"""
    print("Goodbye!")

if __name__ == "__main__":
    cli()

Development

  • Source code: src/cli_dependency_graph/
  • Tests: tests/unit/

Run tests

pytest

Requirements


Contributions welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cli_dependency_graph-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cli_dependency_graph-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file cli_dependency_graph-0.1.0.tar.gz.

File metadata

  • Download URL: cli_dependency_graph-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for cli_dependency_graph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 594500ba86e2f59cd3467490a6b0dd4d98ddd6f6855588e4b15aab441e8ae363
MD5 fde0c243427bed1596af8a253203a555
BLAKE2b-256 60b1842064470a9ed3b7a9c8e947e7f5917f87ed17469727e18ea36e2a472a4c

See more details on using hashes here.

File details

Details for the file cli_dependency_graph-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cli_dependency_graph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7588f56b153f8bb54a98419b4aaaf5fee6cf0652f126d33f5b24516358425248
MD5 c1a8912a422dde0ab676a92db31bbee0
BLAKE2b-256 4287c62420e825adc5b9ef9ce6ffd28971c5a8f8e955041243bfa89c12380c02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page