Skip to main content

A Gradio component that provides a fully functional terminal using xterm.js and PTY

Project description

Gradio Terminal

PyPI PyPI Downloads GitHub license Coding style

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.

Gradio Terminal

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

  • pyxtermjs - Inspiration for the terminal implementation
  • xterm.js - Terminal emulator for the browser
  • Gradio - The awesome ML demo framework

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

gradio_terminal-1.0.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

gradio_terminal-1.0.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

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

Hashes for gradio_terminal-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b742ef3e9b010f8e7f20d884953df5e7d30f713b55ed3f46d2a1316e1fae0c5a
MD5 0e509d2176790010f3ed48f9c06e5623
BLAKE2b-256 f4a334fe905e2c3c79adf9b041e85453dc177e5784e855375d846f96616fa156

See more details on using hashes here.

Provenance

The following attestation bundles were made for gradio_terminal-1.0.0.tar.gz:

Publisher: publish-to-pypi.yml on aben20807/gradio-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 gradio_terminal-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gradio_terminal-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33e065caf271dc1d439d47724b7cf96276b1aaad430e69f975c002b2c0c5ba38
MD5 4b7b7d01f0b602ae710f8e26c053605c
BLAKE2b-256 4c8513cb91b90e72b0bb8ef4740c154c7500c4c59119f3b7e6ffaa49f1f96d63

See more details on using hashes here.

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

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