Skip to main content

A tiny Streamlit-inspired terminal UI experiment.

Project description

stui

CI

stui is a tiny Streamlit-inspired framework for building terminal-native Python apps. Write a short script, run it in your terminal, and get a Textual UI with stateful controls.

It is built for local tools, demos, data scripts, model debug panels, SSH sessions, and headless environments where opening a browser, binding a port, or running a dashboard server is unnecessary ceremony. The public API is deliberately small and readable.

stui is not official Streamlit, is not affiliated with Streamlit, and is not a Streamlit compatibility layer. The API intentionally feels familiar, but this project keeps its own smaller surface area.

Preview

stui model demo terminal screenshot

┌─ stui ───────────────────────────────────────────┐
│ stui demo                                        │
│                                                  │
│ x                                                │
│ [██░░░░░░░░░░░░] 10                              │
│                                                  │
│ [ Increment ]                                    │
│                                                  │
│ x = 10                                           │
│ count = 0                                        │
│                                                  │
│ q Quit   r Rerun   tab Focus next                │
└──────────────────────────────────────────────────┘

Install

Use Python 3.11 or newer.

Install the PyPI distribution named stui-terminal:

python3.11 -m pip install stui-terminal

The PyPI distribution name is stui-terminal, but the import package and CLI are both stui:

import stui as st

For local development from a checkout, use an editable install with the dev extra:

python3.11 -m venv .venv
. .venv/bin/activate
python3.11 -m pip install -e ".[dev]"

For runtime-only local use, install without the dev extra:

python3.11 -m pip install -e .

Quickstart

Install from PyPI, then run your app:

python3.11 -m pip install stui-terminal
stui run app.py

Or set up the project from source and run the basic example:

git clone https://github.com/marmar9615-cloud/stui-terminal.git
cd stui-terminal
python3.11 -m venv .venv
. .venv/bin/activate
python3.11 -m pip install -e ".[dev]"
stui run examples/basic.py

You can also run through the module entry point:

python3.11 -m stui run examples/counter.py

Scripts use the public stui API:

import stui as st

st.title("stui demo")

if "count" not in st.session_state:
    st.session_state.count = 0

value = st.slider("value", 0, 100, 25)

if st.button("Increment"):
    st.session_state.count += 1

st.write("value =", value)
st.write("count =", st.session_state.count)

More examples:

stui run examples/counter.py
stui run examples/model_demo.py

Why terminal-native?

Some useful Python apps do not need a browser runtime. stui keeps the interface inside the terminal so it can fit naturally into:

  • SSH sessions, remote machines, and headless boxes.
  • Internal tools where opening ports or managing local server URLs is friction.
  • Offline or locked-down environments where browser access is limited.
  • Model, data, and DevOps workflows that already start from a shell.

That also keeps the boundary simple: stui does not start a web server, use websockets, require port-forwarding, or depend on Streamlit at runtime.

Commands

# Install the project for local development.
python3.11 -m venv .venv
. .venv/bin/activate
python3.11 -m pip install -e ".[dev]"

# Run the smoke-size example app.
stui run examples/basic.py

# Run the stateful counter example.
stui run examples/counter.py

# Run the deterministic model-parameter demo.
stui run examples/model_demo.py

# Run the test suite.
python3.11 -m pytest

Keyboard Shortcuts

  • q: quit the app
  • r: rerun the script
  • tab: focus the next widget
  • enter: press the focused button
  • left or h: decrease the focused slider
  • right or l: increase the focused slider
  • home: set the focused slider to its minimum value
  • end: set the focused slider to its maximum value

Current API

The current public API is intentionally small:

  • st.title(body, *, key=None): render a title.
  • st.header(body, *, key=None): render a section header.
  • st.text(body): render plain text.
  • st.markdown(body): render Markdown-flavored text.
  • st.divider(): render a horizontal divider.
  • st.info(body), st.success(body), st.warning(body), st.error(body): render status messages.
  • st.write(*args): render simple text output.
  • st.button(label, key=None, help=None, disabled=False, on_click=None, args=None, kwargs=None): render a button and return True for the run where it was pressed.
  • st.slider(label, min_value=0, max_value=100, value=None, step=1, *, key=None, help=None, disabled=False, on_change=None, args=None, kwargs=None): render a numeric slider and return its current value.
  • st.text_input(label, value="", *, key=None, placeholder=None, disabled=False, on_change=None, args=None, kwargs=None): render a single-line text input and return its current value.
  • st.checkbox(label, value=False, *, key=None, disabled=False, on_change=None, args=None, kwargs=None): render a checkbox and return its current value.
  • st.session_state: persist values across reruns with dict-style or attribute-style access.
  • st.rerun(): request a script rerun.

Import the API as:

import stui as st

Examples

Counter

examples/counter.py shows a minimal stateful app with increment, decrement, and reset controls.

stui run examples/counter.py

Model Demo

examples/model_demo.py shows a small model-parameter playground using text input, checkbox, sliders, status messages, session state, and deterministic scoring. It is intentionally local and fake: there are no network calls or model dependencies.

stui run examples/model_demo.py

Limitations

  • No browser, web server, websocket, or port-forwarding runtime.
  • No Streamlit dependency and no promise of Streamlit compatibility.
  • No charts, tables, dataframes, forms, columns, sidebars, or file upload yet.
  • Slider input supports numeric values only.
  • Layout is currently linear and script-driven.
  • The app reruns the script as interactions change state, so examples should keep top-level work lightweight.
  • Error handling is still early and meant for development feedback.
  • The package is an MVP and has not stabilized a long-term compatibility policy.

Roadmap

  • Add small text output helpers such as caption.
  • Add common controls such as selectbox, radio, and number inputs.
  • Add simple display primitives for tables and progress.
  • Improve focus behavior, accessibility hints, and keyboard discoverability.
  • Expand example coverage for data scripts, model controls, DevOps panels, and internal tools.
  • Keep the implementation clean-room, readable, and based on Textual first-party widgets where possible.

Contributing

See CONTRIBUTING.md for the local development workflow and project boundaries.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stui_terminal-0.1.0rc2.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stui_terminal-0.1.0rc2-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file stui_terminal-0.1.0rc2.tar.gz.

File metadata

  • Download URL: stui_terminal-0.1.0rc2.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stui_terminal-0.1.0rc2.tar.gz
Algorithm Hash digest
SHA256 9dba639dcc86dee0e0b9c2f326f04c87fa762dc78f0ba6cc3d66cff6a9d9de82
MD5 89ca1468abe88d9a9f10e2e49ad83e38
BLAKE2b-256 007b389b5ad428fd754dd1e747c893a92df520487b924089ff3abce3fb9348e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for stui_terminal-0.1.0rc2.tar.gz:

Publisher: publish.yml on marmar9615-cloud/stui-terminal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stui_terminal-0.1.0rc2-py3-none-any.whl.

File metadata

File hashes

Hashes for stui_terminal-0.1.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 d396db5e11a2253d016d3a13a8c4dbf9912b82367ec7b36afb7551a80afd0add
MD5 7edffef0cd91b5f0445e67c2cf97d4ee
BLAKE2b-256 56ed866b1230f662cbaf23184a687624400de72d89bd1e4854782d3e4fa2a8e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for stui_terminal-0.1.0rc2-py3-none-any.whl:

Publisher: publish.yml on marmar9615-cloud/stui-terminal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page