Comments (3)
Hi,
You can call the publish_stream method of the interpreter.
from xeus.
Thank you very much. We tried publish_stream, and we got to some more questions:
In Xeus, there are two functions to output results:
publish_execution_result
addsOut[]:
and adds a new line at the end.publish_stream()
does not add a new line and does not addOut[]:
either.
What should we use if we want to display the results progressively as they are computed?
Then the issue is with something like this in python
from time import sleep
import sys
for i in range(5):
sleep(1)
sys.stdout.write(f"{i} ")
which should display
Out[1]: 1
updated one second later to
Out[1]: 1 2
updated one second later to
Out[1]: 1 2 3
In case you are interested, here is the kernel we are developing:
https://pari.math.u-bordeaux.fr/cgi-bin/gitweb.cgi?p=xeus-gp.git;a=blob;f=src/xinterpreter.cpp;h=7e4517ec9f4eb7e5b4d6487fb83c26ef0064d090;hb=refs/heads/bill-2.17
from xeus.
Hi, sorry for the late reply. I'm not 100% sure how the frontend handles this, but I would try the folowing:
- either
publish_execution_result
for sending the first output, and thepublish_stream
to update; this assumes the frontend appends the outputs to the current one. - or maintain a string in the kernel, update it by appending a new result when it become available and immediately send it with
publish_execution_result
. This assumes that the frontend replaces the current output with the new one.
Thanks for the pointer!
from xeus.
Related Issues (20)
- Provide a stop API
- Provide a template function to instantiate a kernel HOT 2
- [Emscripten] generate NPM package content HOT 1
- RTTI is required HOT 2
- Provide a main helper function HOT 2
- Update documentation
- Misleading name print_starting_message HOT 3
- Linking with libuuid should be private HOT 1
- Build of xwidgets doesn't find libUUID HOT 2
- Releasing ressources on comm close triggered by frontend
- Hide the symbols by default on Linux and OSX
- Fix overloaded-virtual warning HOT 1
- Remove deprecated APIs
- `xin_memory_history_manager::get_range_impl()` sets `ename` twice
- `xkernel_core::execute_request` not setting `execution_count` from `p_interpreter->execute_request`
- xeus-lite kernel compilation error HOT 12
- Error in install: mamba: error: unrecognized arguments: -c conda-forge HOT 1
- ABI break with minor version bump in nlohmann::json HOT 2
- Parent header PR: update documentation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xeus.