-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RTree Buffer protocol, python binding tests (#55)
* Draft buffer protocol (memoryview-mediated, apparently zero-copy), explicit from_buffer, to_buffer methods (latter causes a copy to occur). TODO: add tests equiv to geoarrow-rs * Add poetry infra, tests, try to avoid segfault on shared memory (unsuccessfully) * Swap test names * Rip out unnecessary py03 feature, avoid breaking out build.rs * Rip out unnecessary py03 annotations, clippy silencing, switch to opendal-esque (basically verbatim) __getbuffer__ * Remove copy-prone to_buffer (superseded in all python versions since ~3.0 by the buffer protocol), from_buffer * Trim down tests to just buffer imports * Remove from_buffer, to_buffer in pyi * Draft pytest (non-matrix) + python-wheels CI conf * Swap back to fixed python version in publish step (suspect setup-python might not actually be necessary), try out matrixed pytest * updates --------- Co-authored-by: Kyle Barron <kyle@developmentseed.org>
- Loading branch information
1 parent
8e89c0b
commit bf91b87
Showing
13 changed files
with
312 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import numpy as np | ||
|
||
from .. import RTree | ||
|
||
|
||
def generate_random_boxes(): | ||
random_points = np.random.random_sample((100, 2)) | ||
boxes = np.concatenate([random_points, random_points], axis=1) | ||
return boxes | ||
|
||
|
||
def test_buffer_protocol(): | ||
boxes = generate_random_boxes() | ||
initial = RTree.from_interleaved(boxes) | ||
# construct a memoryview transparently | ||
view = memoryview(initial) | ||
assert initial.num_bytes == view.nbytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.