Xeus 2.0

Announcing a major release of the Xeus library

We have just released Xeus 2. This is a major release of the library. While it includes backward-incompatible changes, they are very limited and upgrading your kernels should be relatively easy.

How to upgrade Xeus-based kernels

Let’s illustrate that with the code of a simple kernel before and after upgrading to Version 2. Most typically, only the kernel’s main file will have to be updated:

 25 diff --git a/example/src/main.cpp b/example/src/main.cpp
 26 index 29de437..eb8fdba 100644
 27 --- a/example/src/main.cpp
 28 +++ b/example/src/main.cpp
 29 @@ -21,12 +21,14 @@ int main(int argc, char* argv[])
 30      std::string file_name = (argc == 1) ? "connection.json" : argv[2];
 31      xeus::xconfiguration config = xeus::load_configuration(file_name);
 32 
 33 +    auto context = xeus::make_context<zmq::context_t>();
 34 +
 35      // Create interpreter instance
 36      using interpreter_ptr = std::unique_ptr<custom::custom_interpreter>;
 37      interpreter_ptr interpreter = interpreter_ptr(new custom::custom_interpreter());
 38 
 39      // Create kernel instance and start it
 40 -    xeus::xkernel kernel(config, xeus::get_user_name(), std::move(interpreter), xeus::make_xs    erver_zmq);
 41 +    xeus::xkernel kernel(config, xeus::get_user_name(), std::move(context), std::move(interpr    eter), xeus::make_xserver_zmq);
 42      kernel.start();
 43 
 44      return 0;

The first change is that you now have to instantiate and pass an additional argument to the kernel constructor: the context. Fortunately, Xeus provides a function to build such a context object, making the update straightforward. We will detail the reason for this change in the next section.

The second change is that the kernel constructor now requires a function to build the server while a default value was provided for it in Xeus 1.x. Again, the motivations for this change will be detailed in the next section. Finally the functions for building the servers have moved to different headers.

To summarize, here is the list of the breaking changes:

Motivation for these changes

When we created Xeus, kernels were expected to run in separate processes. The communication between the kernels and the client was achieved with the ZeroMQ middleware framework, and it was natural to heavily rely on it in Xeus.

Recent developments have pushed in a different direction, where the kernel can run directly in the browser. In that case, a middleware library is not required anymore to communicate with the frontend. The architecture of Xeus was not suitable for this new kind of kernels. An update was required so that it is possible to build Xeus without the dependency on ZeroMQ.

About the developers

Johan Mabille is a scientific software developer at QuantStack. Johan is a co-author of Xeus, and developed the debugger extension to xeus-python.

.

Sylvain Corlay is the founder and CEO of QuantStack, and a core Jupyter developer. He co-authored Xeus and xeus-python.