Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 3 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,9 @@ endif()
# Dependencies
# ============

set(xtl_REQUIRED_VERSION 0.7.0)
set(xeus_REQUIRED_VERSION 3.2.0)
set(xeus_zmq_REQUIRED_VERSION 1.0.2)
set(xeus_REQUIRED_VERSION 5.0.0)
set(xeus_zmq_REQUIRED_VERSION 3.0.0)

if (NOT TARGET xtl)
find_package(xtl ${xtl_REQUIRED_VERSION} REQUIRED)
endif ()
if (NOT TARGET xeus AND NOT TARGET xeus-static)
find_package(xeus ${xeus_REQUIRED_VERSION} REQUIRED)
if (xeus_FOUND)
Expand Down Expand Up @@ -304,7 +300,7 @@ macro(xeus_cpp_create_target target_name linkage output_name)
set(XEUS_CPP_XEUS_TARGET xeus-static)
endif ()

target_link_libraries(${target_name} PUBLIC ${XEUS_CPP_XEUS_TARGET} clangCppInterOp pugixml argparse::argparse xtl)
target_link_libraries(${target_name} PUBLIC ${XEUS_CPP_XEUS_TARGET} clangCppInterOp pugixml argparse::argparse)

if (WIN32 OR CYGWIN)
#
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,25 @@ http://xeus-cpp.readthedocs.io

`xeus-cpp` depends on


