-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] supporting cppyy #248
base: main
Are you sure you want to change the base?
[WIP] supporting cppyy #248
Conversation
Requesting @mcbarton & @anutosh491 to have a look at this. |
Hey Vipul thanks for this ! This might be interesting but as far as I know this was not planned/intended just as of now. As in I know xeus-clang-repl was/is working towards going back and forth between cpp and python and I am not sure we want this in xeus-cpp already ! I'll cc @JohanMabille here. Johan so xeus-clang-repl used to support magics which allows us to do something like this. Is this something we want to do to ? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #248 +/- ##
==========================================
- Coverage 80.72% 78.97% -1.75%
==========================================
Files 19 21 +2
Lines 970 994 +24
Branches 93 96 +3
==========================================
+ Hits 783 785 +2
- Misses 187 209 +22
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
#include <string> | ||
|
||
#include "Python.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: included header Python.h is not used directly [misc-include-cleaner]
initialize(); | ||
if (!is_initalized) { | ||
// initializing failed | ||
std::cout << Cpp::EndStdStreamCapture(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "std::cout" is directly included [misc-include-cleaner]
src/xmagics/pythonexec.cpp:10:
- #include <string>
+ #include <iostream>
+ #include <string>
if (!is_initalized) { | ||
// initializing failed | ||
std::cout << Cpp::EndStdStreamCapture(); | ||
std::cerr << Cpp::EndStdStreamCapture(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "std::cerr" is directly included [misc-include-cleaner]
std::cerr << Cpp::EndStdStreamCapture();
^
Cpp::BeginStdStreamCapture(Cpp::kStdErr); | ||
Cpp::BeginStdStreamCapture(Cpp::kStdOut); | ||
|
||
PyRun_SimpleString(code.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "PyRun_SimpleString" is directly included [misc-include-cleaner]
src/xmagics/pythonexec.cpp:13:
+ #include "pythonrun.h"
std::cerr << Cpp::EndStdStreamCapture(); | ||
} | ||
|
||
void pythonexec::initialize() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method 'initialize' can be made static [readability-convert-member-functions-to-static]
src/xmagics/pythonexec.hpp:24:
- void initialize();
+ static void initialize();
} | ||
PyConfig_Clear(&config); | ||
#else | ||
Py_Initialize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "Py_Initialize" is directly included [misc-include-cleaner]
src/xmagics/pythonexec.cpp:13:
+ #include "pylifecycle.h"
************************************************************************************/ | ||
|
||
#ifndef XEUS_CPP_PYTHONEXEC_MAGIC_HPP | ||
#define XEUS_CPP_PYTHONEXEC_MAGIC_HPP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: header guard does not follow preferred style [llvm-header-guard]
#define XEUS_CPP_PYTHONEXEC_MAGIC_HPP | |
#ifndef GITHUB_WORKSPACE_SRC_XMAGICS_PYTHONEXEC_HPP | |
#define GITHUB_WORKSPACE_SRC_XMAGICS_PYTHONEXEC_HPP |
src/xmagics/pythonexec.hpp:29:
- #endif //XEUS_CPP_PYTHONEXEC_MAGIC_HPP
+ #endif // GITHUB_WORKSPACE_SRC_XMAGICS_PYTHONEXEC_HPP
class pythonexec : public xmagic_cell | ||
{ | ||
public: | ||
XEUS_CPP_API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "XEUS_CPP_API" is directly included [misc-include-cleaner]
src/xmagics/pythonexec.hpp:13:
- #include "xeus-cpp/xmagics.hpp"
+ #include "xeus-cpp/xeus_cpp_config.hpp"
+ #include "xeus-cpp/xmagics.hpp"
Build Instructions at
https://gist.github.com/Vipul-Cariappa/0808dfcd0503d1ed9bb8e5adf2156aa3#file-emscripten-build-instructions-md