Skip to main content

clicommands

Lightweight Python library for managing command-line commands with automatic discovery.

Features

  • Automatic command discovery via commands/ directory or .commands.json
  • Two ways to define commands: function suffixed with _command or Command class
  • Argument parsing API: classify_args, parse_args_from_config
  • Envfile loading: ENVFILE_PATH support for loading .env
  • Built-in commands: version, copy, varenv

Installation

pip install clicommands

Quick Start

  1. Create a cli.py in your package:
import sys
from pathlib import Path
from clicommands.helpers import cli_main

def main(argv=None):
    cli_file_path = Path(__file__)
    result = cli_main(cli_file_path, argv)
    return int(result) if isinstance(result, (int, bool)) else (0 if result else 1)

if __name__ == "__main__":
    sys.exit(main())
  1. Add a commands/ directory with your commands:
# commands/hello.py
def hello_command(args: list[str]) -> bool:
    """Say hello."""
    print("Hello, world!")
    return True
  1. Run: python -m mypackage.cli hello

.commands.json Configuration

{
  "packages": ["other_package"],
  "directories": ["commands"],
  "commands": []
}
  • packages: Packages to import commands from
  • directories: Paths to command directories
  • commands: Additional commands

Documentation

  • docs/purpose.md — Purpose and use cases
  • docs/structure.md — Project organization
  • docs/development.md — Development guidelines
  • docs/AI.md — AI assistant contract

Metadata

Release files for clicommands 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clicommands 0.2.0
File Size Uploaded Provenance
clicommands-0.2.0.tar.gz 14.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for clicommands 0.2.0
File Interpreter ABI Platform
clicommands-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.9 kB

Release files / clicommands-0.2.0.tar.gz

Download URL clicommands-0.2.0.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e00b3866a69ee1b770e48f65c86342c01f9883c41c206a683af11b7af7ebe038
BLAKE2b-256 checksum
How to use checksums
6fe5ed8cb5b6c9e0a6a2a3fefdd25cfbce6c198410fd5b8321519b2c94ccdfcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 27, 2026.

Transparency log

Release files / clicommands-0.2.0-py3-none-any.whl

Download URL clicommands-0.2.0-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a37efffd79911198479b29e65395a82f87b26b962b8da3ec8eb4a139922e4cdc
BLAKE2b-256 checksum
How to use checksums
05b2abff7420d24320ac5c37db87e20293d286b3d1d071eb1c3b9d1999317f2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 27, 2026.

Transparency log

Security for clicommands 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for clicommands-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page