Skip to main content

🪛 CLI tool template (python) with batteries included. Auto-install, updates, linting, dead code analysis, and a whole lot more.

Project description

cli-template

2

Batteries-included Python CLI template. Auto-discovery commands, global flags, output formatting, self-update, and a whole lot more.

Key FeaturesQuick StartCLI UsageAdding CommandsConfigurationCreditsAbout the Core Contributors

Project Version Python Version GitHub repo size GitHub Actions Workflow Status


CLI Demo

Key Features

Opinionated Python CLI template for fast development. The saas branch extends main with web framework, auth, and payments.

Feature main saas
Auto-discovery command system
Interactive fallback prompts
Shell completions
Self-update
Anonymous telemetry with opt-out
UV + Pydantic config
CI/Linters (Ruff, Vulture)
Pre-commit hooks (prek)
LLM (DSPY + LangFuse Observability)
FastAPI + Uvicorn
SQLAlchemy + Alembic
Auth (WorkOS + API keys)
Payments (Stripe)
Ralph Wiggum Agent Loop

Full comparison

Quick Start

make onboard              # interactive setup (rename, deps, env, hooks)
uv sync                   # install deps
uv run mycli --help       # see all commands
uv run mycli greet Alice  # run a command
uv run mycli init my_command  # scaffold a new command

CLI Usage

Global flags go before the subcommand:

Flag Short Description
--verbose -v Increase output verbosity
--quiet -q Suppress non-essential output
--debug Show full tracebacks on error
--format -f Output format: table, json, plain
--dry-run Preview actions without executing
--version -V Print version and exit
uv run mycli --format json config show     # JSON output
uv run mycli --dry-run greet Bob           # preview without executing
uv run mycli --verbose greet Alice         # detailed output

Adding Commands

Drop a Python file in commands/ and it is auto-discovered.

Single command - export a main() function:

# commands/hello.py
from typing import Annotated
import typer

def main(name: Annotated[str, typer.Argument(help="Who to greet.")]) -> None:
    """Say hello."""
    typer.echo(f"Hello, {name}!")
uv run mycli hello World   # Hello, World!

Subcommand group - export app = typer.Typer():

# commands/db.py
import typer

app = typer.Typer()

@app.command()
def migrate() -> None:
    """Run migrations."""
    ...
uv run mycli db migrate

Or scaffold with: uv run mycli init my_command --desc "Does something".

Configuration

from common import global_config

# Access config values from common/global_config.yaml
global_config.example_parent.example_child

# Access secrets from .env
global_config.OPENAI_API_KEY

CLI config inspection:

uv run mycli config show                           # full config
uv run mycli config get llm_config.cache_enabled   # single value
uv run mycli config set logging.verbose false      # write override

Full configuration docs

Credits

This software uses the following tools:

About the Core Contributors

Made with contrib.rocks.

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

miyamura80_cli_template-0.1.0.tar.gz (13.6 MB view details)

Uploaded Source

Built Distribution

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

miyamura80_cli_template-0.1.0-py3-none-any.whl (39.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for miyamura80_cli_template-0.1.0.tar.gz
Algorithm Hash digest
SHA256 424f96b81f9683980321eb919988c84d65ffdf3341dc1c476c68cdd8d7699aa8
MD5 7e62e4f73f23b9f432b2efbaa4a2a7d7
BLAKE2b-256 4b1645f98bf4eb4be5a3293d7e3eca206ff275c3a9b165a228465afd5dfe7422

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for miyamura80_cli_template-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a92ed0a923c0e6eb3f2366c32b4404c84fabef524359457169649ab21197f696
MD5 e5c0d1cfca326debc0de79ec11848470
BLAKE2b-256 5c9c3b7c286e8a5376f6d8461498f43cb800ab3ebdf39d9c8ea36c6de05ebbba

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