Skip to content

Commit c5b0bf2

Browse files
authored
Bump to pyo3 0.22 (#848)
Preparatory work for testing integration with pyo3-object-store.
1 parent e74b291 commit c5b0bf2

File tree

23 files changed

+91
-86
lines changed

23 files changed

+91
-86
lines changed

python/Cargo.lock

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ geoarrow = { path = "../rust/geoarrow" }
2424
# geoarrow = { version = "0.4.0-beta.1" }
2525
geozero = "0.14"
2626
indexmap = "2.5.0"
27+
numpy = "0.22"
2728
object_store = "0.11"
2829
parquet = "53"
29-
pyo3 = { version = "0.21.0", features = ["hashbrown", "serde", "anyhow"] }
30-
pyo3-arrow = "0.4"
30+
pyo3 = { version = "0.22.0", features = ["hashbrown", "serde", "anyhow"] }
31+
pyo3-arrow = "0.5.1"
3132
serde_json = "1"
3233
thiserror = "1"

python/geoarrow-compute/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pyo3-geoarrow = { path = "../pyo3-geoarrow" }
3232
geo = "0.28"
3333
geoarrow = { workspace = true }
3434
geozero = { version = "0.14", features = ["with-svg"] }
35-
numpy = "0.21"
35+
numpy = { workspace = true }
3636
serde_json = "1"
3737
thiserror = "1"
3838
url = "2.5"

python/geoarrow-compute/src/algorithm/geo/area.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub enum AreaMethod {
1515
}
1616

1717
impl<'a> FromPyObject<'a> for AreaMethod {
18-
fn extract(ob: &'a PyAny) -> PyResult<Self> {
18+
fn extract_bound(ob: &Bound<'a, PyAny>) -> PyResult<Self> {
1919
let s: String = ob.extract()?;
2020
match s.to_lowercase().as_str() {
2121
"ellipsoidal" => Ok(Self::Geodesic),

python/geoarrow-compute/src/broadcasting/primitive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use pyo3::prelude::*;
3838
pub struct BroadcastableFloat(pub(crate) BroadcastablePrimitive<Float64Type>);
3939

4040
impl<'a> FromPyObject<'a> for BroadcastableFloat {
41-
fn extract(_ob: &'a PyAny) -> PyResult<Self> {
41+
fn extract_bound(_ob: &Bound<'a, PyAny>) -> PyResult<Self> {
4242
todo!()
4343
// Python::with_gil(|py| {
4444
// let pa = py.import_bound("pyarrow")?;

python/geoarrow-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pyo3-geoarrow = { path = "../pyo3-geoarrow" }
3232
geo = "0.28"
3333
geoarrow = { workspace = true }
3434
geozero = { version = "0.14", features = ["with-svg"] }
35-
numpy = "0.21"
35+
numpy = { workspace = true }
3636
serde_json = "1"
3737
thiserror = "1"
3838
url = "2.5"

python/geoarrow-core/src/interop/shapely/from_shapely.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ use geoarrow::datatypes::{Dimension, NativeType};
1212
use pyo3::exceptions::PyValueError;
1313
use pyo3::intern;
1414
use pyo3::prelude::*;
15-
use pyo3::types::{PyBytes, PyDict, PyString, PyTuple};
15+
use pyo3::pybacked::PyBackedBytes;
16+
use pyo3::types::{PyDict, PyString, PyTuple};
1617
use pyo3::PyAny;
1718
use pyo3_geoarrow::PyGeoArrowResult;
1819

@@ -90,7 +91,7 @@ pub fn from_shapely(
9091
shapely_mod.call_method(intern!(py, "to_ragged_array"), (input,), Some(&kwargs))
9192
{
9293
let (geom_type, coords, offsets) =
93-
ragged_array_output.extract::<(&PyAny, Bound<PyAny>, PyObject)>()?;
94+
ragged_array_output.extract::<(Bound<PyAny>, Bound<PyAny>, PyObject)>()?;
9495
let coords = numpy_mod.call_method1(
9596
intern!(py, "ascontiguousarray"),
9697
PyTuple::new_bound(py, vec![coords]),
@@ -181,8 +182,8 @@ fn make_wkb_arr(
181182
let mut builder = BinaryBuilder::with_capacity(wkb_result.len()?, 0);
182183

183184
for item in wkb_result.iter()? {
184-
let x = item?.extract::<&PyBytes>()?;
185-
builder.append_value(x.as_bytes());
185+
let buf = item?.extract::<PyBackedBytes>()?;
186+
builder.append_value(buf.as_ref());
186187
}
187188

188189
Ok(geoarrow::array::WKBArray::new(builder.finish(), metadata))

python/geoarrow-io/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async = [
2323
"dep:futures",
2424
"dep:object_store",
2525
"parquet/object_store",
26-
"dep:pyo3-asyncio-0-21",
26+
"dep:pyo3-async-runtimes",
2727
"geoarrow/flatgeobuf_async",
2828
"geoarrow/parquet_async",
2929
"geoarrow/postgis",
@@ -45,10 +45,10 @@ object_store = { workspace = true, features = [
4545
parquet = { workspace = true }
4646
pyo3 = { workspace = true }
4747
pyo3-arrow = { workspace = true }
48-
pyo3-asyncio-0-21 = { version = "0.21", features = [
48+
pyo3-async-runtimes = { version = "0.22", features = [
4949
"tokio-runtime",
5050
], optional = true }
51-
pythonize = "0.21"
51+
pythonize = "0.22"
5252
geo = "0.28"
5353
geo-traits = { workspace = true }
5454
geoarrow = { workspace = true, features = [

python/geoarrow-io/src/error.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use pyo3::prelude::*;
33

44
pub enum PyGeoArrowError {
55
GeoArrowError(geoarrow::error::GeoArrowError),
6-
PyErr(PyErr),
76
PyArrowError(pyo3_arrow::error::PyArrowError),
7+
PyErr(PyErr),
88
PythonizeError(pythonize::PythonizeError),
99
#[cfg(feature = "async")]
1010
ObjectStoreError(object_store::Error),
@@ -75,15 +75,15 @@ impl From<url::ParseError> for PyGeoArrowError {
7575
}
7676
}
7777

78-
impl From<PyTypeError> for PyGeoArrowError {
79-
fn from(other: PyTypeError) -> Self {
80-
Self::PyErr((&other).into())
78+
impl From<Bound<'_, PyTypeError>> for PyGeoArrowError {
79+
fn from(other: Bound<'_, PyTypeError>) -> Self {
80+
Self::PyErr(other.into())
8181
}
8282
}
8383

84-
impl From<PyValueError> for PyGeoArrowError {
85-
fn from(other: PyValueError) -> Self {
86-
Self::PyErr((&other).into())
84+
impl From<Bound<'_, PyValueError>> for PyGeoArrowError {
85+
fn from(other: Bound<'_, PyValueError>) -> Self {
86+
Self::PyErr((other).into())
8787
}
8888
}
8989

python/geoarrow-io/src/io/flatgeobuf/async.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use geoarrow::io::flatgeobuf::read_flatgeobuf_async as _read_flatgeobuf_async;
55
use geoarrow::io::flatgeobuf::FlatGeobufReaderOptions;
66
use pyo3::exceptions::PyValueError;
77
use pyo3::prelude::*;
8+
use pyo3_async_runtimes::tokio::future_into_py;
89

910
#[pyfunction]
1011
#[pyo3(signature = (path, *, fs=None, batch_size=65536, bbox=None))]
@@ -18,7 +19,7 @@ pub fn read_flatgeobuf_async(
1819
let reader = construct_reader(py, path, fs)?;
1920
match reader {
2021
AnyFileReader::Async(async_reader) => {
21-
let fut = pyo3_asyncio_0_21::tokio::future_into_py(py, async move {
22+
let fut = future_into_py(py, async move {
2223
let options = FlatGeobufReaderOptions {
2324
batch_size: Some(batch_size),
2425
bbox,

0 commit comments

Comments
 (0)