2024-03-02 16:30:03 -05:00
|
|
|
// Copyright (C) 2022-2024 Exaloop Inc. <https://exaloop.io>
|
2022-12-04 16:45:21 -08:00
|
|
|
|
2021-11-01 03:31:24 -07:00
|
|
|
#pragma once
|
2021-11-05 15:26:32 -07:00
|
|
|
#include <codon/compiler/jit.h>
|
2021-11-01 03:31:24 -07:00
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
#include <xeus/xinterpreter.hpp>
|
|
|
|
|
|
|
|
using xeus::xinterpreter;
|
|
|
|
namespace nl = nlohmann;
|
|
|
|
|
|
|
|
namespace codon {
|
|
|
|
class CodonJupyter : public xinterpreter {
|
2021-11-05 15:26:32 -07:00
|
|
|
std::unique_ptr<codon::jit::JIT> jit;
|
2021-11-09 03:47:41 -08:00
|
|
|
std::string argv0;
|
2021-12-06 01:59:32 -08:00
|
|
|
std::vector<std::string> plugins;
|
2021-11-09 03:47:41 -08:00
|
|
|
|
|
|
|
public:
|
2021-12-06 01:59:32 -08:00
|
|
|
CodonJupyter(const std::string &argv0, const std::vector<std::string> &plugins);
|
2021-11-05 15:26:32 -07:00
|
|
|
|
2021-11-01 03:31:24 -07:00
|
|
|
private:
|
|
|
|
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;
|
|
|
|
|
|
|
|
nl::json complete_request_impl(const std::string &code, int cursor_pos) override;
|
|
|
|
|
|
|
|
nl::json inspect_request_impl(const std::string &code, int cursor_pos,
|
|
|
|
int detail_level) override;
|
|
|
|
|
|
|
|
nl::json is_complete_request_impl(const std::string &code) override;
|
|
|
|
|
|
|
|
nl::json kernel_info_request_impl() override;
|
|
|
|
|
|
|
|
void shutdown_request_impl() override;
|
|
|
|
};
|
2021-11-09 03:47:41 -08:00
|
|
|
|
2021-12-06 01:59:32 -08:00
|
|
|
int startJupyterKernel(const std::string &argv0,
|
|
|
|
const std::vector<std::string> &plugins,
|
|
|
|
const std::string &configPath);
|
2021-11-09 03:47:41 -08:00
|
|
|
|
2021-11-01 03:31:24 -07:00
|
|
|
} // namespace codon
|