Skip to content

Commit 80d9f02

Browse files
update xeus 5 (#88)
update xeus 5 --------- Co-authored-by: Johan Mabille <johan.mabille@gmail.com>
1 parent 4189a98 commit 80d9f02

File tree

8 files changed

+42
-48
lines changed

8 files changed

+42
-48
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12]
25+
os: [ubuntu-22.04, macos-12]
2626
build_type: [static_build, shared_build]
2727

2828
steps:
@@ -79,7 +79,7 @@ jobs:
7979
strategy:
8080
fail-fast: false
8181
matrix:
82-
os: [windows-2019, windows-2022]
82+
os: [windows-2022]
8383
build_type: [static_build, shared_build]
8484

8585
steps:
@@ -116,6 +116,7 @@ jobs:
116116
-DCMAKE_BUILD_TYPE=Release ^
117117
-DCMAKE_INSTALL_PREFIX="%CONDA_PREFIX%\Library" ^
118118
-DXEXTRA_JUPYTER_DATA_DIR=%CONDA_PREFIX%\share\jupyter ^
119+
-D CMAKE_CXX_FLAGS=" /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" ^
119120
-D XSQL_BUILD_TESTS=ON ^
120121
${{ env.CMAKE_EXTRA_ARGS }}
121122
working-directory: build

CMakeLists.txt

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ set(xeus-zmq_REQUIRED_VERSION 1.1.1)
6363
find_package(xeus-zmq ${xeus-zmq_REQUIRED_VERSION} REQUIRED)
6464
find_package(xvega)
6565

66-
find_package(tabulate REQUIRED)
66+
#find_package(tabulate REQUIRED)
6767
find_package(Threads REQUIRED)
6868

6969
find_package(Soci REQUIRED MODULE)
@@ -130,22 +130,10 @@ macro(xsql_set_common_options target_name)
130130
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
131131
CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
132132
CMAKE_CXX_COMPILER_ID MATCHES "Intel")
133-
134133
target_compile_options(${target_name} PUBLIC -Wunused-parameter -Wextra -Wreorder)
135-
136-
# C++14 flag, setting this flag is failing on Clang
137-
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
138-
CHECK_CXX_COMPILER_FLAG("-std=c++14" HAS_CPP14_FLAG)
139-
if (HAS_CPP14_FLAG)
140-
target_compile_features(${target_name} PRIVATE cxx_std_14)
141-
else ()
142-
message(FATAL_ERROR "Unsupported compiler -- xeus-sql requires C++14 support!")
143-
endif ()
144-
else ()
145-
target_compile_features(${target_name} PRIVATE cxx_std_14)
146-
endif ()
134+
endif ()
147135

148-
endif ()
136+
target_compile_features(${target_name} PRIVATE cxx_std_17)
149137

