Skip to content

Commit d6368d0

Browse files
authored
refactor(python): Split ArrowArray and ArrowArrayStream modules (#559)
This is the final splitting of modules from `_lib.pyx`, which no longer exists! It separates the array stream and array components to live in separate .pyx files and adds basic docstrings to internal functions. It also removes a few references to `_lib` and `c_lib` that had made it through to this PR.
1 parent 9a00532 commit d6368d0

20 files changed

+797
-1226
lines changed

python/setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,11 @@ def nanoarrow_extension(
136136
nanoarrow_extension(
137137
"nanoarrow._device", nanoarrow_c=True, nanoarrow_device=True
138138
),
139+
nanoarrow_extension(
140+
"nanoarrow._array", nanoarrow_c=True, nanoarrow_device=True
141+
),
142+
nanoarrow_extension("nanoarrow._array_stream", nanoarrow_c=True),
139143
nanoarrow_extension("nanoarrow._buffer", nanoarrow_c=True),
140-
nanoarrow_extension("nanoarrow._lib", nanoarrow_c=True, nanoarrow_device=True),
141144
nanoarrow_extension("nanoarrow._ipc_lib", nanoarrow_c=True, nanoarrow_ipc=True),
142145
nanoarrow_extension("nanoarrow._schema", nanoarrow_c=True),
143146
],

python/src/nanoarrow/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
"c_array_from_buffers",
8888
"c_array_stream",
8989
"c_buffer",
90-
"c_lib",
9190
"c_schema",
9291
"c_version",
9392
"date32",

python/src/nanoarrow/_array.pxd

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# cython: language_level = 3
19+
20+
from libc.stdint cimport int64_t
21+
22+
from nanoarrow_c cimport (
23+
ArrowArray,
24+
ArrowArrayView,
25+
)
26+
27+
from nanoarrow_device_c cimport (
28+
ArrowDeviceArray,
29+
ArrowDeviceType
30+
)
31+
32+
from nanoarrow._device cimport Device
33+
from nanoarrow._schema cimport CSchema
34+
35+
36+
cdef class CArray:
37+
cdef object _base
38+
cdef ArrowArray* _ptr
39+
cdef CSchema _schema
40+
cdef ArrowDeviceType _device_type
41+
cdef int _device_id
42+
43+
cdef _set_device(self, ArrowDeviceType device_type, int64_t device_id)
44+
45+
46+
cdef class CArrayView:
47+
cdef object _base
48+
cdef object _array_base
49+
cdef ArrowArrayView* _ptr
50+
cdef Device _device
51+
52+
cdef class CDeviceArray:
53+
cdef object _base
54+
cdef ArrowDeviceArray* _ptr
55+
cdef CSchema _schema

0 commit comments

Comments
 (0)