Skip to main content

Write type-annotated Python functions, get a CLI with argparse's native `--help` — no magic, no bloat

Project description

arg-kiss — Keep It Stupidly Simple CLI builder on top of argparse

Python PyPI License Platform Ruff

Write type-annotated Python functions, get a CLI with argparse's native --help — no magic, no bloat.

🚀 Quick Start

pip install arg-kiss                    # Python 3.10+
from arg_kiss import CLI

cli = CLI(name="todo", description="Task manager", color=True)

@cli.command()
def add(task: str, priority: int = 1, done: bool = False):
    """Add a task."""
    status = "✓" if done else "○"
    print(f"[{status}] {task} (priority: {priority})")

cli()

📋 Commands & Features

@cli.command() — Define commands from functions

@cli.command()
def fetch(url: str, retries: int = 3):
    """Download from URL with retries"""
    print(f"Fetched {url} (retries: {retries})")

@cli.argument() — Customize argument flags

Use @cli.argument() above @cli.command() to customize flags, help text, and behavior for individual parameters without needing the Argument class.

@cli.argument("-v", "--verbose", help="Enable verbose output")
@cli.argument("-r", "--retries", type=int, help="Number of retries")
@cli.command()
def fetch(url: str, verbose: bool = False, retries: int = 3):
    """Download from URL"""
    print(f"Fetched {url} (retries: {retries})")

Type → CLI mapping

Function signature CLI argument
name: str Positional name
count: int = 1 --count 1
verbose: bool = False --verbose / --no-verbose
mode: str | None = None --mode MODE

Command groups

remote = cli.group("remote", "Manage remotes")

@remote.command()
def add(name: str, url: str):
    print(f"Added remote {name} -> {url}")

Global arguments (apply to all commands)

cli.add_global_argument("--verbose", "-v", action="store_true", help="Verbose output")
cli.add_global_argument("--config", "-c", type=str, help="Config file path")

@cli.command()
def deploy(environment: str):
    """Deploy to environment."""
    # Global arguments available in parsed namespace
    pass

Async support

@cli.command()
async def fetch(url: str, retries: int = 3):
    async with httpx.AsyncClient() as client:
        r = await client.get(url)
        print(f"Status: {r.status_code}")

🎨 CLI Configuration

cli = CLI(
    name="myapp",                      # Program name (default: None)
    description="Does amazing things", # Description in help (default: None)
    version="2.0.0",                   # Adds --version flag (default: None)
    color=False,                       # Disable ANSI colours (default: True)
)
Option Description
name Program name in help (default: None)
description Description in help (default: None)
version Adds --version flag (default: None)
color Enable/disable coloured output (default: True)

Disable colours via environment

NO_COLOR=1 python myapp.py --help

📄 License & Acknowledgments

MIT License — Built with Python standard library:

Module Purpose
argparse CLI parsing engine
asyncio Async command execution
inspect Signature introspection

Author: Fkernel653 Project: GitHubPyPI

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

arg_kiss-0.2.8.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

arg_kiss-0.2.8-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file arg_kiss-0.2.8.tar.gz.

File metadata

  • Download URL: arg_kiss-0.2.8.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for arg_kiss-0.2.8.tar.gz
Algorithm Hash digest
SHA256 a6821fd2de9ed6bf6a34994b51cef3eadbaad99e311e970ced4f09f3c044d352
MD5 e16b43dfe6aeb4478c0b59d6d2dc5d24
BLAKE2b-256 2f3f557cb09889e0bfafab666d67b8880728c8ef9eae23bb0ea2961568373480

See more details on using hashes here.

File details

Details for the file arg_kiss-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: arg_kiss-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for arg_kiss-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 76f3d4959da9aedc3400737969313e47b1eb5209dead1d3ff38cb511155327c4
MD5 f910e5dc012432824c2a80fe2608a867
BLAKE2b-256 98b430cf779f7bdedec3c14dc655151b2c1afe5e37f8d4ab61e46c687c780ec6

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