Skip to content

Commit

Permalink
refactor(python): Split ArrowArray and ArrowArrayStream modules (#559)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
paleolimbot authored Jul 20, 2024
1 parent 9a00532 commit d6368d0
Show file tree
Hide file tree
Showing 20 changed files with 797 additions and 1,226 deletions.
5 changes: 4 additions & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ def nanoarrow_extension(
nanoarrow_extension(
"nanoarrow._device", nanoarrow_c=True, nanoarrow_device=True
),
nanoarrow_extension(
"nanoarrow._array", nanoarrow_c=True, nanoarrow_device=True
),
nanoarrow_extension("nanoarrow._array_stream", nanoarrow_c=True),
nanoarrow_extension("nanoarrow._buffer", nanoarrow_c=True),
nanoarrow_extension("nanoarrow._lib", nanoarrow_c=True, nanoarrow_device=True),
nanoarrow_extension("nanoarrow._ipc_lib", nanoarrow_c=True, nanoarrow_ipc=True),
nanoarrow_extension("nanoarrow._schema", nanoarrow_c=True),
],
Expand Down
1 change: 0 additions & 1 deletion python/src/nanoarrow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
"c_array_from_buffers",
"c_array_stream",
"c_buffer",
"c_lib",
"c_schema",
"c_version",
"date32",
Expand Down
55 changes: 55 additions & 0 deletions python/src/nanoarrow/_array.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# cython: language_level = 3

from libc.stdint cimport int64_t

from nanoarrow_c cimport (
ArrowArray,
ArrowArrayView,
)

from nanoarrow_device_c cimport (
ArrowDeviceArray,
ArrowDeviceType
)

from nanoarrow._device cimport Device
from nanoarrow._schema cimport CSchema


cdef class CArray:
cdef object _base
cdef ArrowArray* _ptr
cdef CSchema _schema
cdef ArrowDeviceType _device_type
cdef int _device_id

cdef _set_device(self, ArrowDeviceType device_type, int64_t device_id)


cdef class CArrayView:
cdef object _base
cdef object _array_base
cdef ArrowArrayView* _ptr
cdef Device _device

cdef class CDeviceArray:
cdef object _base
cdef ArrowDeviceArray* _ptr
cdef CSchema _schema
Loading

0 comments on commit d6368d0

Please sign in to comment.