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()

📋 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.4.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.4-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cliss-1.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 e3368b716bc9a6cf0c01f248dfbc2861790903373c3c8f449c73a4127508b3d4
MD5 4c0d975009518cef8106226a66e2cf9a
BLAKE2b-256 a6a251260dd14dd6949caed8ca49fd423f9819185c282194a642e9512611ea6c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cliss-1.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bd4c55f1ee888e67fa6d3c5ed6e9b29cb050d0c7471e37d6c89f19d865f4a5c1
MD5 2af1d2a519c6dc4a2d7b9adb7845b93c
BLAKE2b-256 4db5b4d1866009257e50603c9171364bbd4d3f91cc4257ac99c673de76efc598

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