diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a0b35d4..8bb4e08 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,28 +8,27 @@ on: - main jobs: - unix: + generic: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest] steps: - uses: actions/checkout@v2 - - - name: install mamba - uses: mamba-org/provision-with-micromamba@main + + - name: Install micromamba + uses: mamba-org/setup-micromamba@v1 with: environment-file: environment-dev.yml - environment-name: xeus-wren - - name: cmake configure shell: bash -l {0} run: | mkdir -p bld cd bld cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \ -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX @@ -37,7 +36,7 @@ jobs: shell: bash -l {0} run: | cd bld - make -j8 + cmake --build . --target install --config Release - name: install shell: bash -l {0} @@ -45,63 +44,3 @@ jobs: cd bld make install - # - name: test - # shell: bash -l {0} - # run: | - # cd test - # pytest . --reruns 5 - - win: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ windows-latest] - - steps: - - uses: actions/checkout@v2 - - - name: install mamba - uses: mamba-org/provision-with-micromamba@main - with: - environment-file: environment-dev.yml - environment-name: xeus-wren - - - name: micromamba shell hook - shell: powershell - run: | - micromamba shell hook -s cmd.exe -p C:\Users\runneradmin\micromamba-root - - - name: info - shell: cmd - run: | - call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate xeus-wren - cd %CONDA_PREFIX% - cd Library - cd lib - dir - - - - name: cmake configure - shell: cmd - run: | - call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate xeus-wren - mkdir -p bld - cd bld - cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%CONDA_PREFIX%\Library" -DCMAKE_INSTALL_PREFIX="%CONDA_PREFIX%" -DWREN_LIBRARY="%CONDA_PREFIX%\Library\lib\libwren.lib" - - - name: build - shell: cmd - run: | - call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate xeus-wren - cd bld - set CL=/MP - ninja install - - # - name: test - # shell: cmd - # run: | - # call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xeus-wren - # cd test - # pytest . --reruns 5 - diff --git a/CMakeLists.txt b/CMakeLists.txt index 701214a..35fdc38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,15 +68,10 @@ endif() # Dependencies # ============ -set(xtl_REQUIRED_VERSION 0.7.0) -set(xeus_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) -endif () +set(xeus_REQUIRED_VERSION 5.0.0) +find_package(xeus ${xeus_REQUIRED_VERSION} REQUIRED) + message(STATUS "Before searching for WREN") find_package(WREN REQUIRED) @@ -230,7 +225,7 @@ macro(xeus_wren_create_target target_name linkage output_name) set(XEUS_WREN_XEUS_TARGET xeus-static) endif () - target_link_libraries(${target_name} PUBLIC ${XEUS_WREN_XEUS_TARGET} xtl ) + target_link_libraries(${target_name} PUBLIC ${XEUS_WREN_XEUS_TARGET} ) if (WIN32 OR CYGWIN) # elseif (APPLE) diff --git a/environment-dev.yml b/environment-dev.yml index fb4ec65..6eadce9 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -7,10 +7,10 @@ dependencies: - ninja - cxx-compiler # Host dependencies - - xeus-zmq>=1.0, <2.0 + - xeus>=5.0,<=6 + - xeus-zmq - nlohmann_json - cppzmq - - xtl - wren # Test dependencies - pytest diff --git a/include/xeus-wren/xinterpreter.hpp b/include/xeus-wren/xinterpreter.hpp index df288df..65928a3 100644 --- a/include/xeus-wren/xinterpreter.hpp +++ b/include/xeus-wren/xinterpreter.hpp @@ -46,12 +46,11 @@ namespace xeus_wren 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(send_reply_callback cb, + int execution_counter, + const std::string& code, + xeus::execute_request_config config, + nl::json user_expressions) override; nl::json complete_request_impl(const std::string& code, int cursor_pos) override; diff --git a/src/main.cpp b/src/main.cpp index 4954ed8..5877478 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,9 +21,14 @@ #include #endif +#include "xeus/xeus_context.hpp" #include "xeus/xkernel.hpp" #include "xeus/xkernel_configuration.hpp" -#include "xeus-zmq/xserver_zmq.hpp" +#include "xeus/xserver.hpp" + +#include "xeus-zmq/xserver_zmq_split.hpp" +#include "xeus-zmq/xzmq_context.hpp" + #include "xeus-wren/xinterpreter.hpp" @@ -102,7 +107,7 @@ int main(int argc, char* argv[]) signal(SIGSEGV, handler); #endif - auto context = xeus::make_context(); + std::unique_ptr context = xeus::make_zmq_context(); // Instantiating the xeus xinterpreter using interpreter_ptr = std::unique_ptr; @@ -119,7 +124,7 @@ int main(int argc, char* argv[]) xeus::get_user_name(), std::move(context), std::move(interpreter), - xeus::make_xserver_zmq); + xeus::make_xserver_shell_main); std::cout << "Starting xeus-wren kernel...\n\n" @@ -134,7 +139,7 @@ int main(int argc, char* argv[]) xeus::xkernel kernel(xeus::get_user_name(), std::move(context), std::move(interpreter), - xeus::make_xserver_zmq); + xeus::make_xserver_shell_main); const auto& config = kernel.get_config(); std::cout << diff --git a/src/xinterpreter.cpp b/src/xinterpreter.cpp index ab5e981..1ac945a 100644 --- a/src/xinterpreter.cpp +++ b/src/xinterpreter.cpp @@ -163,16 +163,15 @@ namespace xeus_wren wrenFreeVM(p_vm); } - nl::json interpreter::execute_request_impl(int execution_counter, // Typically the cell number - const std::string& code, // Code to execute - bool /*silent*/, - bool /*store_history*/, - nl::json /*user_expressions*/, - bool /*allow_stdin*/) + void interpreter::execute_request_impl(send_reply_callback cb, + int execution_counter, + const std::string& code, + xeus::execute_request_config /*config*/, + nl::json user_expressions) { nl::json kernel_res; kernel_res["payload"] = nl::json::array(); - kernel_res["user_expressions"] = nl::json::object(); + kernel_res["user_expressions"] =user_expressions; std::stringstream codestream; codestream << "{var closure = Meta.compileExpression(\"" << code << "\")}"; @@ -181,7 +180,7 @@ namespace xeus_wren //WrenInterpretResult result = wrenInterpret(p_vm, "main", codestream.str().c_str()); switch (result) - { + { case WREN_RESULT_COMPILE_ERROR: { kernel_res["status"] = "error"; @@ -214,7 +213,7 @@ namespace xeus_wren //pub_data["text/plain"] = code; publish_execution_result(execution_counter, std::move(pub_data), nl::json()); - return kernel_res; + cb(kernel_res); } void interpreter::configure_impl()