From 5798315b48dfd32d218f146ec60af0ae057da3fa Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Fri, 12 Apr 2024 12:51:48 +0200 Subject: [PATCH] Upgraded to xeus 4.0 --- CMakeLists.txt | 11 +++++++---- README.md | 2 +- environment-dev.yml | 10 +++++----- src/xpublisher.cpp | 1 - test/CMakeLists.txt | 2 +- test/xmock_interpreter.cpp | 30 ++++++++++++++++-------------- test/xmock_interpreter.hpp | 12 ++++++------ 7 files changed, 36 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b140044..6245d40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,21 +79,24 @@ message(STATUS "XEUS_ZMQ_BUILD_TESTS: ${XEUS_ZMQ_BUILD_TESTS}") # Dependencies # ============ -set(xeus_REQUIRED_VERSION 3.2.0) -set(nlohmann_json_REQUIRED_VERSION 3.11.2) +set(xeus_REQUIRED_VERSION 4.0.3) +set(nlohmann_json_REQUIRED_VERSION 3.11.3) set(cppzmq_REQUIRED_VERSION 4.8.1) set(zeromq_REQUIRED_VERSION 4.3.2) if (NOT TARGET xeus AND NOT TARGET xeus-static) find_package(xeus ${xeus_REQUIRED_VERSION} REQUIRED) + message(STATUS "Found xeus ${xeus_VERSION}") endif () if (NOT TARGET nlohmann_json) find_package(nlohmann_json ${nlohmann_json_REQUIRED_VERSION} REQUIRED) + message(STATUS "Found nlohmann_json ${nlohmann_json_VERSION}") endif () if (NOT TARGET cppzmq AND NOT TARGET cppzmq-static) find_package(cppzmq ${cppzmq_REQUIRED_VERSION} REQUIRED) + message(STATUS "Found cppzmq ${cppzmq_VERSION}") endif () if (NOT TARGET libzmq AND NOT TARGET libzmq-static) @@ -219,10 +222,10 @@ macro(xeus_zmq_create_target target_name linkage output_name) target_link_libraries( ${target_name} - PUBLIC ${CPPZMQ_TARGET_NAME} PUBLIC nlohmann_json::nlohmann_json - PUBLIC OpenSSL::Crypto PUBLIC ${XEUS_TARGET_NAME} + PRIVATE ${CPPZMQ_TARGET_NAME} + PRIVATE OpenSSL::Crypto ) if (NOT MSVC) diff --git a/README.md b/README.md index 15ad4a5..311919c 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ See the [documentation](http://xeus.readthedocs.io/) for an exhaustive list of t | xeus-zmq | xeus | ZeroMQ | cppzmq | nlohmann json | OpenSSL | xtl | |----------|---------|---------|---------|---------------|---------|----------------| -| master | ^3.1.1 | ^4.2.5 | ^4.8.1 | ^3.2.0 | ^3.0 | >=0.7.0,<0.8.0 | +| main | ^4.0.0 | ^4.2.5 | ^4.8.1 | ^3.11.3 | ^3.0 | >=0.7.0,<0.8.0 | | 1.x | ^3.0.0 | ^4.2.5 | ^4.8.1 | ^3.2.0 | ^3.0 | >=0.7.0,<0.8.0 | diff --git a/environment-dev.yml b/environment-dev.yml index 77d5403..3ed467e 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -8,14 +8,14 @@ dependencies: - pkg-config - ninja # Host dependencies - - zeromq=4.3.4 - - zeromq-static=4.3.4 - - cppzmq=4.8.1 + - zeromq + - zeromq-static + - cppzmq - xtl=0.7 - - xeus>=3.2.0,<4.0 + - xeus>=4.0.3,<5.0 - OpenSSL=1 - libopenssl-static=1 - - nlohmann_json=3.11.2 + - nlohmann_json=3.11.3 # Test dependencies - doctest >= 2.4.6 - pytest diff --git a/src/xpublisher.cpp b/src/xpublisher.cpp index c14b5c6..38c2dac 100644 --- a/src/xpublisher.cpp +++ b/src/xpublisher.cpp @@ -7,7 +7,6 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#include #include #include "xmiddleware_impl.hpp" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b1153e5..a8d938a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -189,4 +189,4 @@ if (FALSE) target_link_libraries(test_client_ipc PRIVATE ${xeus-zmq_TARGET} Threads::Threads) target_compile_features(test_client_ipc PRIVATE cxx_std_17) -endif (UNIX) +endif (FALSE) diff --git a/test/xmock_interpreter.cpp b/test/xmock_interpreter.cpp index 078e80b..cde64a6 100644 --- a/test/xmock_interpreter.cpp +++ b/test/xmock_interpreter.cpp @@ -29,21 +29,21 @@ namespace xeus using function_type = std::function; } - nl::json xmock_interpreter::execute_request_impl(int execution_counter, - const std::string& code, - bool /* silent */, - bool /* store_history */, - nl::json /* user_expressions */, - bool /* allow_stdin */) + void xmock_interpreter::execute_request_impl(xrequest_context request_context, + send_reply_callback cb, + int execution_counter, + const std::string& code, + execute_request_config /*config*/, + nl::json /*user_expressions*/) { if (code.compare("hello, world") == 0) { - publish_stream("stdout", code); + publish_stream(request_context, "stdout", code); } if (code.compare("error") == 0) { - publish_stream("stderr", code); + publish_stream(request_context, "stderr", code); } if (code.compare("?") == 0) @@ -61,14 +61,16 @@ namespace xeus {"start", 0} }); - return xeus::create_successful_reply(payload); + cb(xeus::create_successful_reply(payload)); } + else + { + nl::json pub_data; + pub_data["text/plain"] = code; + publish_execution_result(request_context, execution_counter, std::move(pub_data), nl::json::object()); - nl::json pub_data; - pub_data["text/plain"] = code; - publish_execution_result(execution_counter, std::move(pub_data), nl::json::object()); - - return xeus::create_successful_reply(); + cb(xeus::create_successful_reply()); + } } nl::json xmock_interpreter::complete_request_impl(const std::string& /* code */, diff --git a/test/xmock_interpreter.hpp b/test/xmock_interpreter.hpp index d5bd413..46c7c2c 100644 --- a/test/xmock_interpreter.hpp +++ b/test/xmock_interpreter.hpp @@ -25,12 +25,12 @@ namespace xeus void configure_impl() override; - nl::json execute_request_impl(int execution_counter, - const std::string& code, - bool silent, - bool store_history, - nl::json user_expressions, - bool allow_stdin) override; + void execute_request_impl(xrequest_context request_context, + send_reply_callback cb, + int execution_counter, + const std::string& code, + execute_request_config config, + nl::json user_expressions) override; nl::json complete_request_impl(const std::string& code, int cursor_pos) override;