Skip to main content

☕ Espresso

A lightweight, declarative Elm Architecture (TEA) terminal UI framework for Python. Inspired by Charm's Bubble Tea, Lip Gloss, and Bubbles.

Python 3.10+ License: MIT Zero Dependencies Architecture: TEA

       (  )   (   )  )
        ) (   )  (  (
        ( )  (    ) )
        _____________
       <_____________> ___
       |             |/ _ \
       |  ESPRESSO   | | | |
       |   CREMA     |_| |_|
       |___BEANS_____|\___/
       \_____________/

Espresso Steaming Coffee Cup (.3a Animation)


🌟 Why Espresso?

Terminal applications in Python have historically required heavy object-oriented widget hierarchies, complex retained-state DOM trees, or callback-laden curses wrappers.

Espresso brings The Elm Architecture (TEA) to Python:

  1. Purity & Determinism: Your application state is a simple Model. Changes only happen through an update(msg) function.
  2. View is Pure: Rendering is a simple view() -> str function that turns state into a styled ANSI string.
  3. No Race Conditions: Background operations (network, timers, disk I/O) are isolated in Cmd (commands) that emit messages back into the event loop.
  4. Zero Dependencies: Runs out of the box using Python's standard library (asyncio, termios, tty, unicodedata).
  5. Modern Python 3.10+ Ergonomics: Native support for structural pattern matching (match / case).

☕ The Espresso Ecosystem

Layer Charm Equivalent Description
espresso bubbletea The Strong Base: Core TEA framework, runtime event loop, raw terminal driver, command primitives, line-diffing alt-screen renderer, SGR mouse tracking, and gesture engine.
espresso.crema lipgloss The Smooth Crema: Declarative styling, box model, TrueColor (24-bit RGB), ANSI 256, borders, border titles, TrueColor linear gradients, ANSI word-wrapping, 2D layout alignment, FlexBox, responsive Grid, and multi-terminal emoji width modes.
espresso.beans bubbles The Flavorful Beans: 50 reusable UI components including Plot, MenuBar, MultiSplitter, Wizard, CardList, MeshViewer, ImageViewer, ArtPlayer, VirtualList, Accordion, ScrollView, TextArea, GitTree, CommandPalette, BarChart, Splitter, Sliders, Form, DiffViewer, SortableList, Confetti, CodeViewer, MarkdownViewer, Tables, Viewports, and more.
espresso.i18n N/A The Global Blend: Lightweight JSON translation catalogs, CLDR pluralization, runtime language switching, mnemonic hotkey parsing, and CLI translation extraction tool.
espresso.utils N/A Developer Utilities: Unicode cluster & emoji width calculators (split_graphemes, grapheme_count), 2D geometry hit-testing (HitMap, Rect), human-readable data formatters (format_bytes, format_duration, format_relative_time, format_rate), WCAG 2.1 color contrast checkers, and clipboard integration.

🚀 Quickstart

Installation

Via PyPI:

pip install espressoTUI

Universal Standalone Executable (Zero Installation): Download the standalone espresso.pyz from GitHub Releases:

curl -LO https://github.com/kimusan/espresso/releases/latest/download/espresso.pyz
chmod +x espresso.pyz
./espresso.pyz gallery

Native Binaries (No Python Runtime Required): Pre-compiled self-contained native binaries are available on every release for:

  • Linux x86_64: espresso-linux-x86_64
  • macOS Apple Silicon: espresso-macos-arm64
  • macOS Intel: espresso-macos-x86_64
  • Windows x86_64: espresso-windows-x86_64.exe

1. Minimal Interactive Counter

from espresso import Model, Msg, Cmd, KeyMsg, Program, quit_app

class Counter(Model):
    def __init__(self):
        self.count = 0

    def init(self) -> Cmd | None:
        return None

    def update(self, msg: Msg) -> tuple[Model, Cmd | None]:
        match msg:
            case KeyMsg(key="+" | "up"):
                self.count += 1
            case KeyMsg(key="-" | "down"):
                self.count -= 1
            case KeyMsg(key="q" | "esc"):
                return self, quit_app
        return self, None

    def view(self) -> str:
        return f"Count: {self.count}\n\n[+/-] Adjust  [q] Quit"

if __name__ == "__main__":
    Program(Counter()).run()

🎨 Crema: Declarative Terminal Styling

Crema brings CSS-like fluency and box-model precision to terminal strings:

from espresso.crema import Style, ROUNDED_BORDER, Align

card = (
    Style()
    .bold(True)
    .foreground("#FAFAFA")
    .background("#7D56F4")
    .border(ROUNDED_BORDER)
    .border_foreground("#00E676")
    .border_title(" [ Espresso Crema ] ", align=Align.LEFT)
    .padding(1, 2)
    .width(40)
    .align(Align.CENTER)
    .render("Hello from Espresso Crema!")
)
print(card)

Word-Wrapping & Linear Gradients

Crema includes advanced ANSI-aware text processing:

from espresso.crema import wrap_ansi, linear_gradient

# Wrap text with full style preservation across soft line breaks
wrapped = wrap_ansi(long_styled_text, width=60)

# Smooth TrueColor linear RGB gradients across string characters
banner = linear_gradient("Espresso TrueColor Gradient", "#FF5E3A", "#FF2A68")

Crema TrueColor Gradients and Box Model

Layout Primitives, Responsive Grid & Overlays

Stack and stitch styled blocks side-by-side, vertically, in a proportional flex layout, or in a responsive multi-column grid:

from espresso.crema import join_horizontal, join_vertical, place_overlay, Grid, FlexBox, Align

# 1. 2D Side-by-side join
split_view = join_horizontal(Align.TOP, left_sidebar, "  ", right_content)

# 2. Multi-column grid & auto-fitting panels
grid_view = Grid.columns([card1, card2, card3], cols=3, gap=1, total_width=80)
card_panel = Grid.panel("System Metrics", metrics_text, width=32, height=12)

# 3. Responsive proportional layout (FlexBox)
flex = FlexBox(width=80, height=24)
row = flex.new_row(ratio_y=1)
row.new_cell("Sidebar", ratio_x=1, min_width=20)
row.new_cell("Main View", ratio_x=3)

# 4. Floating modal compositor with backdrop dimming
screen = place_overlay(background_view, dialog.view(), center=True, dim_backdrop=True)

🖱️ First-Class Mouse & Gesture Support

Espresso provides built-in mouse tracking (SGR 1006) with advanced gesture synthesis:

  • Program Toggle: Program(App(), mouse=True) or Program(App()).with_mouse(True)
  • Dynamic TEA Commands: Emit enable_mouse or disable_mouse commands directly from update()
  • Event Handling: Pattern match MouseMsg(action, button, x, y) in update()
  • Gestures Supported: MouseAction.PRESS, RELEASE, MOTION, DOUBLE_CLICK, and drag-and-drop tracking with MouseGestureTracker

🧩 Beans: Standard Component Library

Espresso includes 49 ready-to-use building blocks that follow the exact same TEA model:

ArtPlayer BBS ANSImation

  • MenuBar & DropdownMenu: Desktop top application menu bar with cascading dropdown menus, hotkey accelerators, mnemonic Alt+<key> access, mouse hover/click selection, and non-destructive overlay compositing.
  • MultiSplitter: 3+ pane resizable layout with independent draggable dividers, min size clamping, proportional terminal scaling, and ratio equalization.
  • Wizard: Multi-step guided sequential workflow with progress breadcrumbs, validation callbacks, back-navigation state preservation, and bottom button bar.
  • CardList: High-density 2-line information cards with glyphs, tree nesting depth branches (╰─ ), right-aligned badges, click/drag selection, and smooth scrolling.
  • MeshViewer: Pure Python software 3D rasterizer for OBJ, STL, PLY, and GLB models with Lambert and Gouraud shading, camera orbit, procedural primitives (cube, sphere, torus, cylinder, pyramid), 24-bit half-blocks, and ultra-HD Braille canvas.
  • ImageViewer: Terminal graphics viewer supporting native hardware protocols (DEC Sixel, Kitty Graphics Protocol) with automatic capability detection, intelligent tmux multiplexer protection, native deselect options, and versatile cell fallbacks (24-bit half-blocks ▀, Braille 2x4 dot matrix, and ASCII density ramps).
  • ArtPlayer: Terminal art and animation player supporting modern .3a Animated ASCII Art and classic BBS .ans formats with frame playback controls, border framing, and lifecycle events (AnimationDoneMsg, AnimationLoopMsg).
  • VirtualList: High-performance virtualized list feed with variable-height items, reading anchor preservation, and lazy viewport slicing.
  • Accordion: Collapsible multi-panel container wrapping child beans with single-expand or multi-expand modes, Tab child focus cycling, and badges.
  • ScrollView: Scrollable container bean wrapping any child Model or text with interactive scrolling, vertical scrollbar rendering, and coordinate translation.
  • TextArea: Multi-line interactive text editor with line numbers, cursor navigation, and viewport scrolling.
  • Help: Adaptive hotkey documentation rendering compact single-line or multi-column full keybinding views.
  • Timer: High-precision countdown timer driven by tea tick commands with formatted duration and percentage completion.
  • Stopwatch: High-precision elapsed time tracker with split-second hundredths display and toggle/reset controls.
  • Spinner: Animated loading indicators (DOTS, LINE, PULSE, COFFEE, GLOBE, MOON).
  • TextInput: Single-line text input with blinking cursor, password masking, and navigation.
  • Progress: Customizable gradient progress bars with percentage indicators.
  • Table: Column-based tabular data viewer with navigable row selection and sticky headers.
  • Viewport: Scrollable pane for viewing long-form text or logs.
  • Paginator: Pagination manager with bullet dots, numeric counters, descriptive ranges, and zero-jitter bounds slicing.
  • Dialog: Modal confirmation and decision box with custom action buttons and place_overlay backdrop dimming.
  • List: Searchable, filterable list with real-time / search query input, pagination, and selection events.
  • FilePicker: Interactive directory browser with file size formatting, extension filters, and hidden file toggle.
  • Prompt: CLI prompts (SelectPrompt, MultiSelectPrompt checkboxes, and ConfirmPrompt [y/N]).
  • ToastManager: Transient notification alerts (INFO, SUCCESS, WARNING, ERROR) with auto-dismiss timers.
  • Tabs: Top tab bar navigation with customizable styles (PILL, LINE, BRACKET) and hotkeys 1-9.
  • Tree: Hierarchical collapsible tree view with Unicode branch connectors (├──, └──).
  • StatusBar: Multi-section responsive status bar with Left/Center/Right clusters and priority-based auto-truncation.
  • Metric & MetricGroup: Dashboard KPI stat cards, tags, and summary lists with delta trend arrows and inverted metrics.
  • NavStack: Hierarchical view router with push/pop management, breadcrumb trails, and automatic message forwarding.
  • DatePicker: Interactive calendar date picker with month/year navigation, mouse selection, and date range clamping.
  • PipelineProgress: Multi-stage CI/CD workflow pipeline visualizer with real-time spinners, checkmarks, and timestamps.
  • MarkdownViewer: Streaming GitHub-flavored markdown viewer with code blocks, tables, lists, and mouse scrolling.
  • CodeViewer: Syntax-highlighted source code editor viewer (Python, JS, Go, Rust, SQL, JSON) with line numbers and themes.
  • QuickFix: Interactive diagnostics and code action list with severity badges (ERROR, WARNING, INFO).
  • DetailSelector: Master-detail dual-pane list selector with real-time preview panels and category filtering.
  • Splitter: Interactive dual-pane container (Horizontal / Vertical) with draggable divider bar and keyboard resizing.
  • Slider & RangeSlider: Tactile numeric sliders and dual-thumb range bars with mouse dragging.
  • Sparkline: High-resolution 2D Unicode Braille curves and 1D block charts with trend indicators.
  • Marquee: Animated horizontal scrolling text banner with loop and bounce physics.
  • SortableList: Reorderable list with drag-and-drop mouse handling and visual drop targets.
  • Spring: Physical damped harmonic oscillator simulation solving harmonic differential equations.
  • Confetti: 2D celebratory particle physics emitter (radial bursts, cannons, rain) with drag & gravity.
  • DiffViewer: Git diff visualizer with Unified and Split dual-pane views and intra-line word diffs.
  • Form & FormBuilder: Composite multi-field container with field/form validation, error badges, and Tab cycling.
  • CommandPalette: Fuzzy spotlight search runner (Ctrl+P / Cmd+P) with recents tracking and modal overlay.
  • GitTree: Multi-column collapsible file tree with Git status badges ([M], [A], [D], [?]) and branch headers.
  • BarChart: Horizontal and vertical bar charts with sub-character precision, auto-scaling, and TrueColor gradients.

🛠️ Built-in CLI Tool

Espresso includes a powerful command-line interface for running and scaffolding applications:

# List all 14 built-in interactive examples
espresso list

# Run any example by ID or file path
espresso run 14
espresso run 10

# Launch interactive component gallery
espresso gallery

# Scaffold a production-ready Espresso TEA app
espresso new my_dashboard.py

📚 Examples Included

Explore the interactive demos in examples/:

Example Command Highlights
01 Counter espresso run 01 Basic Model-Update-View state transitions
02 Shopping List espresso run 02 List cursor navigation & item selection toggle
03 Styled Dashboard espresso run 03 Crema cards, TrueColor, tabs, side-by-side layout
04 Fullscreen & Mouse espresso run 04 Alt-screen mode, SGR mouse clicks, wheel scrolling, resize
05 Beans Wizard espresso run 05 Multi-component wizard (TextInput, Table, Spinner, Progress, Viewport)
06 Commit Helper espresso run 06 Practical developer tool for Conventional Commits
07 Editor espresso run 07 Multi-line text editor with TextArea, status bar, and Help
08 RSS Reader espresso run 08 Fullscreen 3-panel RSS reader with live feed fetching from schulz.dk
09 Colors & Gradients espresso run 09 TrueColor showcase, multi-stop gradients, box background fills, palette cycling
10 Component Gallery espresso run 10 Full-window edge-to-edge gallery of 20+ beans, mouse support, tabs, modals, prompts
11 Markdown Viewer espresso run 11 Streaming GitHub-flavored markdown viewer with code blocks and mouse scrolling
12 Interactive & Animated espresso run 12 Splitter, Sliders, Marquee, and SortableList with mouse drag
13 Physics & Tools espresso run 13 Confetti physics engine, forms with validation, and diff viewer
14 Developer Workspace espresso run 14 Flagship IDE integrating GitTree, BarChart, CodeViewer, and CommandPalette
15 Accordion & ScrollView espresso run 15 Multi-panel collapsible accordion wrapping forms, tables, and scrollable logs
16 Art & Animation Player espresso run 16 Retro .3a and .ans player with CP437, progressive reveal, and confetti
17 3D Mesh Rasterizer espresso run 17 Software 3D rendering for OBJ/STL/PLY/GLB with Lambert/Gouraud shading & Braille
18 Terminal Image Protocols espresso run 18 DEC Sixel & Kitty Graphics Protocol, capability auto-detection, and tmux protection
19 Desktop Beans Showcase espresso run 19 Desktop application integrating MenuBar, MultiSplitter, Wizard, and CardList
20 Polyglot & Utils espresso run 20 Multilingual i18n live locale switching, Unicode/Emoji inspector, HitMap mouse geometry, and WCAG contrast
21 Live Charts & Plots espresso run 21 Universal Plot Bean studio with live multi-series Line/Area streaming, Donut/Gauge, Candlestick, and Heatmap

📖 In-Depth Documentation


🧪 Running Tests

Espresso includes a comprehensive automated test suite testing state transitions, ANSI parsing, and event loops deterministically:

PYTHONPATH=src python3 -m unittest discover tests

📄 License

MIT License. Copyright (c) 2026 Kim Schulz.

Metadata

Release files for espressoTUI 1.4.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 espressoTUI 1.4.0
File Size Uploaded Provenance Actions
espressotui-1.4.0.tar.gz 225.2 kB With provenance Details for espressotui-1.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for espressoTUI 1.4.0
File Interpreter ABI Platform Actions
espressotui-1.4.0-py3-none-any.whl Python 3 none any Details for espressotui-1.4.0-py3-none-any.whl

Total release size: 489.3 kB

Release files / espressotui-1.4.0.tar.gz

Download URL espressotui-1.4.0.tar.gz
Size 225.2 kB
Tags Source
SHA-256 checksum
How to use checksums
04bfd04db0211a7e1a4d7e4f8af1a96c52430b8277cc972b9d36c5b1ab7c75b8
BLAKE2b-256 checksum
How to use checksums
67b8a128b4bec5e4f144ab9d4470eb4f8668cdb8a1eddeda4f259013d901f15d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 5, 2026.

Transparency log

Release files / espressotui-1.4.0-py3-none-any.whl

Download URL espressotui-1.4.0-py3-none-any.whl
Size 264.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c87ce312ee23b33916621028d94ef26da5d41ac0655249590967e1fae646247
BLAKE2b-256 checksum
How to use checksums
14952f4ca16f2830be282a04f1152fdb61077d9ef2a5620cfc53e21682ddff8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 5, 2026.

Transparency log

Security for espressoTUI 1.4.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for espressotui-1.4.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 Nov 5, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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