Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/pylib/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def hello_world():
print("Hello, World!")
19 changes: 19 additions & 0 deletions src/shambindings/src/pybindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,23 @@ void register_py_to_sham_print(py::module &m) {
});
}

void register_extra_lib(py::module &m) {

m.def("register_extra_lib", [&]() {
try {
auto sys = py::module::import("sys");

sys.attr("path").attr("insert")(
0, "/Users/davidclt/Documents/shamrock-dev/Shamrock_cursor/src/pylib");

m.attr("utils") = py::module_::import("utils");

} catch (std::exception &e) {
shambase::throw_with_loc<std::runtime_error>(e.what());
}
});
}

namespace shambindings {

enum { None = 0, Lib = 1, Embed = 2 } init_state = None;
Expand Down Expand Up @@ -149,6 +166,8 @@ namespace shambindings {
if (hook_stdout) {
register_py_to_sham_print(m);
m.attr("hook_stdout")();
register_extra_lib(m);
m.attr("register_extra_lib")();
}
}

Expand Down
1 change: 1 addition & 0 deletions src/shambindings/src/start_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*
*/

#include "shambase/exception.hpp"
#include "shambase/popen.hpp"
#include "shambase/print.hpp"
#include "shambindings/pybindaliases.hpp"
Expand Down
Loading