Skip to main content

A Python package for building rich, interactive CLI applications

Project description

clitic

Documentation PyPI version PyPI pyversions Build Status Coverage Status License: MIT Code style: ruff Type checked: mypy

A Python package for building rich, interactive CLI applications.

Why "clitic"?

The name is a playful linguistic reference. A clitic (/ˈklɪtɪk/) is an unstressed word that normally occurs only in combination with another word — like the 'm in "I'm".

The name fits perfectly because:

  • It starts with "CLI" — Command Line Interface
  • Like its linguistic namesake, clitic is designed to exist in combination with another project — yours! It's a framework meant to be the foundation for your rich interactive CLI applications.

Overview

clitic provides reusable components for building terminal user interfaces (TUIs) with:

  • Multiline input with syntax highlighting and history
  • Scrollable content areas with pluggable renderers
  • Markdown, diff, and terminal content rendering
  • CSS-like styling and theming
  • Responsive layouts

Built on Textual for the TUI framework, with Rich for rendering.

Installation

pip install clitic

Quick Start

Run the interactive showcase to see clitic in action:

python -m clitic

Or build your own TUI application:

from textual.app import ComposeResult
from clitic import App, Conversation, InputBar

class MyApp(App):
    def compose(self) -> ComposeResult:
        yield Conversation(id="messages")
        yield InputBar(placeholder="Type your message...")

    def on_mount(self) -> None:
        conversation = self.query_one(Conversation)
        conversation.append("system", "Welcome!")

    def on_input_bar_submit(self, event: InputBar.Submit) -> None:
        conversation = self.query_one(Conversation)
        conversation.append("user", event.text)

MyApp().run()

See the documentation for complete API reference.

Features

  • InputBar: Multiline input with auto-grow, cursor movement, selection, and submit-on-Enter
  • Conversation: Scrollable content container with virtual rendering for 100,000+ lines
  • Session persistence: Resume conversations with block pruning for memory efficiency
  • Theming: Dark and light themes with CSS-like styling

Roadmap

  • Tree/Table: Collapsible tree and table widgets
  • Plugins: Markdown, diff, and terminal content renderers
  • Responsive layouts: Adaptive layouts based on terminal width

Development

Requirements

  • pyenv with pyenv-virtualenv plugin
  • Python 3.11+

Setup

# Create and activate virtual environment
make setup
pyenv activate clitic

# Or for automatic activation:
echo 'clitic' > .python-version

# Install dependencies
make install

Development Commands

Command Description
make test Run tests with coverage
make showcase Run feature showcase application
make typecheck Run mypy type checking
make lint Run ruff linting
make format Format code with ruff
make check Run all checks

Showcase

Current Showcase

The package includes an executable showcase that demonstrates all implemented features:

python -m clitic
# or
make showcase

The showcase is updated as features are implemented, providing a live demonstration of the framework's capabilities.

Building & Publishing

make build        # Build package
make publish      # Publish to PyPI
make publish-test # Publish to TestPyPI

Cleanup

make clean      # Remove build artifacts
make clean-all  # Remove build artifacts and virtualenv

Run make help for all available targets.

Changelog

See CHANGELOG for version history.

License

MIT License

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

clitic-0.1.0.tar.gz (57.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clitic-0.1.0-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

Details for the file clitic-0.1.0.tar.gz.

File metadata

  • Download URL: clitic-0.1.0.tar.gz
  • Upload date:
  • Size: 57.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for clitic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 18a49287147e0d770c139793565be9b67356b499e4b06142ddeacf80b713a79c
MD5 ba734376a9005e4d7daf6951d2964c7a
BLAKE2b-256 2ff4b5ffd9540f8cc09d04e61230fada5b383646711f2b250516162aa2d6291d

See more details on using hashes here.

File details

Details for the file clitic-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: clitic-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for clitic-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e361e04cd847bb10ccd20e2ded853e864c2c8282717af7d0c8bf4a190ccbf54
MD5 ead06c084be259a35dd6812e0d679dcf
BLAKE2b-256 03034d61006810b465c1324ed0691947b474b15db278ed4210a8260213392671

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