Skip to content

libuv based event loop / server#681

Closed
DerThorsten wants to merge 34 commits into
jupyter-xeus:mainfrom
DerThorsten:libuv
Closed

libuv based event loop / server#681
DerThorsten wants to merge 34 commits into
jupyter-xeus:mainfrom
DerThorsten:libuv

Conversation

@DerThorsten

@DerThorsten DerThorsten commented Dec 17, 2025

Copy link
Copy Markdown
Member

based on #620, but #620 was in a strange "broken" state:

@DerThorsten DerThorsten changed the title lilbuv libuv Dec 17, 2025
@DerThorsten DerThorsten changed the title libuv libuv based event loop / server Dec 17, 2025
Comment thread src/main.cpp Outdated
debugger_config);
xeus::make_file_logger(xeus::xlogger::content, "xeus.log")));
// xpyt::make_python_debugger,
// debugger_config);

@JohanMabille JohanMabille Dec 17, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that a leftover or does the integration of libuv break the debugger?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

atm this is just the result of merging #620 with the most recent changes / to make it build again. So I assume the debugger stuff was not yet tried

@JohanMabille JohanMabille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to be able to switch between concurrency models (i.e. uvloop vs regular multithreaded server) or is uvloop supposed to become the only concurrency model of xeus-python? I will guess the second option (otherwise we would have to provide 4 kernels and it would becoming a mess) but better to ask.

Comment thread src/main.cpp
Comment on lines +106 to +123
{
py::gil_scoped_acquire acquire;

// Create a uvloop and get pointer to the loop
py::module asyncio = py::module::import("asyncio");
py::module uvloop = py::module::import("uvloop");
py::object loop = uvloop.attr("new_event_loop")();
asyncio.attr("set_event_loop")(loop);
py::object py_loop_ptr = uvloop.attr("loop").attr("libuv_get_loop_t_ptr")(loop);

void* raw_ptr = PyCapsule_GetPointer(py_loop_ptr.ptr(), nullptr);
if (!raw_ptr)
{
throw std::runtime_error("Failed to get uvloop pointer");
}

uv_loop_ptr = static_cast<uv_loop_t*>(raw_ptr);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking: This could be moved in a dedicated function.

@DerThorsten DerThorsten closed this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants