diff --git a/python/pyarrow/table.pxd b/python/pyarrow/table.pxd index 79c9ae3b0a1..df3687ddf97 100644 --- a/python/pyarrow/table.pxd +++ b/python/pyarrow/table.pxd @@ -57,3 +57,5 @@ cdef class RecordBatch: cdef init(self, const shared_ptr[CRecordBatch]& table) cdef _check_nullptr(self) + +cdef api object table_from_ctable(const shared_ptr[CTable]& ctable) diff --git a/python/pyarrow/table.pyx b/python/pyarrow/table.pyx index 0a9805cfdf4..333686f810e 100644 --- a/python/pyarrow/table.pyx +++ b/python/pyarrow/table.pyx @@ -687,5 +687,9 @@ cdef class Table: return (self.num_rows, self.num_columns) +cdef api object table_from_ctable(const shared_ptr[CTable]& ctable): + cdef Table table = Table() + table.init(ctable) + return table from_pandas_dataframe = Table.from_pandas diff --git a/python/setup.py b/python/setup.py index 0f6bbda6ec3..5acdca34a08 100644 --- a/python/setup.py +++ b/python/setup.py @@ -204,6 +204,10 @@ def _run_cmake(self): shutil.move(self.get_ext_built(name), ext_path) self._found_names.append(name) + if os.path.exists(self.get_ext_built_api_header(name)): + shutil.move(self.get_ext_built_api_header(name), + pjoin(os.path.dirname(ext_path), name + '_api.h')) + os.chdir(saved_cwd) def _failure_permitted(self, name): @@ -225,6 +229,13 @@ def _get_cmake_ext_path(self, name): filename = name + suffix return pjoin(package_dir, filename) + def get_ext_built_api_header(self, name): + if sys.platform == 'win32': + head, tail = os.path.split(name) + return pjoin(head, tail + "_api.h") + else: + return pjoin(name + "_api.h") + def get_ext_built(self, name): if sys.platform == 'win32': head, tail = os.path.split(name)