Giter Site home page Giter Site logo

textual-web's People

Contributors

bswck avatar darrenburns avatar davep avatar rodrigogiraoserrao avatar willmcgugan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

textual-web's Issues

Clarification regarding app hosting behavior & Support for local hosting

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?

An error running an application leaves the client in a "hung state"

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.

clicking url is not working in latest textual version

Context

  • Was adding few formatted urls to click when the textual app shows up a specific screen
[@click=link('https://www.google.com/{search_result}')]search[/]
  • previously above action used to work and opens up browser with dynamic search urls, recently while updating the textual to 0.64.0 the urls are not clickable

ScrollableContainer for the Web - Smooth Scrolling + Scroll-Bar

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.

Confusing output with `--help`

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.

Can't provide empty slugs to `add_app`/`add_terminal`

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.

if terminal:
ganglion_client.add_terminal(
"Terminal",
os.environ.get("SHELL", "bin/sh"),
identity.generate().lower(),
)

`textual-web` can't be installed while depending on Python 3.12 (macOS)

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.

Initial focus when visiting a textual-web application

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.

Emojis cause visual glitches (affects CommandPalette, DirectoryTree)

There seems to be an issue with emojis, presumably this is in xterm.js.

Examples:

Emojis typed into an input break measurement:

image

The directory tree causes rendering glitches - note that the line numbers are appearing twice in the image below. This doesn't happen when there's no DirectoryTree.

image

localhost, not internet

Hello,
are there arguments that changes the publishing to localhost instead of textual-web.io? like localhost:8080/qwwwc7kp6daj/welcome?

Feature Request: Crash logs & Session end hook

  1. Crash logs

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.

  1. Session end hook

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.

Add --run switch to textual-web

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.

Extra options for specifying the API key

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:

  1. Include in any documentation a clear description of how this is something to keep in mind, and that users should think carefully about what applications they serve and who they give access to.
  2. Consider adding other routes via which the API key can be provided to textual-web (for example, perhaps from an environment variable, or a keychain, or ~/.authinfo, or...).

Footnotes

  1. 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.

Can this be used like xTermJS but with python?

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!

Feature Request: Self hosting

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?

[feature idea] File upload

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.

Provide an appropriate value for `TERM_PROGRAM` and `TERM_PROGRAM_VERSION`

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).

Footnotes

  1. Testing here, I ran textual-web, served a terminal with it, and the in-browser terminal had an environment that thought it was kitty.

API for emulating stdin/stdout in Textual App

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.

Enable GitHub Discussions

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?

How to add slug for terminal

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?

`GanglionClient` assumes given `config_path` points to a file

The current GanglionClient.__init__ assumes that config_path points to a configuration file but cli.py passes it a folder by default:

ganglion_client = GanglionClient(
config or "./",
_config,
_environment,
api_key=api_key or None,
devtools=devtools,
)

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.