Turn your Textual TUIs in to web applications
Low maintenance activity. Last release 13 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases.
pip install textual-servetextual-serve
Every Textual application is now a web application.
With 3 lines of code, any Textual app can run in the browser.
|
This is Posting running in the terminal. |
|
|
This is Posting running in the browser. |
|
Getting Started
First, install (or upgrade) Textual.
Then install textual-serve from PyPI:
pip install textual-serve
Creating a server
First import the Server class:
from textual_serve.server import Server
Then create a Server instance and pass the command that launches your Textual app:
server = Server("python -m textual")
The command can be anything you would enter in the shell, as long as it results in a Textual app running.
Finally, call the serve method:
server.serve()
You will now be able to click on the link in the terminal to run your app in a browser.
Summary
Run this code, visit http://localhost:8000
from textual_serve.server import Server
server = Server("python -m textual")
server.serve()
Configuration
The Server class has the following parameters:
| parameter | description |
|---|---|
| command | A shell command to launch a Textual app. |