Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
b33908f
Fix context errors
IsabelParedes Mar 8, 2024
0adb618
Working build
IsabelParedes Mar 8, 2024
7ec1dce
Working without debugger
IsabelParedes Mar 8, 2024
71cf45c
Not working
IsabelParedes Mar 11, 2024
6526c65
Partially working
IsabelParedes Mar 12, 2024
f167fdb
Working
IsabelParedes Mar 12, 2024
f1290dc
Rename xhook
IsabelParedes Mar 13, 2024
ca0b1fd
Move hook
IsabelParedes Mar 15, 2024
b94c546
Add uvw dependency
IsabelParedes Mar 18, 2024
e4241b3
Ignore pybind11 visibility warning
IsabelParedes Mar 18, 2024
edad43f
Clean hook
IsabelParedes Mar 18, 2024
8c685c6
Clean main
IsabelParedes Mar 19, 2024
3de5865
Fix hook implementaion
IsabelParedes Apr 17, 2024
c7be18d
merged
DerThorsten Dec 16, 2025
44f8a31
updates
DerThorsten Dec 17, 2025
8a7cc27
remove mac-13
DerThorsten Dec 17, 2025
0a8469f
movin find uv related code to non-emscripten branch
DerThorsten Dec 17, 2025
3f93c9b
working
DerThorsten Dec 19, 2025
9a3468b
libuv
DerThorsten Dec 19, 2025
9dd02a4
libuv
DerThorsten Dec 19, 2025
565eb44
path
DerThorsten Dec 19, 2025
8924b65
path
DerThorsten Dec 19, 2025
1d5b863
path
DerThorsten Dec 19, 2025
1b69129
widgets
DerThorsten Dec 19, 2025
88494df
build xeus-uv
DerThorsten Jan 14, 2026
04488e4
add uvloop
DerThorsten Jan 14, 2026
6fcedf2
debugger
DerThorsten Jan 14, 2026
f992408
debugger
DerThorsten Jan 14, 2026
3ec1f4e
remove xeus-uv after building
DerThorsten Jan 14, 2026
f064138
special win env
DerThorsten Jan 14, 2026
f7d0707
use winloop
DerThorsten Jan 14, 2026
3c93e82
debug
DerThorsten Jan 14, 2026
2b9c47f
move
DerThorsten Jan 14, 2026
6f93c42
debug
DerThorsten Jan 14, 2026
14b7b79
native runner
DerThorsten Jan 15, 2026
e653348
native runner
DerThorsten Jan 15, 2026
996ffce
native runner
DerThorsten Jan 15, 2026
4ebb635
native runner
DerThorsten Jan 15, 2026
3cde4bb
remove uv
DerThorsten Jan 15, 2026
30484fb
fix debugger bug
DerThorsten Jan 15, 2026
762d3e9
fix raw kernel
DerThorsten Jan 15, 2026
72bbf92
fix raw kernel
DerThorsten Jan 15, 2026
c6bca8a
use one global dict
DerThorsten Jan 15, 2026
d819940
fixes
DerThorsten Jan 15, 2026
f157b1e
time based win
DerThorsten Jan 15, 2026
ef0d671
time based win
DerThorsten Jan 15, 2026
8e7be86
time based win
DerThorsten Jan 15, 2026
e2e91b8
first c++ tests
DerThorsten Jan 15, 2026
6942240
remove activation
DerThorsten Jan 15, 2026
85f110b
remove activation
DerThorsten Jan 15, 2026
659aa42
remove activation
DerThorsten Jan 15, 2026
edcc4d9
remove activation
DerThorsten Jan 15, 2026
ba03df8
remove activation
DerThorsten Jan 15, 2026
5148f51
dont build extension
DerThorsten Jan 16, 2026
887888e
use dummy in stop
DerThorsten Jan 16, 2026
c9debbb
activate
DerThorsten Jan 16, 2026
72dec6f
build extension again
DerThorsten Jan 16, 2026
3abd2f0
build extension again
DerThorsten Jan 16, 2026
97e12ba
use reader
DerThorsten Jan 16, 2026
090f535
use reader
DerThorsten Jan 16, 2026
428bb9f
use reader
DerThorsten Jan 16, 2026
6059c30
use reader
DerThorsten Jan 16, 2026
835ec30
fix
DerThorsten Jan 16, 2026
23f05ea
fix
DerThorsten Jan 16, 2026
5960c82
fix
DerThorsten Jan 16, 2026
7a1fa8f
fix
DerThorsten Jan 16, 2026
604613d
fix
DerThorsten Jan 16, 2026
cf4bbfa
fixes
DerThorsten Jan 16, 2026
1315e04
fixes
DerThorsten Jan 16, 2026
d1afdb4
fixes
DerThorsten Jan 16, 2026
5d9972f
fixes
DerThorsten Jan 16, 2026
eb76726
fixes
DerThorsten Jan 16, 2026
5f00b20
fixes
DerThorsten Jan 16, 2026
091a8bf
fixes
DerThorsten Jan 16, 2026
4214603
fixes
DerThorsten Jan 16, 2026
264f7a5
fixes
DerThorsten Jan 16, 2026
ffb3b0f
more
DerThorsten Jan 16, 2026
13778ee
more
DerThorsten Jan 16, 2026
b9a9826
more
DerThorsten Jan 16, 2026
ae16a96
more
DerThorsten Jan 16, 2026
4f667a5
more
DerThorsten Jan 16, 2026
2bd30a8
more
DerThorsten Jan 16, 2026
acf7c65
more
DerThorsten Jan 16, 2026
0b69b19
more
DerThorsten Jan 16, 2026
51c4967
more
DerThorsten Jan 16, 2026
e7f6550
more
DerThorsten Jan 16, 2026
d99c17b
more
DerThorsten Jan 16, 2026
ef0820d
more
DerThorsten Jan 16, 2026
97edd8d
more
DerThorsten Jan 16, 2026
abcdf81
more info
DerThorsten Jan 16, 2026
50bbcfc
more info
DerThorsten Jan 16, 2026
ec209c6
even more
DerThorsten Jan 16, 2026
a234d29
even more
DerThorsten Jan 16, 2026
fc2e031
even more
DerThorsten Jan 16, 2026
550fffc
no more specta
DerThorsten Jan 17, 2026
c6d6595
no more specta
DerThorsten Jan 17, 2026
7b79068
no more specta
DerThorsten Jan 17, 2026
210127f
no more specta
DerThorsten Jan 17, 2026
0307683
no more specta
DerThorsten Jan 17, 2026
03baf67
no more specta
DerThorsten Jan 17, 2026
65ae1af
win experiment
DerThorsten Jan 19, 2026
e7f717d
win experiment
DerThorsten Jan 19, 2026
efaca54
win experiment
DerThorsten Jan 19, 2026
329b34a
use selector event loop
DerThorsten Jan 19, 2026
3ee6bc8
win experiment
DerThorsten Jan 19, 2026
7f438e9
win experiment
DerThorsten Jan 19, 2026
15abfed
adding default runner to xeus python st. we can add cout stuff
DerThorsten Jan 19, 2026
69ab3dc
missing break
DerThorsten Jan 19, 2026
a569228
cleanup
DerThorsten Jan 20, 2026
6ad6c05
applied #685 to async pr
Klaim Jan 22, 2026
79b7d72
added missing boost dependency
Klaim Jan 22, 2026
7804a3a
ignore root build dirs
Klaim Jan 22, 2026
64e2281
added missing boost packages dependencies
Klaim Jan 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/deploy-github-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
environment-file: environment-wasm-build.yml
init-shell: bash
environment-name: xeus-python-wasm-build

