Skip to content

Commit 73bc4e3

Browse files
authored
xeus 4.0 updates (#12)
* using 4.0.1
1 parent b7ec81f commit 73bc4e3

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

BuildWasmDockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN cd /deps/xtl/build && \
2929
# nloman json
3030
##################################################################
3131
RUN mkdir -p /deps/nlohmannjson/build && \
32-
git clone --branch v3.9.1 --depth 1 https://github.com/nlohmann/json.git /deps/nlohmannjson/src
32+
git clone --branch v3.11.3 --depth 1 https://github.com/nlohmann/json.git /deps/nlohmannjson/src
3333

3434
RUN cd /deps/nlohmannjson/build && \
3535
emcmake cmake ../src/ -DCMAKE_INSTALL_PREFIX=/install -DJSON_BuildTests=OFF
@@ -42,14 +42,14 @@ RUN cd /deps/nlohmannjson/build && \
4242
##################################################################
4343

4444
RUN mkdir -p /deps/xeus/build
45-
RUN git clone --branch 3.2.0 https://github.com/jupyter-xeus/xeus.git /deps/xeus/src
45+
RUN git clone --branch 4.0.1 https://github.com/jupyter-xeus/xeus.git /deps/xeus/src
4646

4747
#COPY xeus /deps/xeus/src
4848

4949
RUN cd /deps/xeus/build && \
5050
emcmake cmake ../src \
5151
-DCMAKE_INSTALL_PREFIX=/install \
52-
-Dnlohmann_json_DIR=/install/lib/cmake/nlohmann_json \
52+
-Dnlohmann_json_DIR=/install/share/cmake/nlohmann_json \
5353
-Dxtl_DIR=/install/share/cmake/xtl \
5454
-DXEUS_EMSCRIPTEN_WASM_BUILD=ON
5555

@@ -68,7 +68,7 @@ ADD ./test /test
6868
RUN mkdir -p /xeus-build && cd /xeus-build && \
6969
emcmake cmake .. \
7070
-DCMAKE_INSTALL_PREFIX=/install \
71-
-Dnlohmann_json_DIR=/install/lib/cmake/nlohmann_json \
71+
-Dnlohmann_json_DIR=/install/share/cmake/nlohmann_json \
7272
-Dxtl_DIR=/install/share/cmake/xtl \
7373
-Dxeus_DIR=/install/lib/cmake/xeus \
7474
-DXEUS_LITE_BUILD_BROWSER_TEST_KERNEL=ON \

CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,8 @@ message(STATUS "XEUS_LITE_BUILD_NODE_TESTS: ${XEUS_LITE_BUILD_NOD
5454
# Dependencies
5555
# ============
5656

57-
set(nlohmann_json_REQUIRED_VERSION 3.2.0)
5857
set(xtl_REQUIRED_VERSION 0.7)
59-
set(xeus_REQUIRED_VERSION 3.2.0)
60-
61-
if (NOT TARGET nlohmann_json)
62-
find_package(nlohmann_json ${nlohmann_json_REQUIRED_VERSION} REQUIRED)
63-
endif ()
58+
set(xeus_REQUIRED_VERSION 4.0.0)
6459

6560
if (NOT TARGET xtl)
6661
find_package(xtl ${xtl_REQUIRED_VERSION} REQUIRED)
@@ -98,7 +93,6 @@ target_include_directories(
9893
)
9994
target_link_libraries(
10095
xeus-lite
101-
PUBLIC nlohmann_json::nlohmann_json
10296
PUBLIC xtl
10397
PUBLIC xeus-static
10498
)

include/xeus-lite/xembind.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ namespace ems = emscripten;
2525
namespace xeus
2626
{
2727

28+
struct empty_context_tag
29+
{
30+
};
31+
2832
void buffer_sequence_from_js_buffer(buffer_sequence& self, ems::val buffers);
2933
xmessage xmessage_from_js_message(ems::val js_message);
3034
ems::val js_message_from_xmessage(const xmessage & message, bool copy);
@@ -46,7 +50,7 @@ namespace xeus
4650
using interpreter_ptr = std::unique_ptr<interpreter_type>;
4751

4852
auto interpreter = interpreter_ptr(new interpreter_type());
49-
auto context = xeus::make_empty_context();
53+
auto context = std::make_unique<xeus::xcontext_impl<empty_context_tag>>();
5054

5155
xeus::xkernel * kernel = new xeus::xkernel(config,
5256
xeus::get_user_name(),

test/xmock_interpreter.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ namespace xeus
2929
using function_type = std::function<void(xeus::xcomm&&, const xeus::xmessage&)>;
3030
}
3131

32-
nl::json xmock_interpreter::execute_request_impl(int execution_counter,
33-
const std::string& code,
34-
bool /* silent */,
35-
bool /* store_history */,
36-
nl::json /* user_expressions */,
37-
bool /* allow_stdin */)
32+
void xmock_interpreter::execute_request_impl(xrequest_context request_context,
33+
send_reply_callback cb,
34+
int execution_counter,
35+
const std::string& code,
36+
execute_request_config config,
37+
nl::json /* user_expressions */)
3838
{
3939
if (code.compare("hello, world") == 0)
4040
{
41-
publish_stream("stdout", code);
41+
publish_stream(request_context, "stdout", code);
4242
}
4343

4444
if (code.compare("error") == 0)
4545
{
46-
publish_stream("stderr", code);
46+
publish_stream(request_context, "stderr", code);
4747
}
4848

4949
if (code.compare("?") == 0)
@@ -61,14 +61,16 @@ namespace xeus
6161
{"start", 0}
6262
});
6363

64-
return xeus::create_successful_reply(payload);
64+
cb(xeus::create_successful_reply(payload));
65+
return;
6566
}
6667

6768
nl::json pub_data;
6869
pub_data["text/plain"] = code;
69-
publish_execution_result(execution_counter, std::move(pub_data), nl::json::object());
70+
publish_execution_result(request_context, execution_counter, std::move(pub_data), nl::json::object());
7071

71-
return xeus::create_successful_reply();
72+
cb(xeus::create_successful_reply());
73+
return;
7274
}
7375

7476
nl::json xmock_interpreter::complete_request_impl(const std::string& /* code */,

test/xmock_interpreter.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@ namespace xeus
2121
xmock_interpreter() = default;
2222
virtual ~xmock_interpreter() = default;
2323

24+
2425
private:
2526

2627
void configure_impl() override;
2728

28-
nl::json execute_request_impl(int execution_counter,
29-
const std::string& code,
30-
bool silent,
31-
bool store_history,
32-
nl::json user_expressions,
33-
bool allow_stdin) override;
29+
void execute_request_impl(xrequest_context context,
30+
send_reply_callback cb,
31+
int execution_counter,
32+
const std::string& code,
33+
execute_request_config config,
34+
nl::json user_expressions) override;
3435

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

xeus-liteConfig.cmake.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR};${CMAKE_MODULE_PATH}")
2424

2525
include(CMakeFindDependencyMacro)
2626
find_dependency(xtl @xtl_REQUIRED_VERSION@)
27-
find_dependency(nlohmann_json @nlohmann_json_REQUIRED_VERSION@)
2827
find_dependency(xeus @xeus_REQUIRED_VERSION@)
2928

3029
if(NOT TARGET xeus-lite)

0 commit comments

Comments
 (0)