Skip to main content

CliFire Logo CliFire

CI Status Coverage Status PyPI version License

Minimal CLI framework to build Python commands quickly and elegantly.

CliFire is a lightweight Python library designed to simplify the creation of command-line interfaces (CLI). It allows developers to define commands, options, and arguments in a straightforward way, making it easy to build complex CLI applications without the overhead of bigger frameworks.

Key Features

  • Two Usage Styles: Define commands using decorators or classes.
  • Intuitive Syntax: Focus on writing application logic without worrying about CLI infrastructure.
  • Arguments & Options: Flexible parsing with positional arguments and command options.
  • Grouped Commands: Organize related commands using a dot-based naming convention.
  • Formatted Output: Leverage the Rich library for colorful and styled messages.
  • Templates: Generate files using Jinja2 templates.
  • Centralized Configuration: Manage configuration via YAML using the Config module.

Installation

Install CliFire using pip:

pip install clifire

Or with Poetry:

poetry add clifire

Or with uv:

uv add clifire

Or with rye:

rye add clifire

Quick Start

Create a simple CLI command using decorators. For example, save the following as fire/hello.py:

from clifire import command, out

@command.fire
def hello(cmd, user: str = "", _sudo: bool = False):
    """
    Display a greeting on the console.

    Args:
        user: Name of the user to greet. If empty, the current system user is used.
        _sudo: Run the command with sudo privileges.
    """
    if not user:
        sudo = 'sudo' if _sudo else ''
        user = cmd.app.shell(f"{sudo} whoami").stdout
    out.info(f'Hi {user}!')

Then run:

fire hello Rob

In action: Demo

For more details, see our Quick Start Guide.

Documentation

The full documentation is available on GitHub Pages in English and Spanish. It covers topics such as:

For AI agents

This project ships an Agent Skill so coding agents can learn the framework without reading the whole source. The file lives at SKILL.md and is also bundled inside the PyPI package:

fire skill           # print the skill file content
fire skill path      # print the skill file location
fire skill install   # copy it where your agent will find it (Claude Code, Crush, ...)

fire skill install detects the agent hosts present in your home directory and the current project (.claude/skills/, .agents/skills/, ~/.config/crush/skills/, ~/.claude/skills/); use --target all to force all of them. The package is typed (py.typed), so LSPs and IDEs also get completions.

Development

CliFire is an open-source project, and contributions are welcome! If you find a bug, have a feature request, or want to contribute improvements, please open an issue or submit a pull request.

For development, we use uv, a fast Python environment and dependency manager. If you don't have it installed, run:

curl -LsSf https://astral.sh/uv/install.sh | sh

To contribute to CliFire:

  1. Fork the repository on GitHub.

  2. Clone your fork locally:

    git clone https://github.com/<your-username>/clifire.git
    cd clifire
    
  3. Create a new branch for your feature or bug fix:

    git checkout -b feature/my-feature
    
  4. Install development dependencies:

    uv sync
    
  5. Run tests to ensure everything works:

    uv run pytest
    # or to check coverage:
    uv run coverage run -m pytest && uv run coverage html
    

    You can also use the fire coverage command to run the tests and generate the coverage report:

    uv run fire coverage
    
  6. Update the CHANGELOG.md with your changes.

  7. Commit and push your changes, and then create a pull request.

For further contribution details, please see our Contributing Guide.

License

CliFire is released under the MIT License. See the LICENSE file for details.

Metadata

Release files for CliFire 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 CliFire 0.2.0
File Size Uploaded
clifire-0.2.0.tar.gz 1.1 MB Details

Built distribution (wheel)

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

Total release size: 1.1 MB

Release files / clifire-0.2.0.tar.gz

Download URL clifire-0.2.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
2672db9a922d03b8754ade99e84d0aff21e1b5c4a873452dcac6335c4b18f3d7
BLAKE2b-256 checksum
How to use checksums
9e830de6c32de9eee884868d65edae26c9ca5d873bd57da7ee5f7b80c053247b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL clifire-0.2.0-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5192d00d742fd3b83b9f95ddbf365eadad459f6a53fa3263c51d6739f17f78db
BLAKE2b-256 checksum
How to use checksums
20f7984b0704b1c20f220473b73408756ad5cdca429118d90fc1ada468b47f00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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