-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add support for Windows in the Jupyter kernel for Cling #19369
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
base: master
Are you sure you want to change the base?
Conversation
This is amazing! Can we maybe get test coverage for this by enabling some tests from here? https://github.com/root-project/root/blob/master/roottest/python/JupyROOT/CMakeLists.txt#L1 With your development, at least the |
Test Results 21 files 21 suites 3d 8h 23m 56s ⏱️ Results for commit 54ad394. |
@yjoer FYI, some symbols have to be explicitly exported. See for example core/metacling/src/CMakeLists.txt#L129-L215 and interpreter/cling/tools/driver/CMakeLists.txt#L44-L105 |
This is incredible, thank you! I aligned the symbols with the ones in tools/driver/CMakeLists.txt#L44-L105 ![]() |
I believe that's meant for a different kernel. This one doesn't support %cpp or %python magic commands. |
I managed to run most parts of jpt-cling.mp4 |
Super cool! Why does the rest of the notebook not work? You think that can still be fixed? What would be important for this PR is to have test coverage of what you developed, and the first half of that |
The kernel updated here is located at https://github.com/root-project/root/tree/master/interpreter/cling/tools/Jupyter, which differs from the one that supports the root framework. I am not aware of any existing test setup for this specific kernel, either. |
This PR adds support for Windows in the Jupyter kernel. On Windows (MSVCRT), the stdout and stderr file descriptors are not exported as global symbols. To work around this, we now retrieve them using _fdopen. Beginning with Python 3.12, we can utilize the new cross-platform API os.set_blocking to configure pipes as non-blocking.
Since Windows does not offer a direct equivalent to the "select" system call for pipes, I replaced it with PeekNamedPipe to check for available data in the pipe. Unlike select, PeekNamedPipe does not allow efficient blocking. As a result, we currently poll every 0.25 seconds, aligning with the flush interval to check for new data and act accordingly.
The outcome looks appealing, with the interpreter's output and errors being correctly streamed.

Checklist: