CASCA

A declarative, zero-dependency framework to build terminal in Python.

pip install casca
Python 3.10+ Zero Dependencies Type Hinted 75%+ Coverage
app.py
from casca import App, Container, Label

class TerminalSystem(App):
    css = "#root { border: solid; padding: 1; }"

    def build_ui(self):
        return Container(
            Label("✓ SYSTEM INITIALIZED"),
            Label("✓ WELCOME TO CASCA"),
            id="root"
        )

if __name__ == "__main__":
    TerminalSystem().run()

QUICK START

Get running in under 60 seconds.

1

Install Package

Grab the latest version from PyPI. Zero external dependencies required.

pip install casca
2

Write Your App

Create a file named main.py and add a basic layout with logging.

from casca import App, Label, setup_logging
import logging

setup_logging(level=logging.DEBUG)

class HelloWorld(App):
    def build_ui(self):
        return Label("Hello, Terminal World!")

HelloWorld().run()
3

Run

Execute your file. Press q to exit, F2 for studio mode, F12 for screenshots.

python main.py

ARCHITECTURE SPECS

Why build with Casca?

Zero Dependencies

Runs entirely on the Python Standard Library. No external heavy packages required, guaranteeing maximum portability and fast startup.

Full Type Hints

100% type coverage on core modules with strict mypy configuration. Catch errors before runtime with complete IDE support.

DOM & CSS Engine

Construct UIs using a familiar hierarchical Widget Tree combined with an integrated CSS-like styling parser with cascade and specificity.

Flexbox Layouts

Align, justify, and distribute space perfectly within the terminal using row and column flex algorithms with percentage sizing.

Redux-like Store

Manage application scale flawlessly with an optional built-in centralized state store, combine_reducers, and predictable unidirectional flow.

Comprehensive Logging

Built-in logging configuration with levels, file output, and structured messages. Replace print() statements with proper logging.

Rich Widget Library

20+ widgets out-of-the-box: Container, Label, Button, Input, Select, DataGrid, TreeView, Tabs, Slider, Menu, and more.

Virtual Scrolling

Render 10,000+ items with O(1) performance using VirtualScrollView. Perfect for large datasets and logs.

Grid Layout

CSS Grid-like 2D layout system with column/row definitions, spanning, and gaps for complex interface designs.

Image Rendering

Render real image files inside TUIs using multiple modes: truecolor blocks, braille dots, grayscale ASCII, and color ASCII.

Studio Mode

Press F2 to toggle live inspection overlay showing focus path, computed styles, and box model visualization.

Screenshot Export

Capture any live frame with F12 and export terminal-accurate screenshots as SVG, ANSI, or TXT for documentation.

Hot Reloading

Enable automatic UI refresh when CSS files change during development. Watchdog optional - falls back to polling.

Plugin Architecture

Extend with community widgets via entry points. Register custom widgets with API version compatibility checking.

Accessibility

Focus management, keyboard navigation, screen reader announcements, and high contrast mode support built-in.

CODE QUALITY

450+
Tests
75%
Coverage
100%
Type Hinted
0
Core Dependencies