Skip to main content

pig-tui

PyPI version Python

pig-tui is the terminal UI platform layer for pig-coding-agent and other agent-style Python applications. It combines:

  • high-level terminal affordances such as ChatUI, Prompt, and streaming helpers
  • framework-level rendering abstractions such as RenderableView, PanelContent, StatusMessage, ChatPresenter, and reusable selector / key-value components

The package is intentionally moving away from a pure helper-library role toward a clearer app/platform split:

  • application packages should provide business semantics and view-model data
  • pig-tui should provide reusable terminal-facing presentation and interaction primitives

Current public layers

High-level compatibility helpers

These keep the current coding-agent UX working while the package evolves:

  • ChatUI
  • Prompt
  • InteractivePrompt
  • LiveInputListener
  • Progress
  • Spinner

Framework-level core

These are the new platform abstractions that higher-level apps should start targeting:

  • Component - minimal runtime-managed component contract
  • Focusable - explicit focus contract for components that can receive runtime focus
  • RenderableView - minimal render contract for reusable terminal views
  • PanelContent - platform-neutral panel payload
  • ContainerContent - runtime-managed container payload
  • StatusMessage - platform-neutral status payload
  • SelectOption - runtime-facing selector option contract
  • TextEditorState - runtime-facing short-text editor state
  • ChatPresenter - adapter that binds PanelContent / StatusMessage to a chat-like UI surface
  • TextBlock
  • KeyValueList
  • SelectListView
  • TextEditorView
  • FocusContainer
  • ChoiceEditorContainer
  • ConfirmView
  • OverlaySession
  • PromptStep
  • SelectionSession
  • EditorSession
  • SelectionEditorSession
  • SelectionActionSession
  • SelectionActionResult
  • TreeBrowserState
  • TreePathState
  • TreeSummaryState
  • TreeDetailState
  • TreeOption
  • TreeBrowserContainer
  • TreeDetailView
  • TreeBrowserSession
  • TreeBrowserResult
  • ShellLoopSession
  • ShellLoopResult
  • TerminalRuntime.begin_overlay_session()
  • TerminalRuntime.end_overlay_session()
  • TerminalRuntime.run_prompt_step()
  • TerminalRuntime.run_shell_loop()
  • TerminalRuntime.run_tree_browser_session()
  • TerminalRuntime.confirm()
  • TerminalRuntime.open_container()
  • TerminalRuntime.select_option()
  • TerminalRuntime.select()
  • TerminalRuntime.edit_text()
  • TerminalRuntime.choose_and_edit()
  • render_info_panel()
  • render_select_panel()
  • render_bullet_panel()
  • render_status_message()

Installation

pip install pig-tui

Quick examples

Platform-level panel rendering

from pig_tui import ChatPresenter, ChatUI, render_info_panel, StatusMessage

ui = ChatUI(title="Demo")
presenter = ChatPresenter(lambda: ui)

presenter.show_panel(
    render_info_panel(
        "Session",
        [
            ("ID", "abc123"),
            ("Entries", "4"),
        ],
    )
)

presenter.show_status(StatusMessage("ok", "Ready"))

Reusable list views

from pig_tui import SelectListView

view = SelectListView(
    [
        ("session-a", "recent"),
        ("session-b", "older"),
    ]
)
view.move(1)

for line in view.render_lines(80):
    print(line)

Compatibility chat surface

from pig_tui import ChatUI

chat = ChatUI(title="Assistant")
chat.user("Hello")
chat.assistant("Hi there!")

Design direction

pig-tui is not trying to be a direct Python clone of pi-tui. Instead, it is converging on the same boundary:

  • terminal runtime and reusable UI primitives live here
  • business semantics stay in application packages such as pig-coding-agent

That means new work should prefer platform-layer abstractions over ad hoc string assembly in application code.

More specifically, TerminalRuntime is now the intended home for runtime-owned interaction flows such as:

  • prompt collection
  • streaming turns
  • component/focus contracts and focus transitions
  • focus transitions
  • focus-container ownership and traversal
  • overlay lifecycle
  • overlay session lifecycle
  • prompt-step lifecycle inside runtime-owned overlay sessions
  • confirmation lifecycle inside runtime-owned prompt/overlay flows
  • structured selection-session lifecycle for confirm/select flows
  • structured editor-session lifecycle for text editing and selection+editor flows
  • structured option resolution inside runtime-owned selector flows
  • structured selection+action flows for browser-style interaction surfaces such as tree/history browsers
  • structured tree browser flows with tree-aware entries instead of plain flat selector options
  • specialized tree browser container/layout for scope, anchor, and action presentation
  • specialized tree browser detail panes backed by explicit detail-row contracts
  • dedicated tree browser detail-state contracts with fixed fields plus optional extra rows
  • dedicated tree browser path-state contracts for breadcrumbs, selected-entry, and anchor chrome
  • dedicated tree browser summary-state contracts for visible/total/path/tip navigator stats
  • dedicated tree browser state contracts that compose scope plus structured path and summary chrome
  • dedicated tree browser runtime entry points instead of reusing generic selection-action sessions for every tree/history workflow
  • interactive shell-loop mechanics with one runtime-owned event loop and prompt/input lifecycle
  • selector flows
  • short-form editor flows
  • container-driven multi-step flows such as selector-plus-editor interactions

The older helper-style APIs remain available, but they should now be understood as convenience wrappers over the structured runtime session primitives (SelectionSession, EditorSession, and SelectionEditorSession) rather than as the primary architecture target for higher-level apps.

License

MIT

Metadata

Release files for pig-tui 0.2.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 pig-tui 0.2.0
File Size Uploaded
pig_tui-0.2.0.tar.gz 46.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pig-tui 0.2.0
File Interpreter ABI Platform
pig_tui-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 82.5 kB

Release files / pig_tui-0.2.0.tar.gz

Download URL pig_tui-0.2.0.tar.gz
Size 46.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6dbc60ae286f9a514fe435da1d24790f103e39ed540663f9e6620f928dc4168a
BLAKE2b-256 checksum
How to use checksums
470888a011c9c74488e66780085b0fff1ca5095d86dc6bc470af767a42c8ac53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 4, 2026.

Transparency log

Release files / pig_tui-0.2.0-py3-none-any.whl

Download URL pig_tui-0.2.0-py3-none-any.whl
Size 36.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9325011c45de0daeb6e8c90d334f2bbae938aecb78b252473ec0ee7644eeae19
BLAKE2b-256 checksum
How to use checksums
5fa4c4b58fa875874d2c0519db7581a1d5662eef7579e9155eb5a0d671ca679d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.0.1

2 release files

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