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.1.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.1-py3-none-any.whl (40.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for miyamura80_cli_template-0.1.1.tar.gz
Algorithm Hash digest
SHA256 acc2539a4371e09382edc5d2a5714b61b56430b76e357b2a4e7a07f023217274
MD5 5cdfd65ef72691e91dc53c83100d7e80
BLAKE2b-256 b3bf7f5af7e62f6a98e1c7d0d70edb667c55d961ceda8411aeca880ded643ad5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for miyamura80_cli_template-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 88fcf4a6e1788222baa11c167a889c8ae85d1696d9628b765a8c9b33be3a3b38
MD5 1e2c8b12e7add14a3c0ddd90826dcc94
BLAKE2b-256 2a25a8bc257b9ba3339c68f7abcff9dfff92831c5099d8b358c8c05e615bc4be

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