Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(python): Python schema, array, and array view skeleton #117

Merged
merged 52 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
879d75e
maybe schema class
paleolimbot Feb 23, 2023
cff939d
remove pxds
paleolimbot Mar 8, 2023
73eb934
generate the nanoarrow pxd file
paleolimbot Mar 8, 2023
6153916
completely invalid but working towards ideal setup.py
paleolimbot Mar 8, 2023
1637afe
still invalid but better setup.py
paleolimbot Mar 8, 2023
1b38e9e
actually working bootstrap setup
paleolimbot Mar 9, 2023
ca191e7
fix indentation
paleolimbot Mar 9, 2023
891afb1
add some typedefs
paleolimbot Mar 9, 2023
26581a5
no void()
paleolimbot Mar 9, 2023
8531234
try without namespace
paleolimbot Mar 9, 2023
1bb020f
better functionr regex
paleolimbot Mar 9, 2023
368ecbe
move some bits from the other repo
paleolimbot Mar 9, 2023
5d0a500
with recursiveness
paleolimbot Mar 9, 2023
a83e2e9
passing buffer protocol test
paleolimbot Mar 9, 2023
18f1a20
maybe fix errors
paleolimbot Mar 9, 2023
0cc14b8
don't run bootstrap when installing from sdist
paleolimbot Mar 10, 2023
9e72b96
make sure we can install from sdist
paleolimbot Mar 10, 2023
2cd5599
remove redundant cdefs
paleolimbot Mar 10, 2023
0144afe
fix asserts
paleolimbot Mar 10, 2023
b768724
maybe safer version check
paleolimbot Mar 10, 2023
846c837
drop C class prefix, drop numpy dependency, pythonize quotes
paleolimbot Mar 10, 2023
ac304af
more complete schema field wrapping
paleolimbot Mar 10, 2023
05d4a81
test a few more array view things
paleolimbot Mar 10, 2023
bbf18df
maybe install on Windows, update install instructions
paleolimbot Mar 10, 2023
085b82a
Empty -> empty
paleolimbot Mar 10, 2023
a4d0490
nogil
paleolimbot Jun 9, 2023
55dcdb4
add buffer data types to properly set format
paleolimbot Jun 9, 2023
984ea76
add dictionary member
paleolimbot Jun 9, 2023
fc0a7dc
more buffer info
paleolimbot Jun 10, 2023
33dcbe7
test buffer access with numpy
paleolimbot Jun 10, 2023
280193b
format with black
paleolimbot Jun 10, 2023
97df28e
some helpers
paleolimbot Jun 11, 2023
d7fd6e1
rename version
paleolimbot Jun 11, 2023
5c02647
start on stream
paleolimbot Jun 11, 2023
ed5e545
some array stream madness
paleolimbot Jun 12, 2023
1321545
some tidying
paleolimbot Jun 12, 2023
c1c2df2
more documentation
paleolimbot Jun 12, 2023
ee4dbb6
empty -> allocate
paleolimbot Jun 12, 2023
4bb8f86
in theory use nanoarrowexcpetion
paleolimbot Jun 12, 2023
1d3d8c1
attempt starting coverage
paleolimbot Jun 12, 2023
3d03cc6
attempt starting coverage again
paleolimbot Jun 12, 2023
3413af1
remove coverage file
paleolimbot Jun 12, 2023
4f8cef2
add coverage to python job
paleolimbot Jun 12, 2023
f6be55c
fix + test doctests from Cython
paleolimbot Jun 12, 2023
ce3463f
basic readme
paleolimbot Jun 13, 2023
78cd797
Update python/nanoarrow/_lib.pyx
paleolimbot Jun 14, 2023
dc7d91c
use the namespace
paleolimbot Jun 14, 2023
a1150dd
use cinit instead of init
paleolimbot Jun 14, 2023
b73804c
clean up Cython
paleolimbot Jun 14, 2023
a5d4479
use StopIteration
paleolimbot Jun 14, 2023
6a82504
more clear distinction from the array--array view interaction
paleolimbot Jun 14, 2023
6f530e8
fix doctest
paleolimbot Jun 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -57,3 +57,31 @@ jobs:
- name: Run tests
run: |
pytest python/tests -v -s

- name: Run doctests
if: success() && matrix.python-version == '3.10'
run: |
# Needs editable install to run --doctest-cython
pip install pytest-cython
pip install -e python
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? (it was already installed in two steps above?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's installed without -e above (maybe I'll just add it there, and maybe also add pytest-cython to pyproject.toml while I'm at it).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the pytest-cython need the package to be installed in editable mode? (I would expect it to work with the installed package as well)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locally, yes. I've found it to be rather finicky (but useful enough to play along with for now 🤷 ).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, we use this package in Arrow CI with a normal install of pyarrow (non-editable), so I think it should certainly work. What you might have noticed locally is that a test didn't pass after updating it if you didn't re-install it? (that's the reason for locally using editable, so you don't have to reinstall after every tiny change. But on CI that doesn't matter)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update this...there are many things that could have been wrong with my local setup!

pytest python --doctest-cython

- name: Coverage
if: success() && matrix.python-version == '3.10'
run: |
pip uninstall --yes nanoarrow
pip install pytest-cov Cython
pushd python

# Build with Cython + gcc coverage options
NANOARROW_PYTHON_COVERAGE=1 python setup.py build_ext --inplace

# Run tests + coverage.py (generates .coverage + coverage.xml files)
python -m pytest --cov ./nanoarrow
python -m coverage xml

- name: Upload coverage to codecov
if: success() && matrix.python-version == '3.10'
uses: codecov/codecov-action@v2
with:
files: 'python/coverage.xml'
20 changes: 20 additions & 0 deletions python/.coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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.

# .coveragerc to control coverage.py
[run]
plugins = Cython.Coverage
7 changes: 4 additions & 3 deletions python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
# specific language governing permissions and limitations
# under the License.

src/nanoarrow/nanoarrow.c
src/nanoarrow/nanoarrow.h
src/nanoarrow/*.cpp
nanoarrow/nanoarrow.c
nanoarrow/nanoarrow.h
nanoarrow/nanoarrow_c.pxd
nanoarrow/*.c

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
21 changes: 21 additions & 0 deletions python/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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.

exclude bootstrap.py
include nanoarrow/nanoarrow.c
include nanoarrow/nanoarrow.h
include nanoarrow/nanoarrow_c.pxd
Loading