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
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 CLI
cli = CLI(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.run()
📋 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})"
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) |
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})"
Manual argument declaration
from cliss import Argument
@cli.command()
def convert(
input: str,
output: str,
format: Argument("--format", "-f", choices=["json", "csv"], default="json")
):
return f"Converted {input} → {output}.{format}"
🎨 CLI Configuration
cli = CLI(
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: GitHub • PyPI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cliss-1.1.2.tar.gz.
File metadata
- Download URL: cliss-1.1.2.tar.gz
- Upload date:
- Size: 9.5 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4340a32804879243b51a31af1fbd694cfb61c61b25ce79af6ec491baa99d7f95
|
|
| MD5 |
7d168fb48f157b4f05479b1c7b9f3372
|
|
| BLAKE2b-256 |
3696b158774c9d893adb1086c3338c861995b5a5f039e061e95cf649b540ca4c
|
File details
Details for the file cliss-1.1.2-py3-none-any.whl.
File metadata
- Download URL: cliss-1.1.2-py3-none-any.whl
- Upload date:
- Size: 11.1 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b931e00d20810aa9c6f76897ca3232f1cebd3c0d0a8e4b4b61897b152b0fce42
|
|
| MD5 |
db07aa69aee179ba6ecbc14c2482f307
|
|
| BLAKE2b-256 |
ed7ba2daeebd609f88c871c7298df10c389376fc8a68adbcba8beb8cff36b53f
|