$ show JoshKarpel/spiel
Spiel is a terminal-based framework for creating and presenting slide decks using Python. It enables users to define slides as functions that return renderable objects (via Rich), and presents them in a navigable terminal user interface built with Textual. The framework supports features like live reloading during development, slide transitions, and dynamic content generation through a trigger system. The architecture centers around a `Deck` class that manages a sequence of `Slide` objects. Each slide's content is defined by a function that can optionally receive a `Triggers` object for time-based or interactive effects. The presentation is driven by a custom Textual application (`SpielApp`) that handles user input, screen transitions (including slide-to-slide animations), and automatic reloading of the deck when source files change. Key components include the CLI for launching presentations, a flexible slide definition system, and reusable widgets for rendering content such as syntax-highlighted code and images. Notable reusable components include the `Triggers` class for managing interactive state, the `Swipe` transition for slide animations, the `Image` widget for terminal image display, and a set of utility functions (`clamp`, `filter_join`, `chunks`) that solve common programming problems. These components are designed with low coupling and could be extracted for use in other projects with minimal modification.
The LLM identified 4 files worth highlighting for reuse:
Contains generic utility functions: clamp (value constraining), filter_join (filtering and joining strings), and chunks (splitting iterables into chunks). These are isolated, well-tested, and solve common programming problems with no internal dependencies, making them easily reusable in any Python project.
Implements the Triggers class to manage slide trigger states (times when a slide was activated) and compute time deltas. It uses immutability and cached properties for efficiency, providing a clean API for time-based or interactive slide content. This pattern of tracking events and deriving temporal values is broadly applicable to interactive systems.
Implements the Swipe transition animation by manipulating widget offsets to slide views in/out. It adheres strictly to the Transition protocol, making it easy to replace or extend. The self-contained logic for coordinate-based animation could be adapted to other UI frameworks with minimal changes.
Provides an Image widget that renders PIL/Pillow images in the terminal using half-block Unicode characters and truecolor support. It includes caching, automatic resizing, and terminal-aware dimension calculation. This self-contained solution for terminal image display could be reused in any text-based UI project needing image rendering.