-
-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terminal Widget based on xtermjs #2090
Conversation
I just added the basic "Button Extension" described in the Custom Extension guide. It made is SO EASY to get started with a working custom extension. It took a few minutes to get a basic custom extension working. Maybe a |
A minimum POC is there panel-terminal.mp4 |
@philippjfr . If you have good ideas about the api we want feel free to provide an example. Right now it's as simple as class Terminal(Widget):
object = param.String(doc="The text to write in the terminal")
out = param.String(doc="Any text written by the user in the terminal") I will have to explore and learn because I have not working with terminals before. And not so much with redirecting logs, stdout etc. or using pty. |
It should probably just implement the file protocol, i.e. at minimum implement import sys
term = Terminal()
sys.stdout = term
sys.stderr = term |
Got the basics working. The Terminal is now defined as class Terminal(StringIO, Widget):
# Parameters to be mapped to Bokeh model properties
value = param.String(doc="""
User input from the terminal""")
object = param.String(doc="""
System output to the terminal""")
Do you have any input on these 3 considerations @philippjfr ? panel_terminal.mp4 |
Definitely straddling the line but if it's accepting user input, it's a widget.
Don't think this is a good idea. Just satisfy the file-protocol.
Not sure about separating the |
The object returns the last output. The value returns the last input from the user |
Status: Output works, layout works (with a few hacks) panel_terminal3.mp4 |
Importing the Do you have any ideas on what could be the cause or solution @philippjfr ? Thanks. |
I would seriously discourage displaying anything in the same cell where you are loading the extension. |
That seems to be a bug though, it should wait on bokeh to be loaded instead of erroring. But give it a few seconds before you display something to let Bokeh load. If that works then it's a distinct bug and you shouldn't worry about it. |
I just used one cell to make it as "minimal" as possible. It's the same problem when using multiple cells @philippjfr |
I'll take a look when I get a chance. |
Thanks @philippjfr . It's not urgent as I will just finalize the rest and then you can take a look as a part of the review/ rewrite you will be doing anyways. Thanks. |
#1925
Implements a Terminal Component based on xtermjs
Must Do
[x] Make it work in Jupyter Hub (See image with issue in post below).
[x] Create Reference Guide Notebook
[x] Design the api
[x] Support input
[x] Support output including links, emojis and danish characters.
[x] Fix size issues (using add on fit)
[x] Define
.js
and.css
assets to include on bokeh model.[x] Make it Work on Server
[x] Make it Work in notebook
Nice to Have
[] Support running subprocesses like bash, python and ipython in pty
- [] On windows (winpty?)
- [] Improve on
add_periodic_callback
. Should this be seperate thread or other period length?- [x] On Linux
- [x] Handle user exit from terminal.
[] Support Addons
- [] Attach
- [x] fit
- [] Search
- [x] Web-Links
[] Make
.fit
calculation in.ts
model 100% bullet proof and also supportsizing_mode="stretch_height"
.[] Determine whether to inherit from
StreamIO
or not. c.f. Philipp comment below.[] Fix hacks for handling repeated input/ output
[] Enable copy-paste
[] Implement nice kill in notebook (see image in posts below).
[x] Example of using subprocess.Popen
[x] Example using streaming data from some longer running process
[x] Example of redirecting python log