- name: Set ncpus
run: echo "ncpus=$(nproc --all)" >> $GITHUB_ENV

Expand All @@ -47,6 +46,11 @@ jobs:

set -eux


URL=https://github.com/DerThorsten/xeus-python-shell/archive/refs/heads/libuv.zip
curl -L $URL -o xeus-python-shell-libuv.zip
unzip xeus-python-shell-libuv.zip

export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-python-wasm-host
echo "PREFIX=$PREFIX" >> $GITHUB_ENV

Expand All @@ -63,10 +67,13 @@ jobs:
- name: Jupyter Lite integration
shell: bash -l {0}
run: |
THIS_DIR=$(pwd)
jupyter lite build \
--XeusAddon.prefix=${{ env.PREFIX }} \
--contents notebooks/ \
--output-dir dist
--output-dir dist \
--XeusAddon.mounts=$THIS_DIR/xeus-python-shell-libuv/xeus_python_shell/:/lib/python3.13/site-packages/xeus_python_shell/


- name: Upload artifact
uses: actions/upload-pages-artifact@v4
Expand Down
26 changes: 19 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04, macos-13, macos-14]
os: [ubuntu-22.04, ubuntu-24.04, macos-14]
build_type: [static_build, shared_build]

steps:
Expand All @@ -32,6 +32,10 @@ jobs:
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment-dev.yml

