Skip to content

Commit dbaea9e

Browse files
authored
feat(deps): bump pyo3 v0.25 -> v0.26 (#408)
* feat(deps): bump pyo3 v0.25 -> v0.26 Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com> * refactor: fix deprecation warnings Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com> --------- Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com>
1 parent 21b1f3c commit dbaea9e

File tree

10 files changed

+78
-107
lines changed

10 files changed

+78
-107
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ name = "fastexcel"
2626
crate-type = ["cdylib", "rlib"]
2727

2828
[dependencies]
29-
arrow-array = { version = "^56.2.0", features = ["ffi"], optional = true }
30-
arrow-pyarrow = { version = "^56.2.0", optional = true }
31-
arrow-schema = { version = "^56.1.0", optional = true }
29+
arrow-array = { version = "^57", features = ["ffi"], optional = true }
30+
arrow-pyarrow = { version = "^57", optional = true }
31+
arrow-schema = { version = "^57", optional = true }
3232
calamine = { version = "^0.31.0", features = ["chrono"] }
3333
chrono = { version = "^0.4.42", default-features = false }
3434
log = "^0.4"
@@ -37,9 +37,9 @@ polars-core = { version = ">=0.50", default-features = false, features = [
3737
"dtype-datetime",
3838
"dtype-duration",
3939
], optional = true }
40-
pyo3 = { version = "^0.25", features = ["abi3-py39"], optional = true }
41-
pyo3-arrow = { version = "0.11", default-features = false, optional = true }
42-
pyo3-log = { version = "^0.12.4", optional = true }
40+
pyo3 = { version = "^0.26", features = ["abi3-py39"], optional = true }
41+
pyo3-arrow = { version = "^0.14", default-features = false, optional = true }
42+
pyo3-log = { version = "^0.13.1", optional = true }
4343

4444
[dev-dependencies]
4545
anyhow = "1.0.100"

python/tests/test_dtypes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,8 @@ def test_fallback_infer_dtypes(mocker: MockerFixture) -> None:
334334
"Could not determine dtype for column 1, falling back to string",
335335
mocker.ANY,
336336
mocker.ANY,
337+
mocker.ANY,
338+
mocker.ANY,
337339
)
338340

339341
assert sheet.available_columns() == [

src/data/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ pub(crate) fn generate_row_selector(
347347
SkipRows::Callable(_func) => {
348348
// Call the Python function for each row to determine if it should be skipped
349349
// The callable should receive data-relative row indices (0, 1, 2, ...)
350-
pyo3::Python::with_gil(|py| {
350+
pyo3::Python::attach(|py| {
351351
Ok(RowSelector::Filtered(
352352
(offset..limit)
353353
.enumerate()

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ fn py_read_excel<'py>(source: &Bound<'_, PyAny>, py: Python<'py>) -> PyResult<Ex
3535
use py_errors::IntoPyResult;
3636

3737
if let Ok(path) = source.extract::<String>() {
38-
py.allow_threads(|| ExcelReader::try_from_path(&path))
38+
py.detach(|| ExcelReader::try_from_path(&path))
3939
.with_context(|| format!("could not load excel file at {path}"))
4040
.into_pyresult()
4141
} else if let Ok(bytes) = source.extract::<&[u8]>() {
42-
py.allow_threads(|| ExcelReader::try_from(bytes))
42+
py.detach(|| ExcelReader::try_from(bytes))
4343
.with_context(|| "could not load excel file for those bytes")
4444
.into_pyresult()
4545
} else {

src/types/excelreader/python.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl ExcelReader {
8686

8787
if eager && self.sheets.supports_by_ref() {
8888
let range = py
89-
.allow_threads(|| {
89+
.detach(|| {
9090
self.sheets
9191
.with_header_row(calamine_header_row)
9292
.worksheet_range_ref(&sheet_meta.name)
@@ -96,7 +96,7 @@ impl ExcelReader {
9696
Pagination::try_new(opts.skip_rows, opts.n_rows, &range).into_pyresult()?;
9797
let header = Header::new(data_header_row, opts.column_names);
9898
let rb = py
99-
.allow_threads(|| {
99+
.detach(|| {
100100
Self::load_sheet_eager(
101101
&range.into(),
102102
pagination,
@@ -112,7 +112,7 @@ impl ExcelReader {
112112
#[cfg(feature = "pyarrow")]
113113
{
114114
use arrow_pyarrow::ToPyArrow;
115-
rb.to_pyarrow(py).map(|py_object| py_object.into_bound(py))
115+
rb.to_pyarrow(py)
116116
}
117117
#[cfg(not(feature = "pyarrow"))]
118118
{
@@ -122,7 +122,7 @@ impl ExcelReader {
122122
}
123123
} else {
124124
let range = py
125-
.allow_threads(|| {
125+
.detach(|| {
126126
self.sheets
127127
.with_header_row(calamine_header_row)
128128
.worksheet_range(&sheet_meta.name)
@@ -168,14 +168,12 @@ impl ExcelReader {
168168
eager: bool,
169169
py: Python<'py>,
170170
) -> PyResult<Bound<'py, PyAny>> {
171-
let excel_table = py
172-
.allow_threads(|| self.load_table(name, opts))
173-
.into_pyresult()?;
171+
let excel_table = py.detach(|| self.load_table(name, opts)).into_pyresult()?;
174172

175173
if eager {
176174
#[cfg(feature = "pyarrow")]
177175
{
178-
Ok(excel_table.to_arrow(py)?.into_bound(py))
176+
Ok(excel_table.to_arrow(py)?)
179177
}
180178
#[cfg(not(feature = "pyarrow"))]
181179
{

0 commit comments

Comments
 (0)