textualize / textual-web Goto Github PK
View Code? Open in Web Editor NEWRun TUIs and terminals in your browser
License: MIT License
Run TUIs and terminals in your browser
License: MIT License
Hello, I recently tested textual-web
within a corporate network and encountered this warning/error:
INFO connecting to Ganglion
WARNING Unable to connect to Ganglion server. Will reattempt connection soon.
This led me to realize that apps run through textual-web
are not hosted locally but are instead served from a third-party server, generating a unique URL. I find this worth mentioning explicitly in the README for clarity and to set proper user expectations, especially because this behavior deviates from the original textual
where the 'apps' were obviously run locally.
Could you consider updating the README to specify this information?
Additionally, are there any plans to support local hosting of Textual apps using textual-web
in the future?
Until recently, if you connected to a URL for an application, and textual-web
encountered an error running the application, the client side would quickly show a "Session closed" message. As of v0.5.0 this doesn't appear to happen any more. I'm finding now that the client just shows the "splash screen" for the loading of the application and nothing else happens.
[@click=link('https://www.google.com/{search_result}')]search[/]
Is there a possibility for smooth scrolling + scroll-bar to be implemented in a ScrollableContainer widget specifically for the web.
I understand that in the terminal it would be practically impossible to implement this, and perhaps this package is meant to only be a 1:1 match with the terminal implementation.
Personally, I find that this feature would allow for quick development of web apps that are nearly indistinguishable from natively developed web apps.
If I run textual-web --help
I see this:
Usage: textual-web [OPTIONS]
Main entry point for the CLI.
Args: config: Path to config. environment: environment switch.
devtools: Enable devtools. terminal: Enable a terminal. api_key: API
key. signup: Signup dialog. welcome: Welcome app. merlin: Merlin
app.
Options:
--version Show the version and exit.
-c, --config PATH Location of TOML config file.
-e, --environment [prod|local|dev]
Environment switch.
-a, --api-key TEXT API key
-r, --run COMMAND Command to run a Textual app.
--dev Enable devtools in Textual apps.
-t, --terminal Publish a remote terminal on a random URL.
-s, --signup Create a textual-web account.
--welcome Launch an example app.
--merlin Launch Merlin game.
--help Show this message and exit.
The text before the list of options seems confusing, almost looking like a leaky docstring or something.
Documentation to GanglionClient.add_app
and GanglionClient.add_terminal
say that if slug
is an empty string, the server will generate a slug for you, but it doesn't.
Thus, if you use add_app
/add_terminal
with slug=""
, no app/terminal is served.
To see this, modify the line 166 below to use ""
for the slug and try running textual-web -t
.
You won't be able to connect.
textual-web/src/textual_web/cli.py
Lines 162 to 167 in 45e283c
It appears that textual-web
can't currently be installed when Python 3.12 will be the environment's Python (at least on macOS, Python installed via pyenv).
Using pipx
, for example, I get the following error:
Fatal error from pip prevented installation. Full pip output in file:
/Users/davep/.local/pipx/logs/cmd_2023-11-06_08.18.46_pip_errors.log
pip failed to build packages:
aiohttp
uvloop
Some possibly relevant errors from pip install:
fatal error: too many errors emitted, stopping now [-ferror-limit=]
Error installing textual-web.
An example log:
cmd_2023-11-06_08.12.43_pip_errors.log
If I force Python 3.11:
$ pyenv global 3.11
$ pipx install --force --python (which python) textual-web
(using fish
above, use appropriate substitution syntax for your shell of choice) it installs just fine.
Hello, I have a quick question. Is it possible to run everything locally instead of making connection to https://textual-web.io/ ? It's a bit concerning to give access to your terminal over the internet.
I'm finding that, when I first visit the URL for a textual-web-served application, keyboard input is non-responsive; presumably because the terminal within the page doesn't have focus yet. It would be nice if we could ensure that the terminal is responsive to keyboard input without the need to manually focus it first.
Hello,
are there arguments that changes the publishing to localhost instead of textual-web.io? like localhost:8080/qwwwc7kp6daj/welcome
?
It could be interesting for debugging purposes to have logs / traceback / exceptions saved to a file if the app crashes, in a per-session basis.
If the app quits gracefully (exit code 0?), the same "Session ended" message could be kept; otherwise, display something that looks like the usual "The system terminated in an unexpected manner, please contact your system administrator for more information and give them this number : XXX", with XXX being in the name of the log file or some kind of ID that is present in the filename.
To push things further, a feature that could allow running a custom script when the session ends. It would allow plugging into alerting software such as Grafana's, sending an e-mail or a Telegram message, etc.
The rationale for all of this is that while in development, debugging is very easy; however once deployed in production through textual-web, the app's behavior becomes quite opaque, and it's even harder to debug if the error did not happen to ourselves but to an user.
Currently textual-web
can only run Textual apps via the config gile.
The textual-web
command should also have a --run
and -r
switch to add a single Textual app, in the same way -t
runs a single terminal.
Note that the config file (with -c
) may be used in conjunction with this new switch.
Talk to @willmcgugan if you need help getting started with this one.
At the moment, if you want to serve your applications via an account, the API key needs to go into [account]
section of your configuration file. Depending on the type of application, how it's being served, and who the audience is, this could be an issue. If, for example, some application that's being served allows a way of viewing the content of a file in the current directory1, this would mean that anyone with the URL could get the API key for that account.
I think there's a couple of things we may want to do here:
textual-web
(for example, perhaps from an environment variable, or a keychain, or ~/.authinfo
, or...).There are of course more general issues about applications that provide filesystem access; we may want to think about a very general "best practices" document when it comes to applications and security at some point. ↩
Hi three,
can you please tell me how to run this locally (without the public ip?)
i need a way to add an element and script to my html
and be able to send lines from python
and have auto styleing for them
like rich met xterm
is this what i think its doing?
please advice
Thanks and all the Best!
The idea of serving Textual apps over the internet is interesting. I'm not comfortable with the idea of requiring a proxy over the textual-web.io
gateway for the obvious security reasons - exposing a terminal to the public internet...
Are there plans for for a feature to open a server on the local machine, and use our own web infrastructure, firewalls, and authentication?
Cool project!
I realize this is probably out of scope, but it's critical for line of business apps where the data doesn't live on the server your running from. I can see use cases for line of business and ai applications that fits somewhere between gradio/h2o and streamlit/nicegui/reflex.
I'm currently using NiceGui for my line of business projects because it's the only python forward framework that has robust file upload that can not only handle large files but provide feedback on the upload process.
In the meantime, I'm working on embedding textual into my existing project.
Kudos and all of your amazing projects.
Currently, if someone was to use logic similar to textual diagnose
, to diagnose what terminal their application was being run under, it would appear to be whatever terminal was used to run textual-web
itself1. I feel it would be a good idea to set TERM_PROGRAM
to textual-web
and TERM_PROGRAM_VERSION
to textual-web's version (or perhaps something appropriate to the terminal served to the client side; but that could get tricker as the service expands and potentially other clients could be used).
Testing here, I ran textual-web
, served a terminal with it, and the in-browser terminal had an environment that thought it was kitty. ↩
Is textual planning to offer paid hosting tiers for textual-web?
It seems that textual-web
launches each Textual application in a subprocess, and interacts with it through stdin
/stdout
. I was wondering if a Textual App
could have an API that would emulate stdin
/stdout
, for instance a registered callback that would be called each time the app writes to stdout
, and a function to write to the app's stdin
.
I'm asking because I'd like to do something similar to textual-web
but with everything in-process. I tried redirect_stdout but it doesn't seem to work.
Hi,
What do you think of enabling GitHub Discussions for textual-web
or should I be using the textual
GitHub Discussions tab to discuss textual-web
?
Will textual-web
be a pay for use service or is this something that users can compile and deploy themselves on their own server?
The URL for terminal seems always randomly generated, even if I add slug in the configuration file like this:
[account]
api_key = "xxxx"
[terminal.Terminal]
slug = "a100server"
name = "a100server"
terminal = true
After I run textual-web --config ganglion.toml
, I get a url like "https://textual-web.io/MyAccount/3gu25v1b4t3h", and slug seems not work.
I wonder how to get a constant URL for terminal service?
The current GanglionClient.__init__
assumes that config_path
points to a configuration file but cli.py
passes it a folder by default:
textual-web/src/textual_web/cli.py
Lines 154 to 160 in 45e283c
The current implementation of GanglionClient.__init__
will take that and compute the new path to be the parent directory of that, which means relative paths will be off by one level.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.