- name: Install xeus-python-shell from GitHub
run: pip install git+https://github.com/DerThorsten/xeus-python-shell.git@libuv


- name: Make build directory
run: mkdir build
Expand All @@ -47,7 +51,8 @@ jobs:
run: |
CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DXPYT_BUILD_STATIC=OFF"
echo "CMAKE_EXTRA_ARGS=$CMAKE_EXTRA_ARGS" >> $GITHUB_ENV



- name: Configure cmake
run: |
cmake .. \
Expand All @@ -61,8 +66,12 @@ jobs:
${{ env.CMAKE_EXTRA_ARGS }}
working-directory: build

- name: Build all targets
run: cmake --build . --verbose -j ${{ runner.os == 'macOS' && 3 || 4 }}
working-directory: build

- name: Install
run: make -j ${{ runner.os == 'macOS' && 3 || 4 }} install
run: cmake --install .
working-directory: build

- name: Print version
Expand Down Expand Up @@ -97,6 +106,10 @@ jobs:

- name: Make build directory
run: mkdir build

- name: Install xeus-python-shell from GitHub
shell: cmd /C call {0}
run: pip install git+https://github.com/DerThorsten/xeus-python-shell.git@libuv

- name: Static build option
if: matrix.build_type == 'static_build'
Expand Down Expand Up @@ -134,13 +147,12 @@ jobs:

- name: Test xeus-python Python
shell: cmd /C call {0}
run: pytest . -vvv
run: pytest . -s -vvv


- name: Test xeus-python C++
shell: cmd /C call {0}
run: |
micromamba activate xeus-python
test_xeus_python
timeout-minutes: 4
working-directory: build\test

working-directory: build\test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ docs/build/

# Build directory
build/
/build-*/

# generated kernel specs
/share/jupyter/kernels/xpython/kernel.json
Expand Down
25 changes: 22 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ set(pybind11_REQUIRED_VERSION 2.6.1)
set(pybind11_json_REQUIRED_VERSION 0.2.8)
set(pyjs_REQUIRED_VERSION 2.0.0)

find_package(Python COMPONENTS Interpreter REQUIRED)
# find_package(Python COMPONENTS Interpreter REQUIRED)

if (NOT TARGET pybind11::headers)
# Defaults to ON for cmake >= 3.18
Expand All @@ -105,8 +105,11 @@ else ()
if (NOT TARGET xeus-zmq AND NOT TARGET xeus-zmq-static)
find_package(xeus-zmq ${xeus-zmq_REQUIRED_VERSION} REQUIRED)
endif ()

endif()



# Configuration
# =============

Expand Down Expand Up @@ -178,6 +181,10 @@ set(XEUS_PYTHON_SRC
src/xstream.hpp
src/xtraceback.cpp
src/xutils.cpp
src/xasync_runner.cpp
src/xaserver.cpp
src/xacontrol_default_runner.cpp

)

