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 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: 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.3.tar.gz (9.6 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.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cliss-1.1.3.tar.gz
  • Upload date:
  • Size: 9.6 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 cliss-1.1.3.tar.gz
Algorithm Hash digest
SHA256 cde55c72b74e8bb1dac4aade40fb61be049c16db72ae1b1e44c546bd20a75bed
MD5 6e3f32b2e7e16ddcf4a19d885a186258
BLAKE2b-256 83f758d20b14b35b0f8e6f7b58089819662b7285e015b4666c78b61d1256eef2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cliss-1.1.3-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

Hashes for cliss-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6872b111e7fdb2e339b68dcd64c72517c8c8f682775363fbd6b935e33620e117
MD5 f5e9e89f57e615db1fc1581c79efdcbb
BLAKE2b-256 026fa20fe75ad7e0c7c8c8ae604dffcae1ed70f141512bc3df59a3b746cce8ba

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