Skip to content

Commit

Permalink
Python: separate compute functions into geoarrow.rust.compute module (
Browse files Browse the repository at this point in the history
#767)

todo: update docs site
  • Loading branch information
kylebarron committed Sep 7, 2024
1 parent b79a429 commit f3fec6b
Show file tree
Hide file tree
Showing 54 changed files with 1,578 additions and 973 deletions.
42 changes: 30 additions & 12 deletions .github/workflows/python-core-wheels.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# This file is autogenerated by maturin v1.7.1
# To update, run
#
# maturin generate-ci -m python/geoarrow-core/Cargo.toml --platform all -o tmp.yml github
# maturin generate-ci -m python/${{ matrix.module }}/Cargo.toml --platform all -o tmp.yml github
#

# Wheel builds for Python libraries that are pure-Rust with no complex
# dependencies (no C dependencies, no http fetching deps)
name: Python wheels (core)

on:
Expand Down Expand Up @@ -32,6 +35,9 @@ jobs:
target: s390x
- runner: ubuntu-latest
target: ppc64le
module:
- geoarrow-core
- geoarrow-compute
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -41,13 +47,13 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --manifest-path python/geoarrow-core/Cargo.toml
args: --release --out dist --manifest-path python/${{ matrix.module }}/Cargo.toml
sccache: "true"
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
name: wheels-linux-${{ matrix.platform.target }}-${{ matrix.module }}
path: dist

musllinux:
Expand All @@ -63,6 +69,9 @@ jobs:
target: aarch64
- runner: ubuntu-latest
target: armv7
module:
- geoarrow-core
- geoarrow-compute
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -72,13 +81,13 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --manifest-path python/geoarrow-core/Cargo.toml
args: --release --out dist --manifest-path python/${{ matrix.module }}/Cargo.toml
sccache: "true"
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
name: wheels-musllinux-${{ matrix.platform.target }}-${{ matrix.module }}
path: dist

windows:
Expand All @@ -90,6 +99,9 @@ jobs:
target: x64
- runner: windows-latest
target: x86
module:
- geoarrow-core
- geoarrow-compute
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -100,12 +112,12 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --manifest-path python/geoarrow-core/Cargo.toml
args: --release --out dist --manifest-path python/${{ matrix.module }}/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
name: wheels-windows-${{ matrix.platform.target }}-${{ matrix.module }}
path: dist

macos:
Expand All @@ -117,6 +129,9 @@ jobs:
target: x86_64
- runner: macos-14
target: aarch64
module:
- geoarrow-core
- geoarrow-compute
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -126,12 +141,12 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --manifest-path python/geoarrow-core/Cargo.toml
args: --release --out dist --manifest-path python/${{ matrix.module }}/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
name: wheels-macos-${{ matrix.platform.target }}-${{ matrix.module }}
path: dist

emscripten:
Expand All @@ -141,6 +156,9 @@ jobs:
platform:
- runner: ubuntu-latest
target: wasm32-unknown-emscripten
module:
- geoarrow-core
- geoarrow-compute
steps:
- uses: actions/checkout@v4
- run: pip install pyodide-build
Expand All @@ -162,13 +180,13 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --no-default-features --manifest-path python/geoarrow-core/Cargo.toml
args: --release --out dist --no-default-features --manifest-path python/${{ matrix.module }}/Cargo.toml
sccache: "true"
rust-toolchain: nightly
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wasm-wheels
name: wasm-wheels-${{ matrix.module }}
path: dist

# sdist:
Expand All @@ -179,7 +197,7 @@ jobs:
# uses: PyO3/maturin-action@v1
# with:
# command: sdist
# args: --out dist --manifest-path python/geoarrow-core/Cargo.toml
# args: --out dist --manifest-path python/${{ matrix.module }}/Cargo.toml
# - name: Upload sdist
# uses: actions/upload-artifact@v4
# with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/python-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
- name: Build python package
run: |
poetry run maturin develop -m geoarrow-core/Cargo.toml
poetry run maturin develop -m geoarrow-compute/Cargo.toml
poetry run maturin develop -m geoarrow-io/Cargo.toml
- name: Install root project
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ jobs:
# Note: core module should be first, because it could be depended on
# by others in the future
poetry run maturin develop -m geoarrow-core/Cargo.toml
poetry run maturin develop -m geoarrow-compute/Cargo.toml
poetry run maturin develop -m geoarrow-io/Cargo.toml
- name: Run python tests
Expand Down
19 changes: 19 additions & 0 deletions python/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["geoarrow-core", "geoarrow-io", "pyo3-geoarrow"]
members = ["geoarrow-compute", "geoarrow-core", "geoarrow-io", "pyo3-geoarrow"]
resolver = "2"

[workspace.package]
Expand Down
2 changes: 2 additions & 0 deletions python/DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

```
poetry run maturin develop -m geoarrow-core/Cargo.toml
poetry run maturin develop -m geoarrow-compute/Cargo.toml
poetry run maturin develop -m geoarrow-io/Cargo.toml
poetry run mkdocs serve
```
Expand All @@ -26,6 +27,7 @@ Then enter into the `python` directory:
cd python
poetry install
poetry run maturin develop -m geoarrow-core/Cargo.toml
poetry run maturin develop -m geoarrow-compute/Cargo.toml
poetry run maturin develop -m geoarrow-io/Cargo.toml
```

Expand Down
38 changes: 38 additions & 0 deletions python/geoarrow-compute/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
name = "geoarrow-rust-compute"
version = { workspace = true }
authors = { workspace = true }
edition = { workspace = true }
description = "Efficient, vectorized geospatial operations in Python."
readme = "README.md"
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
keywords = { workspace = true }
categories = { workspace = true }
rust-version = { workspace = true }

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "_compute"
crate-type = ["cdylib"]

[features]
default = ["libc", "rayon"]
libc = ["geoarrow/polylabel"]
rayon = ["geoarrow/rayon"]

[dependencies]
arrow = { workspace = true }
arrow-array = { workspace = true }
arrow-buffer = { workspace = true }
pyo3 = { workspace = true }
pyo3-arrow = { workspace = true }
pyo3-geoarrow = { path = "../pyo3-geoarrow" }
geo = "0.28"
geoarrow = { workspace = true, features = ["geozero"] }
geozero = { version = "0.13", features = ["with-svg"] }
numpy = "0.21"
serde_json = "1"
thiserror = "1"
url = "2.5"
7 changes: 7 additions & 0 deletions python/geoarrow-compute/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# `geoarrow.rust.compute`

Compute operations on GeoArrow data.

## Documentation

Refer to the documentation at [geoarrow.org/geoarrow-rs/python](https://geoarrow.org/geoarrow-rs/python).
19 changes: 19 additions & 0 deletions python/geoarrow-compute/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[build-system]
requires = ["maturin>=1.4.0,<2.0"]
build-backend = "maturin"

[project]
name = "geoarrow-rust-compute"
requires-python = ">=3.8"
dependencies = ["arro3-core", "geoarrow-rust-core", "pyproj"]
classifiers = [
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dynamic = ["version"]

[tool.maturin]
features = ["pyo3/extension-module"]
module-name = "geoarrow.rust.compute._compute"
python-source = "python"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from . import enums
from ._compute import *
from ._compute import ___version

__version__: str = ___version()
Loading

0 comments on commit f3fec6b

Please sign in to comment.