Giter Site home page Giter Site logo

kp000vinay / xeus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jupyter-xeus/xeus

0.0 1.0 0.0 5.68 MB

C++ implementation of the Jupyter kernel protocol

License: BSD 3-Clause "New" or "Revised" License

C++ 82.19% CMake 16.73% Python 1.08%

xeus's Introduction

xeus

Travis AppVeyor Documentation Status Join the Gitter Chat

C++ implementation of the Jupyter Kernel protocol

Introduction

xeus is a library meant to facilitate the implementation of kernels for Jupyter. It takes the burden of implementing the Jupyter Kernel protocol so developers can focus on implementing the interpreter part of the kernel.

Several Jupyter kernels are built upon xeus, such as xeus-cling, a kernel for the C++ programming language, and xeus-python, an alternative Python kernel for Jupyter.

Installation

xeus has been packaged on all platforms for the conda package manager.

conda install xeus -c conda-forge

Documentation

To get started with using xeus, check out the full documentation

http://xeus.readthedocs.io/

Usage

xeus enables custom kernel authors to implement Jupyter kernels more easily. It takes the burden of implementing the Jupyter Kernel protocol so developers can focus on implementing the interpreter part of the Kernel.

The easiest way to get started with a new kernel is to inherit from the base interpreter class xeus::xinterpreter and implement the private virtual methods:

  • execute_request_impl
  • complete_request_impl
  • inspect_request_impl
  • is_complete_request_impl

as seen in the documentation.

#include "xeus/xinterpreter.hpp"

#include "nlohmann/json.hpp"

using xeus::xinterpreter;

namespace nl = nlohmann;

namespace custom
{
    class custom_interpreter : public xinterpreter
    {

    public:

        custom_interpreter() = default;
        virtual ~custom_interpreter() = default;

    private:

        void configure() override;

        nl::json execute_request_impl(int execution_counter,
                                      const std::string& code,
                                      bool silent,
                                      bool store_history,
                                      const nl::json::node_type* user_expressions,
                                      bool allow_stdin) override;

        nl::json complete_request_impl(const std::string& code,
                                       int cursor_pos) override;

        nl::json inspect_request_impl(const std::string& code,
                                      int cursor_pos,
                                      int detail_level) override;

        nl::json is_complete_request_impl(const std::string& code) override;

        nl::json kernel_info_request_impl() override;
    };
}

Kernel authors can then rebind to the native APIs of the interpreter that is being interfaced, providing richer information than with the classical approach of a wrapper kernel capturing textual output.

Building from Source

xeus depends on the following libraries: ZeroMQ, cppzmq, OpenSSL, nlohmann_json, and xtl.

xeus ZeroMQ cppzmq xtl nlohmann json OpenSSL
master ^4.2.5 ^4.4.1 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.13 ^4.2.5 ^4.4.1 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.12 ^4.2.5 ^4.4.1 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.11 ^4.2.5 ^4.4.1 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.10 ^4.2.5 ^4.4.1 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.9 ^4.2.5 ^4.4.1 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.8 ^4.2.5 ^4.4.1 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.7 ^4.2.5 ^4.4.1 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.6 ^4.2.5 ^4.4.1 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.5 ^4.2.5 ^4.3.0 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.4 ^4.2.5 ^4.3.0 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.3 ^4.2.5 ^4.3.0 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.2 ^4.2.5 ^4.3.0 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.1 ^4.2.5 ^4.3.0 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1
0.23.0 ^4.2.5 ^4.3.0 >=0.5.0,<0.7.0 ^3.2.0 ^1.0.1

On Linux platforms, xeus also requires libuuid, which is available in all linux distributions (uuid-dev on Debian).

We have packaged all these dependencies for the conda package manager. The simplest way to install them with conda is to run:

conda install cmake pkg-config zeromq cppzmq xtl OpenSSL nlohmann_json -c conda-forge

On Linux platforms, you will also need libuuid:

conda install libuuid -c conda-forge

Once you have installed the dependencies, you can build and install xeus:

cmake -D CMAKE_BUILD_TYPE=Release
make
make install

Installing the Dependencies from Source

The dependencies can also be installed from source. Simply clone the directories and run the following cmake (cmake >= 3.8) and make instructions.

ZeroMQ

ZeroMQ is the messaging library underlying the Jupyter kernel protocol.

cmake -D WITH_PERF_TOOL=OFF -D ZMQ_BUILD_TESTS=OFF -D ENABLE_CPACK=OFF
-D CMAKE_BUILD_TYPE=Release
make
make install

OpenSSL

OpenSSL is packaged for most package managers (apt-get, rpm, conda). We recommend making use of an off-the-shelf build of OpenSSL for your system.

For more information on building OpenSSL, check out the official OpenSSL wiki.

cppzmq

cppzmq is a header only library:

cmake -D CMAKE_BUILD_TYPE=Release
make install

json for modern cpp

nlohmann_json is a header only library

cmake
make install

xtl

xtl is a header only library:

cmake -D CMAKE_BUILD_TYPE
make install

Contributing

See CONTRIBUTING.md to know how to contribute and set up a development environment.

License

We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.

This software is licensed under the BSD-3-Clause license. See the LICENSE file for details.

xeus's People

Contributors

johanmabille avatar sylvaincorlay avatar martinrenou avatar jcfr avatar myd7349 avatar qulogic avatar gouarin avatar bkmgit avatar lilywangl avatar marimeireles avatar m-kus avatar spennihana avatar thibaultlacharme avatar vinyvijayan avatar wolfv avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.