set(XEUS_PYTHON_HEADERS
Expand All @@ -188,6 +195,8 @@ set(XEUS_PYTHON_HEADERS
include/xeus-python/xinterpreter_raw.hpp
include/xeus-python/xtraceback.hpp
include/xeus-python/xutils.hpp
include/xeus-python/xaserver.hpp
include/xeus-python/xacontrol_default_runner.hpp
)

set(XPYTHON_SRC
Expand Down Expand Up @@ -317,7 +326,10 @@ macro(xpyt_create_target target_name src headers linkage output_name)
set(XPYT_XEUS_TARGET xeus-zmq-static)
endif ()

target_link_libraries(${target_name} PUBLIC ${XPYT_XEUS_TARGET} PRIVATE pybind11::pybind11 pybind11_json)
target_link_libraries(${target_name}
PUBLIC ${XPYT_XEUS_TARGET} ${UVW_LIBRARY}
PRIVATE pybind11::pybind11 pybind11_json
)
if (WIN32 OR CYGWIN)
target_link_libraries(${target_name} PRIVATE ${PYTHON_LIBRARIES})
elseif (APPLE)
Expand Down Expand Up @@ -371,11 +383,18 @@ endif ()

if (XPYT_BUILD_XPYTHON_EXECUTABLE)
add_executable(xpython ${XPYTHON_SRC})
target_link_libraries(xpython PRIVATE pybind11::embed)
target_link_libraries(xpython PRIVATE pybind11::embed )

xpyt_set_common_options(xpython)
xpyt_set_kernel_options(xpython)
xpyt_target_link_libraries(xpython)

get_target_property(_libs xpython LINK_LIBRARIES)
message(STATUS "xpython LINK_LIBRARIES = ${_libs}")

message(STATUS "xeus-python file = $<TARGET_FILE:xeus-python>")


endif()

# xpython_extension
Expand Down
7 changes: 6 additions & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ dependencies:
# The debugger is not available with python 3.13 because
# of a spurious bug in debugpy
- python <3.13
- xeus-python-shell>=0.6.3,<0.7
- pip
#- xeus-python-shell>=0.6.3,<0.7 # we need an unreleased version
- debugpy>=1.6.5
- ipython
# Test dependencies
Expand All @@ -25,3 +26,7 @@ dependencies:
- jupyter_kernel_test<0.8
- doctest
- pluggy=1.3
- libboost
- libboost-devel
- libboost-headers

2 changes: 2 additions & 0 deletions environment-wasm-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ dependencies:
- jupyterlite-core >0.6
- jupyter_server
- jupyterlite-xeus
- # widgets
- ipywidgets
4 changes: 3 additions & 1 deletion environment-wasm-host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ dependencies:
- numpy
- xeus-lite
- xeus
- xeus-python-shell>=0.6.3
- pyjs >=2,<3
- libpython
- zstd
- openssl
- xz
- ipywidgets
# - xeus-python-shell>=0.6.3

35 changes: 35 additions & 0 deletions include/xeus-python/xacontrol_default_runner.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/***************************************************************************
* Copyright (c) 2016, Johan Mabille, Sylvain Corlay, Martin Renou *
* Copyright (c) 2016, QuantStack *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#ifndef XEUS_PYTHON_ACONTROL_DEFAULT_RUNNER_HPP
#define XEUS_PYTHON_ACONTROL_DEFAULT_RUNNER_HPP

#include "xeus_python_config.hpp"
#include "xeus-zmq/xcontrol_runner.hpp"

namespace xpyt
{
class XEUS_PYTHON_API xacontrol_default_runner final : public xeus::xcontrol_runner
{
public:

xacontrol_default_runner() = default;
~xacontrol_default_runner() override = default;

private:

void run_impl() override;
void stop_impl() override;

bool m_request_stop;
};
}

#endif

22 changes: 22 additions & 0 deletions include/xeus-python/xaserver.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/***************************************************************************
* Copyright (c) 2024, Isabel Paredes *
* Copyright (c) 2024, QuantStack *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#include "xeus_python_config.hpp"
#include "xeus/xkernel.hpp"
#include "pybind11/pybind11.h"

namespace py = pybind11;
namespace nl = nlohmann;

namespace xpyt
{

XEUS_PYTHON_API XPYT_FORCE_PYBIND11_EXPORT xeus::xkernel::server_builder make_xaserver_factory(py::dict globals);

} // namespace xeus
12 changes: 9 additions & 3 deletions include/xeus-python/xdebugger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ namespace xpyt

using base_type = xeus::xdebugger_base;

debugger(xeus::xcontext& context,
debugger(
py::dict globals,
xeus::xcontext& context,
const xeus::xconfiguration& config,
const std::string& user_name,
const std::string& session_id,
Expand All @@ -65,6 +67,9 @@ namespace xpyt
xeus::xdebugger_info get_debugger_info() const override;
std::string get_cell_temporary_file(const std::string& code) const override;


py::dict m_global_dict;

std::unique_ptr<xdebugpy_client> p_debugpy_client;
std::string m_debugpy_host;
std::string m_debugpy_port;
Expand All @@ -74,8 +79,9 @@ namespace xpyt
bool m_copy_to_globals_available;
};

XEUS_PYTHON_API
std::unique_ptr<xeus::xdebugger> make_python_debugger(xeus::xcontext& context,
XEUS_PYTHON_API XPYT_FORCE_PYBIND11_EXPORT
std::unique_ptr<xeus::xdebugger> make_python_debugger(py::dict globals,
xeus::xcontext& context,
const xeus::xconfiguration& config,
const std::string& user_name,
const std::string& session_id,
Expand Down
12 changes: 7 additions & 5 deletions include/xeus-python/xinterpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace nl = nlohmann;

namespace xpyt
{
class XEUS_PYTHON_API interpreter : public xeus::xinterpreter
class XEUS_PYTHON_API XPYT_FORCE_PYBIND11_EXPORT interpreter : public xeus::xinterpreter
{
public:

Expand All @@ -44,7 +44,9 @@ namespace xpyt
// If redirect_display_enabled is true (default) then this interpreter will
// overwrite sys.displayhook and send execution results using publish_execution_result.
// Disable this if your interpreter uses custom display hook.
interpreter(bool redirect_output_enabled=true, bool redirect_display_enabled = true);
interpreter(
py::dict globals,
bool redirect_output_enabled=true, bool redirect_display_enabled = true);
virtual ~interpreter();

protected:
Expand Down Expand Up @@ -76,6 +78,7 @@ namespace xpyt

void redirect_output();

py::dict m_global_dict;
py::object m_ipython_shell_app;
py::object m_ipython_shell;
py::object m_displayhook;
Expand All @@ -92,14 +95,13 @@ namespace xpyt
// If an application has already released the GIL by the time the interpreter
// is started, m_release_gil_at_startup has to be set to false to prevent
// releasing it again in configure_impl().
//
bool m_release_gil_at_startup = true;
bool m_release_gil_at_startup = false;
gil_scoped_release_ptr m_release_gil = nullptr;

bool m_redirect_output_enabled;
bool m_redirect_display_enabled;

private:
private:

virtual void instanciate_ipython_shell();
virtual bool use_jedi_for_completion() const;
Expand Down
10 changes: 8 additions & 2 deletions include/xeus-python/xinterpreter_raw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace nl = nlohmann;

namespace xpyt
{
class XEUS_PYTHON_API raw_interpreter : public xeus::xinterpreter
class XEUS_PYTHON_API XPYT_FORCE_PYBIND11_EXPORT raw_interpreter : public xeus::xinterpreter
{
public:

Expand All @@ -42,7 +42,9 @@ namespace xpyt
// If redirect_display_enabled is true (default) then this interpreter will
// overwrite sys.displayhook and send execution results using publish_execution_result.
// Disable this if your interpreter uses custom display hook.
raw_interpreter(bool redirect_output_enabled=true, bool redirect_display_enabled = true);
raw_interpreter(
py::dict globals,
bool redirect_output_enabled=true, bool redirect_display_enabled = true);
virtual ~raw_interpreter();

protected:
Expand Down Expand Up @@ -88,6 +90,10 @@ namespace xpyt
bool m_release_gil_at_startup = true;
gil_scoped_release_ptr m_release_gil = nullptr;
bool m_redirect_display_enabled;

std::string _i,_ii,_iii;

py::dict m_global_dict;
};

}
Expand Down
Loading
Loading