Skip to content

Commit 635b671

Browse files
authored
Merge pull request #51 from enviodev/claude/upgrade-python-dependencies-RsQ45
Upgrade PyO3 0.23→0.26 for Python 3.14 support
2 parents 8394bf0 + 379374b commit 635b671

9 files changed

Lines changed: 40 additions & 41 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- runner: ubuntu-latest
3434
target: aarch64
3535
python-architecture: arm64
36-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
36+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
3737
steps:
3838
- uses: actions/checkout@v4
3939
- uses: actions/setup-python@v5
@@ -62,7 +62,7 @@ jobs:
6262
target: x64
6363
- runner: windows-latest
6464
target: x86
65-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
65+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
6666
steps:
6767
- uses: actions/checkout@v4
6868
- uses: actions/setup-python@v5
@@ -93,7 +93,7 @@ jobs:
9393
- runner: macos-14
9494
target: aarch64
9595
python-architecture: arm64
96-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
96+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
9797
steps:
9898
- uses: actions/checkout@v4
9999
- uses: actions/setup-python@v5

‎Cargo.lock‎

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

‎Cargo.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ name = "hypersync"
88
crate-type = ["cdylib"]
99

1010
[dependencies]
11-
pyo3 = { version = "0.23", features = [
11+
pyo3 = { version = "0.26", features = [
1212
"extension-module",
1313
"anyhow",
1414
"num-bigint",
1515
] }
16-
pyo3-async-runtimes = { version = "0.23", features = ["tokio-runtime"] }
16+
pyo3-async-runtimes = { version = "0.26", features = ["tokio-runtime"] }
1717
tokio = "1"
1818
serde_json = "1"
1919
serde = { version = "1", features = ["derive"] }

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ classifiers = [
1616
"Programming Language :: Python :: 3.11",
1717
"Programming Language :: Python :: 3.12",
1818
"Programming Language :: Python :: 3.13",
19+
"Programming Language :: Python :: 3.14",
1920
"Development Status :: 3 - Alpha",
2021
"Topic :: Database :: Front-Ends",
2122
"Topic :: Software Development :: Libraries",

‎src/arrow_ffi.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use polars_arrow::{
88
use pyo3::{
99
ffi::Py_uintptr_t,
1010
types::{PyAnyMethods, PyModule},
11-
PyErr, PyObject, Python,
11+
Py, PyAny, PyErr, Python,
1212
};
1313

1414
use crate::{
@@ -17,7 +17,7 @@ use crate::{
1717
};
1818

1919
pub fn response_to_pyarrow(response: hypersync_client::ArrowResponse) -> Result<ArrowResponse> {
20-
let data = Python::with_gil(|py| {
20+
let data = Python::attach(|py| {
2121
let pyarrow = py.import("pyarrow")?;
2222
Ok::<_, PyErr>(ArrowResponseData {
2323
blocks: convert_batches_to_pyarrow_table(py, &pyarrow, response.data.blocks)?,
@@ -52,7 +52,7 @@ fn convert_batches_to_pyarrow_table<'py>(
5252
py: Python<'py>,
5353
pyarrow: &pyo3::Bound<'py, PyModule>,
5454
batches: Vec<ArrowBatch>,
55-
) -> Result<PyObject> {
55+
) -> Result<Py<PyAny>> {
5656
if batches.is_empty() {
5757
return Ok(py.None());
5858
}

‎src/decode.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Decoder {
4343

4444
future_into_py(py, async move {
4545
Ok(tokio::task::spawn_blocking(move || {
46-
Python::with_gil(|py| decoder.decode_logs_sync(logs, py))
46+
Python::attach(|py| decoder.decode_logs_sync(logs, py))
4747
})
4848
.await
4949
.unwrap())
@@ -65,7 +65,7 @@ impl Decoder {
6565

6666
future_into_py(py, async move {
6767
Ok(tokio::task::spawn_blocking(move || {
68-
Python::with_gil(|py| decoder.decode_events_sync(events, py))
68+
Python::attach(|py| decoder.decode_events_sync(events, py))
6969
})
7070
.await
7171
.unwrap())

‎src/decode_call.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl CallDecoder {
4343

4444
future_into_py(py, async move {
4545
let result = tokio::task::spawn_blocking(move || {
46-
Python::with_gil(|py| decoder.decode_inputs_sync(input, py))
46+
Python::attach(|py| decoder.decode_inputs_sync(input, py))
4747
})
4848
.await
4949
.unwrap();
@@ -60,7 +60,7 @@ impl CallDecoder {
6060

6161
future_into_py(py, async move {
6262
let result = tokio::task::spawn_blocking(move || {
63-
Python::with_gil(|py| decoder.decode_transactions_input_sync(txs, py))
63+
Python::attach(|py| decoder.decode_transactions_input_sync(txs, py))
6464
})
6565
.await
6666
.unwrap();
@@ -77,7 +77,7 @@ impl CallDecoder {
7777

7878
future_into_py(py, async move {
7979
let result = tokio::task::spawn_blocking(move || {
80-
Python::with_gil(|py| decoder.decode_traces_input_sync(traces, py))
80+
Python::attach(|py| decoder.decode_traces_input_sync(traces, py))
8181
})
8282
.await
8383
.unwrap();

‎src/response.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::sync::Arc;
22

33
use anyhow::{Context, Result};
4-
use pyo3::{pyclass, pymethods, Bound, PyAny, PyErr, PyObject, PyResult, Python};
4+
use pyo3::{pyclass, pymethods, Bound, Py, PyAny, PyErr, PyResult, Python};
55
use pyo3_async_runtimes::tokio::future_into_py;
66
use tokio::sync::mpsc;
77

@@ -32,16 +32,16 @@ pub struct ArrowResponse {
3232
#[pyo3(get_all)]
3333
#[derive(Debug)]
3434
pub struct ArrowResponseData {
35-
pub blocks: PyObject,
36-
pub transactions: PyObject,
37-
pub logs: PyObject,
38-
pub traces: PyObject,
39-
pub decoded_logs: PyObject,
35+
pub blocks: Py<PyAny>,
36+
pub transactions: Py<PyAny>,
37+
pub logs: Py<PyAny>,
38+
pub traces: Py<PyAny>,
39+
pub decoded_logs: Py<PyAny>,
4040
}
4141

4242
impl Clone for ArrowResponseData {
4343
fn clone(&self) -> Self {
44-
Python::with_gil(|py| Self {
44+
Python::attach(|py| Self {
4545
blocks: self.blocks.clone_ref(py),
4646
transactions: self.transactions.clone_ref(py),
4747
logs: self.logs.clone_ref(py),

‎src/types.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use alloy_primitives::{Signed, U256};
55
use anyhow::{Context, Result};
66
use hypersync_client::{format, format::Hex, net_types, simple_types};
77
use num_bigint::{BigInt, BigUint};
8-
use pyo3::{pyclass, IntoPyObject, PyObject, Python};
8+
use pyo3::{pyclass, IntoPyObject, Py, PyAny, Python};
99
use serde::{Deserialize, Serialize};
1010

1111
/// Data relating to a single event (log)
@@ -208,12 +208,12 @@ pub struct DecodedEvent {
208208
#[pyclass]
209209
#[pyo3(get_all)]
210210
pub struct DecodedSolValue {
211-
pub val: PyObject,
211+
pub val: Py<PyAny>,
212212
}
213213

214214
impl Clone for DecodedSolValue {
215215
fn clone(&self) -> Self {
216-
Python::with_gil(|py| Self {
216+
Python::attach(|py| Self {
217217
val: self.val.clone_ref(py),
218218
})
219219
}

0 commit comments

Comments
 (0)