Skip to content

Commit 536ac74

Browse files
authored
chore: bump rust dependencies (#128)
- pyo3 to 0.27.1 - pyo3-stub-gen to 0.17.1 - numpy to 0.27.0
1 parent 3cfa79a commit 536ac74

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ name = "zarrs_python"
99
crate-type = ["cdylib", "rlib"]
1010

1111
[dependencies]
12-
pyo3 = { version = "0.25.1", features = ["abi3-py311"] }
12+
pyo3 = { version = "0.27.1", features = ["abi3-py311"] }
1313
zarrs = { version = "0.22.4", features = ["async", "zlib", "pcodec", "bz2"] }
1414
rayon_iter_concurrent_limit = "0.2.0"
1515
rayon = "1.10.0"
1616
# fix for https://stackoverflow.com/questions/76593417/package-openssl-was-not-found-in-the-pkg-config-search-path
1717
openssl = { version = "0.10", features = ["vendored"] }
18-
numpy = "0.25.0"
18+
numpy = "0.27.0"
1919
unsafe_cell_slice = "0.2.0"
2020
serde_json = "1.0.128"
21-
pyo3-stub-gen = "0.12.2"
21+
pyo3-stub-gen = "0.17.1"
2222
opendal = { version = "0.54.0", features = ["services-http"] }
2323
tokio = { version = "1.41.1", features = ["rt-multi-thread"] }
2424
zarrs_opendal = "0.9.0"

python/zarrs/_internal.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import typing
77
import numpy.typing
88
import zarr.abc.store
99

10+
@typing.final
1011
class Basic:
1112
def __new__(cls, byte_interface: typing.Any, chunk_spec: typing.Any) -> Basic: ...
1213

14+
@typing.final
1315
class CodecPipelineImpl:
1416
def __new__(
1517
cls,
@@ -34,6 +36,7 @@ class CodecPipelineImpl:
3436
write_empty_chunks: builtins.bool,
3537
) -> None: ...
3638

39+
@typing.final
3740
class WithSubset:
3841
def __new__(
3942
cls,

src/chunk_item.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn fill_value_to_bytes(dtype: &str, fill_value: &Bound<'_, PyAny>) -> PyResult<V
3333
if dtype == "string" {
3434
// Match zarr-python 2.x.x string fill value behaviour with a 0 fill value
3535
// See https://github.com/zarr-developers/zarr-python/issues/2792#issuecomment-2644362122
36-
if let Ok(fill_value_downcast) = fill_value.downcast::<PyInt>() {
36+
if let Ok(fill_value_downcast) = fill_value.cast::<PyInt>() {
3737
let fill_value_usize: usize = fill_value_downcast.extract()?;
3838
if fill_value_usize == 0 {
3939
return Ok(vec![]);
@@ -44,7 +44,7 @@ fn fill_value_to_bytes(dtype: &str, fill_value: &Bound<'_, PyAny>) -> PyResult<V
4444
}
4545
}
4646

47-
if let Ok(fill_value_downcast) = fill_value.downcast::<PyBytes>() {
47+
if let Ok(fill_value_downcast) = fill_value.cast::<PyBytes>() {
4848
Ok(fill_value_downcast.as_bytes().to_vec())
4949
} else if fill_value.hasattr("tobytes")? {
5050
Ok(fill_value.call_method0("tobytes")?.extract()?)

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ impl CodecPipelineImpl {
341341
partial_decoder_cache.extend(key_decoder_pairs);
342342
}
343343

344-
py.allow_threads(move || {
344+
py.detach(move || {
345345
// FIXME: the `decode_into` methods only support fixed length data types.
346346
// For variable length data types, need a codepath with non `_into` methods.
347347
// Collect all the subsets and copy into value on the Python side?
@@ -448,7 +448,7 @@ impl CodecPipelineImpl {
448448
};
449449
codec_options.set_store_empty_chunks(write_empty_chunks);
450450

451-
py.allow_threads(move || {
451+
py.detach(move || {
452452
let store_chunk = |item: chunk_item::WithSubset| match &input {
453453
InputValue::Array(input) => {
454454
let chunk_subset_bytes = input

src/store.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::{collections::HashMap, sync::Arc};
22

33
use opendal::Builder;
44
use pyo3::{
5-
Bound, FromPyObject, PyAny, PyErr, PyResult,
5+
Borrowed, Bound, FromPyObject, PyAny, PyErr, PyResult,
66
exceptions::{PyNotImplementedError, PyValueError},
77
types::{PyAnyMethods, PyStringMethods, PyTypeMethods},
88
};
@@ -25,8 +25,10 @@ pub enum StoreConfig {
2525
// TODO: Add support for more stores
2626
}
2727

28-
impl<'py> FromPyObject<'py> for StoreConfig {
29-
fn extract_bound(store: &Bound<'py, PyAny>) -> PyResult<Self> {
28+
impl<'py> FromPyObject<'_, 'py> for StoreConfig {
29+
type Error = PyErr;
30+
31+
fn extract(store: Borrowed<'_, 'py, PyAny>) -> PyResult<Self> {
3032
let name = store.get_type().name()?;
3133
let name = name.to_str()?;
3234
match name {

0 commit comments

Comments
 (0)