Skip to content

Commit

Permalink
Upgraded to xeus 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanMabille committed Apr 15, 2024
1 parent c4cf0b7 commit 5798315
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 32 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
10 changes: 5 additions & 5 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/xpublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#include <iostream>
#include <string>

#include "xmiddleware_impl.hpp"
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
30 changes: 16 additions & 14 deletions test/xmock_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ namespace xeus
using function_type = std::function<void(xeus::xcomm&&, const xeus::xmessage&)>;
}

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)
Expand All @@ -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 */,
Expand Down
12 changes: 6 additions & 6 deletions test/xmock_interpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5798315

Please sign in to comment.