A Gradio component that provides a fully functional terminal using xterm.js and PTY
Project description
Gradio Terminal
A Gradio component that provides a fully functional terminal in your browser. This package uses xterm.js on the frontend and a PTY on the backend to provide a real shell experience.
Installation
pip install gradio-terminal
Quick Start
Simple Usage
import gradio as gr
from gradio_terminal import Terminal
demo = gr.Blocks()
with demo:
terminal = Terminal()
demo.launch()
Secure Terminal (No Sudo)
import gradio as gr
from gradio_terminal import Terminal
demo = gr.Blocks()
with demo:
terminal = Terminal(allow_sudo=False) # Block sudo commands
demo.launch()
API Reference
| Function | Parameters | Description |
|---|---|---|
launch_terminal() |
port=5000, host="127.0.0.1", command="bash", share=False, allow_sudo=True, **launch_kwargs |
Launch a standalone Gradio app with a terminal. |
create_terminal_demo() |
port=5000, host="127.0.0.1", command="bash", height=400, allow_sudo=True |
Create a Gradio Blocks demo with an embedded terminal. |
Terminal() |
port=5000, host="127.0.0.1", command="bash", height=400, label=None, visible=True, elem_id=None, elem_classes=None, allow_sudo=True |
Create a terminal component for Gradio Blocks. |
TerminalServer() |
port=5000, host="127.0.0.1", command="bash" |
Low-level terminal server for custom integrations. |
TerminalServer Methods
| Method | Description |
|---|---|
start() |
Start the server and return the URL |
get_url() |
Get the terminal server URL |
stop() |
Stop the terminal server |
Notes
allow_sudo: Whether to allow sudo commands (default: True). When False, sudo commands are blocked with an error message.
Security
This component provides shell access to your server. Use the allow_sudo=False parameter to block sudo commands for enhanced security:
terminal = Terminal(allow_sudo=False)
Requirements
- Python 3.8+
- Linux
- Dependencies: gradio, flask, flask-socketio
Security Notice
This component provides shell access to your server. Use only in trusted environments.
License
This project is licensed under the Apache-2.0 License.
Acknowledgments
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
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 gradio_terminal-1.0.0.tar.gz.
File metadata
- Download URL: gradio_terminal-1.0.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b742ef3e9b010f8e7f20d884953df5e7d30f713b55ed3f46d2a1316e1fae0c5a
|
|
| MD5 |
0e509d2176790010f3ed48f9c06e5623
|
|
| BLAKE2b-256 |
f4a334fe905e2c3c79adf9b041e85453dc177e5784e855375d846f96616fa156
|
Provenance
The following attestation bundles were made for gradio_terminal-1.0.0.tar.gz:
Publisher:
publish-to-pypi.yml on aben20807/gradio-terminal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gradio_terminal-1.0.0.tar.gz -
Subject digest:
b742ef3e9b010f8e7f20d884953df5e7d30f713b55ed3f46d2a1316e1fae0c5a - Sigstore transparency entry: 836477802
- Sigstore integration time:
-
Permalink:
aben20807/gradio-terminal@9c094d4c6192c89890bc9d05d2d7d9de12048f85 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/aben20807
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@9c094d4c6192c89890bc9d05d2d7d9de12048f85 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gradio_terminal-1.0.0-py3-none-any.whl.
File metadata
- Download URL: gradio_terminal-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33e065caf271dc1d439d47724b7cf96276b1aaad430e69f975c002b2c0c5ba38
|
|
| MD5 |
4b7b7d01f0b602ae710f8e26c053605c
|
|
| BLAKE2b-256 |
4c8513cb91b90e72b0bb8ef4740c154c7500c4c59119f3b7e6ffaa49f1f96d63
|
Provenance
The following attestation bundles were made for gradio_terminal-1.0.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on aben20807/gradio-terminal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gradio_terminal-1.0.0-py3-none-any.whl -
Subject digest:
33e065caf271dc1d439d47724b7cf96276b1aaad430e69f975c002b2c0c5ba38 - Sigstore transparency entry: 836477805
- Sigstore integration time:
-
Permalink:
aben20807/gradio-terminal@9c094d4c6192c89890bc9d05d2d7d9de12048f85 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/aben20807
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@9c094d4c6192c89890bc9d05d2d7d9de12048f85 -
Trigger Event:
push
-
Statement type: