Add a beautiful Terminal UI to your Python CLI with just a few decorators. No need to learn a new framework or rewrite your logic.
You've built a Python CLI with Click or argparse. Now you want a nice TUI but:
- Other TUI frameworks require rewriting your entire application
- You don't want to maintain two separate codebases
- You need your CLI to work both in scripts (CLI mode) and interactively (TUI mode)
CHI SDK solves this: Keep your existing CLI, add a few decorators, get a beautiful TUI.
pip install chi-sdkThat's it! TUI included, batteries included.
from chi_sdk import chi_command, build_cli
from pydantic import BaseModel
class GreetingInput(BaseModel):
name: str
class GreetingOutput(BaseModel):
message: str
@chi_command(input_model=GreetingInput, output_model=GreetingOutput)
def greet(inp: GreetingInput) -> GreetingOutput:
return GreetingOutput(message=f"Hello, {inp.name}!")
# Build your CLI with all registered commands
cli = build_cli("your-app")
if __name__ == "__main__":
cli()# Just add 'ui' to your command!
your-app uiThat's it! Every CHI SDK app automatically gets a ui subcommand.
✅ Automatic TUI - Every app gets a ui subcommand, no config needed
✅ Zero Learning Curve - Use your existing Python knowledge
✅ Type Safety - Pydantic models ensure correctness
✅ Dual Mode - Same code works as CLI and TUI
✅ JSON Contract - Stable interface for automation
✅ Progress Tracking - Built-in support for long-running tasks
✅ Fast & Responsive - Native performance (Rust-powered TUI under the hood)
See the example-apps/ directory for complete examples:
# Install example app
pip install -e example-apps/example-app
# Run as CLI
example-app hello --name World
# Run as TUI - just add 'ui'!
example-app ui
# Get JSON output for automation
example-app --json list-itemsWhile your-app ui works out of the box, you can customize the interface:
# Generate TUI configuration templates
chi-admin init . --binary-name=your-app
# This creates:
# .tui/main.yaml - Menu structure and navigation
# .tui/panel_b.yaml - Panel layouts configuration
# .tui/styles.yaml - Colors and visual styling
# .tui/bin/your-app-ui - Standalone launcher (optional)Edit the YAML files to:
- Customize menu items and structure
- Define keyboard shortcuts
- Change colors and styling
- Configure panel layouts
The YAML files include helpful comments explaining each option.
- You write Python CLI commands with Pydantic models for input/output
- CHI SDK generates a JSON schema describing your commands
- The TUI reads this schema and creates a beautiful interface
- User interactions in TUI call your CLI commands behind the scenes
- Your CLI returns JSON which the TUI displays nicely
Your Python code remains the single source of truth. The TUI is just a presentation layer.
- Examples - Complete working examples
- Release Notes - Version history and updates
# Setup development environment
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
pip install -e python-chi-sdk
# Run tests
pytest python-chi-sdk/tests
# Run linting
ruff check .
black .- Python SDK: Apache 2.0 - Use freely in commercial projects
- TUI Binary: AGPL 3.0 - Keep open source or contact us for commercial license
See LICENSE for details.
We welcome contributions! See CONTRIBUTING.md for guidelines.