150138
if (APPLE)
151139
set_target_properties(${target_name} PROPERTIES

environment-dev.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ dependencies:
1111
- cppzmq
1212
- nlohmann_json
1313
- soci-core
14-
- xeus-zmq=1.1.1
15-
- xproperty=0.11.0
16-
- xtl
17-
- xvega-bindings=0.0.10
18-
- xvega=0.0.10
14+
- xeus>=5.0,<=6
15+
- xeus-zmq
16+
- xproperty
17+
- xvega-bindings>=0.1.0
18+
- xvega=>0.1.0
1919
# Test dependencies
2020
- doctest >= 2.4.6

include/xeus-sql/xeus_sql_interpreter.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ namespace xeus_sql
3131

3232
private:
3333
void configure_impl() override;
34-
nl::json execute_request_impl(int execution_counter,
35-
const std::string& code,
36-
bool silent,
37-
bool store_history,
38-
nl::json user_expressions,
39-
bool allow_stdin) override;
34+
void execute_request_impl(send_reply_callback cb,
35+
int /*execution_counter*/,
36+
const std::string& /*code*/,
37+
xeus::execute_request_config /*config*/,
38+
nl::json /*user_expressions*/) override;
4039
nl::json complete_request_impl(const std::string& code,
4140
int cursor_pos) override;
4241
nl::json inspect_request_impl(const std::string& code,

src/main.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
#include "xeus/xkernel.hpp"
2222
#include "xeus/xkernel_configuration.hpp"
2323

24-
#include "xeus-zmq/xserver_shell_main.hpp"
24+
#include "xeus-zmq/xserver_zmq_split.hpp"
25+
#include "xeus-zmq/xzmq_context.hpp"
2526

2627
#include "xeus-sql/xeus_sql_interpreter.hpp"
2728

@@ -79,7 +80,7 @@ int main(int argc, char* argv[])
7980
// Load configuration file
8081
std::string file_name = extract_filename(argc, argv);
8182

82-
auto context = xeus::make_context<zmq::context_t>();
83+
std::unique_ptr<xeus::xcontext> context = xeus::make_zmq_context();
8384

8485
// Create interpreter instance
8586
using interpreter_ptr = std::unique_ptr<xeus_sql::interpreter>;

src/xeus_sql_interpreter.cpp

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,17 @@ namespace xeus_sql
178178
return pub_data;
179179
}
180180

181-
nl::json interpreter::execute_request_impl(int execution_counter,
182-
const std::string& code,
183-
bool /*silent*/,
184-
bool /*store_history*/,
185-
nl::json /*user_expressions*/,
186-
bool /*allow_stdin*/)
181+
void interpreter::execute_request_impl(send_reply_callback cb,
182+
int execution_counter,
183+
const std::string& code,
184+
xeus::execute_request_config /*config*/,
185+
nl::json user_expressions)
187186
{
188-
auto ok = []() {
187+
auto ok = [&]() {
189188
nl::json jresult;
190189
jresult["status"] = "ok";
191190
jresult["payload"] = nl::json::array();
192-
jresult["user_expressions"] = nl::json::object();
191+
jresult["user_expressions"] = user_expressions;
193192
return jresult;
194193
};
195194

@@ -247,7 +246,8 @@ namespace xeus_sql
247246
std::move(chart),
248247
nl::json::object());
249248

250-
return ok();
249+
cb(ok());
250+
return;
251251
} else if (xv_bindings::case_insentive_equals("VEGA_LITE", tokenized_input[0])) {
252252
if (tokenized_input.size() < 2) {
253253
throw std::runtime_error("invalid input: " + code);
@@ -269,7 +269,8 @@ namespace xeus_sql
269269
auto bundle = nl::json::object();
270270
bundle["text/plain"] = "SET " + spec_name + " success.";
271271
publish_execution_result(execution_counter, std::move(bundle), nl::json::object());
272-
return ok();
272+
cb(ok());
273+
return;
273274
}
274275
nl::json j;
275276
auto v = specs.find(tokenized_input[1]);
@@ -297,7 +298,8 @@ namespace xeus_sql
297298
auto bundle = nl::json::object();
298299
bundle["application/vnd.vegalite.v3+json"] = j;
299300
publish_execution_result(execution_counter, std::move(bundle), nl::json::object());
300-
return ok();
301+
cb(ok());
302+
return;
301303
}
302304

303305
/* Parses LOAD magic */
@@ -334,18 +336,18 @@ namespace xeus_sql
334336
}
335337
}
336338
} catch (const std::runtime_error &err) {
337-
return handle_exception((std::string)err.what());
339+
cb(handle_exception((std::string)err.what()));
338340
#ifdef USE_POSTGRE_SQL
339341
} catch (const soci::postgresql_soci_error &err) {
340-
return handle_exception((std::string)err.what());
342+
cb(handle_exception((std::string)err.what()));
341343
#endif
342344
#ifdef USE_MYSQL
343345
} catch (const soci::mysql_soci_error &err) {
344-
return handle_exception((std::string)err.what());
346+
cb(handle_exception((std::string)err.what()));
345347
#endif
346348
#ifdef USE_SQLITE3
347349
} catch (const soci::sqlite3_soci_error &err) {
348-
return handle_exception((std::string)err.what());
350+
cb(handle_exception((std::string)err.what()));
349351
#endif
350352
} catch (...) {
351353
// https: // stackoverflow.com/a/54242936/1203241
@@ -355,10 +357,11 @@ namespace xeus_sql
355357
std::rethrow_exception(curr_excp);
356358
}
357359
} catch (const std::exception &err) {
358-
return handle_exception((std::string)err.what());
360+
cb(handle_exception((std::string)err.what()));
359361
}
360362
}
361-
return ok();
363+
cb(ok());
364+
return;
362365
}
363366
nl::json interpreter::complete_request_impl(const std::string& raw_code,
364367
int cursor_pos)

test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ set_target_properties(test_xeus_sql PROPERTIES
5959
INSTALL_RPATH_USE_LINK_PATH TRUE
6060
)
6161

62+
target_compile_features(test_xeus_sql PRIVATE cxx_std_17)
63+
6264
if (XSQL_BUILD_SHARED)
6365
set(XSQL_TEST_LINK_TARGET xeus-sql)
6466
else()

xeus-sqlConfig.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ find_dependency(mysql)
3232
find_dependency(PostgreSQL)
3333

3434
find_dependency(Threads @Threads_REQUIRED_VERSION@)
35-
find_dependency(tabulate @tabulate_REQUIRED_VERSION@)
35+
#find_dependency(tabulate @tabulate_REQUIRED_VERSION@)
3636

3737
if (NOT TARGET xeus-sql)
3838
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")

0 commit comments

Comments
 (0)