Skip to content

Commit

Permalink
refactor(python): Extract utility functions into _utils.pyx (#529)
Browse files Browse the repository at this point in the history
This PR moves a number of utility functions that were relatively
self-contained into a new module, _utils.pyx.

TODO:

- dereplicate the error handling utility
- Ensure "exported" functions are documented with a docstring
  • Loading branch information
paleolimbot authored Jun 19, 2024
1 parent adb94ae commit 97410e2
Show file tree
Hide file tree
Showing 14 changed files with 602 additions and 364 deletions.
3 changes: 1 addition & 2 deletions python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
# under the License.

vendor/
src/nanoarrow/_lib.c
src/nanoarrow/_ipc_lib.c
src/nanoarrow/_*.c

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
12 changes: 12 additions & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ def get_version(pkg_path):

setup(
ext_modules=[
Extension(
name="nanoarrow._utils",
include_dirs=["src/nanoarrow", "vendor"],
language="c",
sources=[
"src/nanoarrow/_utils.pyx",
"vendor/nanoarrow.c",
],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
define_macros=extra_define_macros,
),
Extension(
name="nanoarrow._lib",
include_dirs=["src/nanoarrow", "vendor"],
Expand Down
2 changes: 1 addition & 1 deletion python/src/nanoarrow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Arrow C Data and Arrow C Stream interfaces.
"""

from nanoarrow._lib import c_version
from nanoarrow._utils import c_version
from nanoarrow.c_array import c_array_from_buffers, c_array
from nanoarrow.c_array_stream import c_array_stream
from nanoarrow.c_schema import c_schema
Expand Down
Loading

0 comments on commit 97410e2

Please sign in to comment.