A Streamlit plugin that embeds a fully interactive terminal in your app, powered by the excellent ttyd project.
| Platform | Architecture | Status |
|---|---|---|
| Linux | x86_64, aarch64, arm | Supported |
| macOS | x86_64, aarch64 | Supported |
| Windows | — | Not yet supported |
If you need Windows or other platform support, please open an issue.
pip install streamlit-ttydimport streamlit as st
from streamlit_ttyd import terminal
import time
st.text("Terminal showing processes running on your system using the top command")
# Start the ttyd server and display the terminal on Streamlit
ttydprocess, port = terminal(cmd="top")
# Info on ttyd port
st.text(f"ttyd server is running on port: {port}")
# Kill the ttyd server after a minute
time.sleep(60)
ttydprocess.kill()Starts a ttyd server and embeds an interactive terminal iframe in the Streamlit app.
Returns: A tuple of (ttyd_process, port).
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
cmd |
str |
"echo terminal-speaking... && sleep 99999" |
The shell command to run in the terminal |
readonly |
bool |
False |
If True, the terminal is read-only (no user input) |
host |
str |
"http://localhost" |
Protocol and hostname where the Streamlit server is running |
port |
int |
0 |
Port for the ttyd server. 0 auto-selects a free port in the 5000–7000 range |
exit_on_disconnect |
bool |
True |
Kill the ttyd server when the web terminal disconnects |
height |
int |
400 |
Height of the terminal iframe in pixels |
ttyd |
str |
"" |
Custom path to a ttyd binary. If empty, uses the bundled binary |
This project is licensed under the MIT License.
ttyd is also MIT licensed — its license is included in the ttyd_license file.
