Skip to main content

Write type-annotated Python functions, get a full CLI — automatic `--help`, validation, async support, and zero dependencies

Project description

cliss — Lightweight framework for building CLI applications

Python PyPI License Platform Ruff

Write type-annotated Python functions, get a full CLI — automatic --help, validation, async support, and zero dependencies.

🚀 Quick Start

pip install cliss                    # Python 3.10+
from cliss import Cliss

cli = Cliss(name="todo", description="Task manager", version="1.0.0")

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

@cli.command()
def list_all():
    """Show all tasks."""
    return "Nothing yet!"

cli()
$ python todo.py add "Buy milk" --priority 2
[] Buy milk (priority: 2)

$ python todo.py list-all
Nothing yet!

$ python todo.py --help
Usage: todo [COMMAND] [OPTIONS] [ARGS]...

Task manager

Commands:
  add           Add a task.
  list-all      Show all tasks.

Options:
  -V, --version Print version info and exit
  -h, --help    Print help

📋 Commands & Features

@cli.command() — Define commands from functions

@cli.command()
def fetch(url: str, retries: int = 3):
    """Download from URL with retries"""
    return 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.

@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"""
    return f"Fetched {url} (retries: {retries})"

Type → CLI mapping

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

Boolean flag behavior

Function signature Help display Usage
flag: bool --flag, --no-flag (required) --flag or --no-flag
flag: bool = False --flag (default: disabled) --flag enables, --no-flag also works
flag: bool = True --no-flag (default: enabled) --no-flag disables, --flag also works

Command groups

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

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

Async support

@cli.command()
async def fetch(url: str, retries: int = 3):
    return f"Fetched {url} (retries: {retries})"

🎨 CLI Configuration

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

Disable colours via environment

NO_COLOR=1 python myapp.py --help

📄 License & Acknowledgments

MIT License — Built with pure Python standard library:

Module Purpose
sys Argument parsing
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

cliss-1.1.8.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

cliss-1.1.8-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file cliss-1.1.8.tar.gz.

File metadata

  • Download URL: cliss-1.1.8.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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 cliss-1.1.8.tar.gz
Algorithm Hash digest
SHA256 ac8c58ea46fa8d7b8c6b9752ebfe73015ce84c838a1c56c53ca54af9a70c7b34
MD5 dbbe6d4bd3a220929c7b9bb39f0e0a6d
BLAKE2b-256 354e0de02487090cbb019a9efc1f33571ee2cf578ca6a6f181ed7c6a702c6477

See more details on using hashes here.

File details

Details for the file cliss-1.1.8-py3-none-any.whl.

File metadata

  • Download URL: cliss-1.1.8-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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 cliss-1.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 29f246c39daa8a33e0d4388748293e92dd45724ec25d99bd8815c71597f7adf5
MD5 2d104ba64574ca9a7a35ef9742ea5066
BLAKE2b-256 c4d2eae3ecf8c193d36fbd5d9cbe718b6e4696289abb923eef1e8098f1cc0450

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