Skip to content

Commit

Permalink
Merge pull request #11 from jupyter-xeus/update_xeus
Browse files Browse the repository at this point in the history
Update xeus
  • Loading branch information
DerThorsten authored Jun 4, 2024
2 parents eca6e07 + 86b2cb0 commit 07fbdc9
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 98 deletions.
75 changes: 7 additions & 68 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,100 +8,39 @@ 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
- name: build
shell: bash -l {0}
run: |
cd bld
make -j8
cmake --build . --target install --config Release
- name: install
shell: bash -l {0}
run: |
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

13 changes: 4 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions include/xeus-wren/xinterpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
13 changes: 9 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@
#include <unistd.h>
#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"
Expand Down Expand Up @@ -102,7 +107,7 @@ int main(int argc, char* argv[])
signal(SIGSEGV, handler);
#endif

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

// Instantiating the xeus xinterpreter
using interpreter_ptr = std::unique_ptr<xeus_wren::interpreter>;
Expand All @@ -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"
Expand All @@ -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 <<
Expand Down
17 changes: 8 additions & 9 deletions src/xinterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 << "\")}";
Expand All @@ -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";
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 07fbdc9

Please sign in to comment.