Skip to content

Commit 98030ed

Browse files
committed
Wrap pybind11 API and and Fix #1106
1 parent 892b82b commit 98030ed

24 files changed

Lines changed: 202 additions & 82 deletions

CMakeLists.txt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@ project(_kuzu)
33

44
set(CMAKE_CXX_STANDARD 20)
55

6+
file(GLOB SOURCE_PY
7+
"src_py/*")
8+
69
pybind11_add_module(_kuzu
710
SHARED
8-
kuzu_binding.cpp
9-
py_connection.cpp
10-
py_database.cpp
11-
py_query_result.cpp
12-
py_query_result_converter.cpp)
11+
src_cpp/kuzu_binding.cpp
12+
src_cpp/py_connection.cpp
13+
src_cpp/py_database.cpp
14+
src_cpp/py_query_result.cpp
15+
src_cpp/py_query_result_converter.cpp)
1316

1417
set_target_properties(_kuzu
1518
PROPERTIES
16-
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/")
19+
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/kuzu")
1720

1821
target_link_libraries(_kuzu
1922
PRIVATE
@@ -22,5 +25,8 @@ target_link_libraries(_kuzu
2225
target_include_directories(
2326
_kuzu
2427
PUBLIC
25-
../../src/include
26-
)
28+
../../src/include)
29+
30+
get_target_property(PYTHON_DEST _kuzu LIBRARY_OUTPUT_DIRECTORY)
31+
32+
file(COPY ${SOURCE_PY} DESTINATION ${PYTHON_DEST})

__init__.py

Whitespace-only changes.
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "datetime.h" // from Python
44

55
void PyConnection::initialize(py::handle& m) {
6-
py::class_<PyConnection>(m, "connection")
6+
py::class_<PyConnection>(m, "Connection")
77
.def(py::init<PyDatabase*, uint64_t>(), py::arg("database"), py::arg("num_threads") = 0)
88
.def(
99
"execute", &PyConnection::execute, py::arg("query"), py::arg("parameters") = py::list())

py_database.cpp renamed to src_cpp/py_database.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "include/py_database.h"
22

33
void PyDatabase::initialize(py::handle& m) {
4-
py::class_<PyDatabase>(m, "database")
4+
py::class_<PyDatabase>(m, "Database")
55
.def(py::init<const string&, uint64_t>(), py::arg("database_path"),
66
py::arg("buffer_pool_size") = 0)
77
.def("resize_buffer_manager", &PyDatabase::resizeBufferManager, py::arg("new_size"))

0 commit comments

Comments
 (0)