- [xeus-zmq](https://github.com/jupyter-xeus/xeus-zmq)
- [xtl](https://github.com/xtensor-stack/xtl)
- [nlohmann_json](https://github.com/nlohmann/json)
- [cppzmq](https://github.com/zeromq/cppzmq)
- [clang](https://github.com/llvm/llvm-project/)
- [argparse](https://github.com/p-ranav/argparse)
- [CppInterOp](https://github.com/compiler-research/CppInterOp)

| `xeus-cpp` | `xeus-zmq` | `CppInterOp` | `pugixml` | `cppzmq` | `cpp-argparse`| `nlohmann_json` |
|------------|-----------------|--------------|-----------|----------|---------------|-----------------|
| main | >=3.0.0,<4.0.0 | >=1.3.0 | ~1.8.1 | ~4.3.0 | <3.1 | >=3.11.3,<4.0 |

Versions prior to `main` have an additional dependency on [xtl](https://github.com/xtensor-stack/xtl) & [clang](https://github.com/llvm/llvm-project/).

| `xeus-cpp` | `xeus-zmq` | `xtl` | `CppInterOp` | `clang` | `pugixml` | `cppzmq` | `cpp-argparse`| `nlohmann_json` |
|------------|-----------------|-----------------|--------------|-----------|-----------|----------|---------------|-----------------|
| main | >=1.0.2,<2.0.0 | >=0.7.7,<0.8.0 | >=1.3.0 | | ~1.8.1 | ~4.3.0 | <3.1 | >=3.11.2,<4.0 |
| 0.4.0 | >=1.0.0,<2.0.0 | >=0.7.7,<0.8.0 | | >=16,<17 | ~1.8.1 | ~4.3.0 | ~2.9 | >=3.6.1,<4.0 |
| 0.3.0 | >=1.0.0,<2.0.0 | >=0.7.7,<0.8.0 | | >=16,<17 | ~1.8.1 | ~4.3.0 | ~2.9 | >=3.6.1,<4.0 |
| 0.2.0 | >=1.0.0,<2.0.0 | >=0.7.7,<0.8.0 | | >=16,<17 | ~1.8.1 | ~4.3.0 | ~2.9 | >=3.6.1,<4.0 |
| 0.1.0 | >=1.0.0,<2.0.0 | >=0.7.0,<0.8.0 | | >=16,<17 | ~1.8.1 | ~4.3.0 | ~2.9 | >=3.6.1,<4.0 |
| `xeus-cpp` | `xeus-zmq` | `xtl` | `clang` | `pugixml` | `cppzmq` | `cpp-argparse`| `nlohmann_json` |
|------------|-----------------|-----------------|-----------|-----------|----------|---------------|-----------------|
| 0.4.0 | >=1.0.0,<2.0.0 | >=0.7.7,<0.8.0 | >=16,<17 | ~1.8.1 | ~4.3.0 | ~2.9 | >=3.6.1,<4.0 |
| 0.3.0 | >=1.0.0,<2.0.0 | >=0.7.7,<0.8.0 | >=16,<17 | ~1.8.1 | ~4.3.0 | ~2.9 | >=3.6.1,<4.0 |
| 0.2.0 | >=1.0.0,<2.0.0 | >=0.7.7,<0.8.0 | >=16,<17 | ~1.8.1 | ~4.3.0 | ~2.9 | >=3.6.1,<4.0 |
| 0.1.0 | >=1.0.0,<2.0.0 | >=0.7.0,<0.8.0 | >=16,<17 | ~1.8.1 | ~4.3.0 | ~2.9 | >=3.6.1,<4.0 |

## Contributing

Expand Down
8 changes: 4 additions & 4 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ dependencies:
- cmake
- cxx-compiler
# Host dependencies
- xeus-zmq >=1.0.2,<2.0
- nlohmann_json=3.11.2
- xeus>=5.0.0
- xeus-zmq>=3.0,<4.0
- nlohmann_json=3.11.3
- cppzmq
- xtl
- CppInterOp>=1.3.0
- pugixml
- cpp-argparse <3.1
- zlib
# Test dependencies
- pytest
- jupyter_kernel_test>=0.4.3
- jupyter_kernel_test>=0.5,<0.6
- nbval
- pytest-rerunfailures
- doctest
5 changes: 2 additions & 3 deletions environment-wasm-host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ channels:
- https://repo.mamba.pm/conda-forge
dependencies:
- nlohmann_json
- xeus-lite <2.0
- xeus >=3.2.0,<4.0
- xtl >=0.7,<0.8
- xeus-lite
- xeus
- CppInterOp>=1.3.0
- cpp-argparse
- pugixml
9 changes: 4 additions & 5 deletions include/xeus-cpp/xinterpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ namespace xcpp

void configure_impl() override;

nl::json execute_request_impl(
void execute_request_impl(
send_reply_callback cb,
int execution_counter,
const std::string& code,
bool silent,
bool store_history,
nl::json user_expressions,
bool allow_stdin
xeus::execute_request_config config,
nl::json user_expressions
) override;

nl::json complete_request_impl(const std::string& code, int cursor_pos) override;
Expand Down
8 changes: 4 additions & 4 deletions notebooks/xeus-cpp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@
"\n",
"#include \"nlohmann/json.hpp\"\n",
"\n",
"#include \"xtl/xbase64.hpp\"\n",
"#include \"xeus/xbase64.hpp\"\n",
"\n",
"namespace nl = nlohmann;\n",
"\n",
Expand All @@ -499,7 +499,7 @@
" nl::json mime_bundle_repr(const image& i)\n",
" {\n",
" auto bundle = nl::json::object();\n",
" bundle[\"image/png\"] = xtl::base64encode(i.m_buffer.str());\n",
" bundle[\"image/png\"] = xeus::base64encode(i.m_buffer.str());\n",
" return bundle;\n",
" }\n",
"}"
Expand Down Expand Up @@ -579,7 +579,7 @@
"\n",
"#include \"nlohmann/json.hpp\"\n",
"\n",
"#include \"xtl/xbase64.hpp\"\n",
"#include \"xeus/xbase64.hpp\"\n",
"\n",
"namespace nl = nlohmann;\n",
"\n",
Expand All @@ -601,7 +601,7 @@
" auto bundle = nl::json::object();\n",
" bundle[\"text/html\"] =\n",
" std::string(\"<audio controls=\\\"controls\\\"><source src=\\\"data:audio/wav;base64,\")\n",
" + xtl::base64encode(a.m_buffer.str()) +\n",
" + xeus::base64encode(a.m_buffer.str()) +\n",
" \"\\\" type=\\\"audio/wav\\\" /></audio>\";\n",
" return bundle;\n",
" }\n",
Expand Down
10 changes: 7 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <xeus/xkernel.hpp>
#include <xeus/xkernel_configuration.hpp>

#include "xeus-zmq/xzmq_context.hpp"
#include <xeus-zmq/xserver_zmq.hpp>

#include "xeus-cpp/xeus_cpp_config.hpp"
Expand Down Expand Up @@ -61,18 +62,20 @@ int main(int argc, char* argv[])

interpreter_ptr interpreter = xcpp::build_interpreter(argc, argv);

auto context = xeus::make_context<zmq::context_t>();
// auto context = xeus::make_context<zmq::context_t>();
std::unique_ptr<xeus::xcontext> context = xeus::make_zmq_context();

if (!file_name.empty())
{
xeus::xconfiguration config = xeus::load_configuration(file_name);

std::clog << "Instantiating kernel" << std::endl;
xeus::xkernel kernel(
config,
xeus::get_user_name(),
std::move(context),
std::move(interpreter),
xeus::make_xserver_zmq,
xeus::make_xserver_default,
xeus::make_in_memory_history_manager(),
xeus::make_console_logger(
xeus::xlogger::msg_type,
Expand All @@ -94,14 +97,15 @@ int main(int argc, char* argv[])
xeus::get_user_name(),
std::move(context),
std::move(interpreter),
xeus::make_xserver_zmq,
xeus::make_xserver_default,
xeus::make_in_memory_history_manager(),
xeus::make_console_logger(
xeus::xlogger::msg_type,
xeus::make_file_logger(xeus::xlogger::content, "xeus.log")
)
);

std::cout << "Getting config" << std::endl;
const auto& config = kernel.get_config();
std::clog << "Starting xcpp kernel...\n\n"
"If you want to connect to this kernel from an other client, just copy"
Expand Down
2 changes: 0 additions & 2 deletions src/xinspect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

#include <pugixml.hpp>

#include <xtl/xsystem.hpp>

#include "xeus-cpp/xbuffer.hpp"
#include "xeus-cpp/xpreamble.hpp"

Expand Down
30 changes: 15 additions & 15 deletions src/xinterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <string>
#include <vector>

#include <xtl/xsystem.hpp>
#include "xeus/xsystem.hpp"

#include <xeus/xhelper.hpp>

Expand Down Expand Up @@ -127,27 +127,27 @@ __get_cxx_version ()
restore_output();
}

nl::json interpreter::execute_request_impl(
int /*execution_counter*/,
void interpreter::execute_request_impl(
send_reply_callback cb,
int /*execution_count*/,
const std::string& code,
bool silent,
bool /*store_history*/,
nl::json /*user_expressions*/,
bool allow_stdin
xeus::execute_request_config config,
nl::json /*user_expressions*/
)
{
nl::json kernel_res;


auto input_guard = input_redirection(allow_stdin);
auto input_guard = input_redirection(config.allow_stdin);

// Check for magics
for (auto& pre : preamble_manager.preamble)
{
if (pre.second.is_match(code))
{
pre.second.apply(code, kernel_res);
return kernel_res;
cb(kernel_res);
return;
}
}

Expand All @@ -162,7 +162,7 @@ __get_cxx_version ()
auto cout_strbuf = std::cout.rdbuf();
auto cerr_strbuf = std::cerr.rdbuf();

if (silent)
if (config.silent)
{
auto null = xnull();
std::cout.rdbuf(&null);
Expand Down Expand Up @@ -202,7 +202,7 @@ __get_cxx_version ()
std::cerr << std::flush;

// Reset non-silent output buffers
if (silent)
if (config.silent)
{
std::cout.rdbuf(cout_strbuf);
std::cerr.rdbuf(cerr_strbuf);
Expand All @@ -221,7 +221,7 @@ __get_cxx_version ()
ename = " ";
}
std::vector<std::string> traceback({ename + evalue});
if (!silent)
if (!config.silent)
{
publish_execution_error(ename, evalue, traceback);
}
Expand All @@ -237,7 +237,7 @@ __get_cxx_version ()
/*
// Publish a mime bundle for the last return value if
// the semicolon was omitted.
if (!silent && output.hasValue() && trim(code).back() != ';')
if (!config.silent && output.hasValue() && trim(code).back() != ';')
{
nl::json pub_data = mime_repr(output);
publish_execution_result(execution_counter, std::move(pub_data), nl::json::object());
Expand All @@ -248,7 +248,7 @@ __get_cxx_version ()
kernel_res["payload"] = nl::json::array();
kernel_res["user_expressions"] = nl::json::object();
}
return kernel_res;
cb(kernel_res);
}

nl::json interpreter::complete_request_impl(const std::string& code, int cursor_pos)
Expand Down Expand Up @@ -387,7 +387,7 @@ __get_cxx_version ()

void interpreter::init_includes()
{
Cpp::AddIncludePath((xtl::prefix_path() + "/include/").c_str());
Cpp::AddIncludePath((xeus::prefix_path() + "/include/").c_str());
}

void interpreter::init_preamble()
Expand Down
Loading