A tiny Streamlit-inspired terminal UI experiment.
Project description
stui
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 ───────────────────────────────────────────┐
│ 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 appr: rerun the scripttab: focus the next widgetenter: press the focused buttonleftorh: decrease the focused sliderrightorl: increase the focused sliderhome: set the focused slider to its minimum valueend: 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 returnTruefor 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dba639dcc86dee0e0b9c2f326f04c87fa762dc78f0ba6cc3d66cff6a9d9de82
|
|
| MD5 |
89ca1468abe88d9a9f10e2e49ad83e38
|
|
| BLAKE2b-256 |
007b389b5ad428fd754dd1e747c893a92df520487b924089ff3abce3fb9348e1
|
Provenance
The following attestation bundles were made for stui_terminal-0.1.0rc2.tar.gz:
Publisher:
publish.yml on marmar9615-cloud/stui-terminal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stui_terminal-0.1.0rc2.tar.gz -
Subject digest:
9dba639dcc86dee0e0b9c2f326f04c87fa762dc78f0ba6cc3d66cff6a9d9de82 - Sigstore transparency entry: 1481099745
- Sigstore integration time:
-
Permalink:
marmar9615-cloud/stui-terminal@c8efb0d66a8b2d18feb977d4f74431998d318bfb -
Branch / Tag:
refs/tags/v0.1.0rc2 - Owner: https://github.com/marmar9615-cloud
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c8efb0d66a8b2d18feb977d4f74431998d318bfb -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file stui_terminal-0.1.0rc2-py3-none-any.whl.
File metadata
- Download URL: stui_terminal-0.1.0rc2-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d396db5e11a2253d016d3a13a8c4dbf9912b82367ec7b36afb7551a80afd0add
|
|
| MD5 |
7edffef0cd91b5f0445e67c2cf97d4ee
|
|
| BLAKE2b-256 |
56ed866b1230f662cbaf23184a687624400de72d89bd1e4854782d3e4fa2a8e4
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stui_terminal-0.1.0rc2-py3-none-any.whl -
Subject digest:
d396db5e11a2253d016d3a13a8c4dbf9912b82367ec7b36afb7551a80afd0add - Sigstore transparency entry: 1481100064
- Sigstore integration time:
-
Permalink:
marmar9615-cloud/stui-terminal@c8efb0d66a8b2d18feb977d4f74431998d318bfb -
Branch / Tag:
refs/tags/v0.1.0rc2 - Owner: https://github.com/marmar9615-cloud
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c8efb0d66a8b2d18feb977d4f74431998d318bfb -
Trigger Event:
workflow_dispatch
-
Statement type: