Skip to content

Commit b648113

Browse files
committed
support python 3.13
1 parent e471ea9 commit b648113

File tree

13 files changed

+856
-699
lines changed

13 files changed

+856
-699
lines changed

connectorx-python/Cargo.lock

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

connectorx-python/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ connectorx = {path = "../connectorx", default-features = false}
2222
env_logger = "0.9"
2323
fehler = "1"
2424
itertools = "0.10"
25-
lazy_static = "1.4.0"
25+
lazy_static = "1.4"
2626
libc = "0.2"
2727
log = "0.4"
2828
ndarray = "0.15"
29-
numpy = "0.21"
29+
numpy = {version = "0.22", features = ["gil-refs"]}
3030
openssl = {version = "0.10", features = ["vendored"]}
3131
postgres = {version = "0.19", features = ["with-chrono-0_4", "with-uuid-0_8", "with-serde_json-1"]}
3232
postgres-native-tls = {version = "0.5"}
3333
postgres-openssl = {version = "0.5.0"}
34-
pyo3 = {version = "0.21", default-features = false, features = ["macros"]}
34+
pyo3 = {version = "0.22", default-features = false, features = ["macros", "gil-refs", "py-clone"]}
3535
pyo3-built = "0.5"
3636
rust_decimal = {version = "1", features = ["db-postgres"]}
3737
serde_json = "1"
@@ -46,7 +46,7 @@ rayon = "1"
4646

4747
[build-dependencies]
4848
built = {version = "0.5", features = ["chrono"]}
49-
pyo3-build-config = {version = "0.21", features = ["resolve-config"]}
49+
pyo3-build-config = {version = "0.22", features = ["resolve-config"]}
5050

5151
[dev-dependencies]
5252
criterion = "0.3"

connectorx-python/poetry.lock

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

connectorx-python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ numpy = ">=1.26"
3333
pandas = {version = "^2", optional = true}
3434
polars = {version = ">=0.8", optional = true}
3535
pyarrow = {version = ">=4", optional = true}
36-
python = ">=3.9,<3.13"
36+
python = ">=3.9,<3.14"
3737

3838
[tool.poetry.extras]
3939
all = ["dask", "pandas", "modin", "polars", "pyarrow"]

connectorx-python/src/pandas/pandas_columns/array.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ unsafe impl Element for PyList {
1818
fn get_dtype_bound(py: Python<'_>) -> Bound<'_, PyArrayDescr> {
1919
PyArrayDescr::object_bound(py)
2020
}
21+
22+
fn clone_ref(&self, _py: Python<'_>) -> Self {
23+
Self(self.0.clone())
24+
}
2125
}
2226

2327
pub struct ArrayBlock<'a, V> {
@@ -37,6 +41,10 @@ impl<'a, V> FromPyObject<'a> for ArrayBlock<'a, V> {
3741
_value_type: PhantomData,
3842
})
3943
}
44+
45+
fn extract_bound(ob: &pyo3::Bound<'a, PyAny>) -> PyResult<Self> {
46+
Self::extract(ob.clone().into_gil_ref())
47+
}
4048
}
4149

4250
impl<'a, V> ArrayBlock<'a, V> {

connectorx-python/src/pandas/pandas_columns/boolean.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ impl<'a> FromPyObject<'a> for BooleanBlock<'a> {
3333
))
3434
}
3535
}
36+
37+
fn extract_bound(ob: &pyo3::Bound<'a, PyAny>) -> PyResult<Self> {
38+
Self::extract(ob.clone().into_gil_ref())
39+
}
3640
}
3741

3842
impl<'a> BooleanBlock<'a> {

connectorx-python/src/pandas/pandas_columns/bytes.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ unsafe impl Element for PyBytes {
1717
fn get_dtype_bound(py: Python<'_>) -> Bound<'_, PyArrayDescr> {
1818
PyArrayDescr::object_bound(py)
1919
}
20+
21+
fn clone_ref(&self, _py: Python<'_>) -> Self {
22+
Self(self.0.clone())
23+
}
2024
}
2125

2226
pub struct BytesBlock<'a> {
@@ -34,6 +38,10 @@ impl<'a> FromPyObject<'a> for BytesBlock<'a> {
3438
buf_size_mb: 16, // in MB
3539
})
3640
}
41+
42+
fn extract_bound(ob: &pyo3::Bound<'a, PyAny>) -> PyResult<Self> {
43+
Self::extract(ob.clone().into_gil_ref())
44+
}
3745
}
3846

3947
impl<'a> BytesBlock<'a> {

connectorx-python/src/pandas/pandas_columns/datetime.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ impl<'a> FromPyObject<'a> for DateTimeBlock<'a> {
2121
let data = unsafe { array.as_array_mut() };
2222
Ok(DateTimeBlock { data })
2323
}
24+
25+
fn extract_bound(ob: &pyo3::Bound<'a, PyAny>) -> PyResult<Self> {
26+
Self::extract(ob.clone().into_gil_ref())
27+
}
2428
}
2529

2630
impl<'a> DateTimeBlock<'a> {

connectorx-python/src/pandas/pandas_columns/float64.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ impl<'a> FromPyObject<'a> for Float64Block<'a> {
1919
let data = unsafe { array.as_array_mut() };
2020
Ok(Float64Block { data })
2121
}
22+
23+
fn extract_bound(ob: &pyo3::Bound<'a, PyAny>) -> PyResult<Self> {
24+
Self::extract(ob.clone().into_gil_ref())
25+
}
2226
}
2327

2428
impl<'a> Float64Block<'a> {

connectorx-python/src/pandas/pandas_columns/int64.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ impl<'a> FromPyObject<'a> for Int64Block<'a> {
3030
))
3131
}
3232
}
33+
34+
fn extract_bound(ob: &pyo3::Bound<'a, PyAny>) -> PyResult<Self> {
35+
Self::extract(ob.clone().into_gil_ref())
36+
}
3337
}
3438

3539
impl<'a> Int64Block<'a> {

connectorx-python/src/pandas/pandas_columns/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,18 @@ pub fn check_dtype(ob: &PyAny, expected_dtype: &str) -> PyResult<()> {
5858
}
5959
Ok(())
6060
}
61+
62+
// pub fn check_bound_dtype<'py>(ob: &pyo3::Bound<'py, PyAny>, expected_dtype: &str) -> PyResult<()> {
63+
// let dtype = ob.getattr(intern!(ob.py(), "dtype"))?.str()?;
64+
// // https://pyo3.rs/main/doc/pyo3/types/struct.pystring#equality
65+
// if dtype != expected_dtype {
66+
// throw!(PyRuntimeError::new_err(format!(
67+
// "expecting ndarray to be '{}' found '{}' at {}:{}",
68+
// expected_dtype,
69+
// dtype,
70+
// file!(),
71+
// line!()
72+
// )));
73+
// }
74+
// Ok(())
75+
// }

connectorx-python/src/pandas/pandas_columns/string.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ impl<'a> FromPyObject<'a> for StringBlock<'a> {
2525
buf_size_mb: PYSTRING_BUFFER_SIZE, // in MB
2626
})
2727
}
28+
29+
fn extract_bound(ob: &pyo3::Bound<'a, PyAny>) -> PyResult<Self> {
30+
Self::extract(ob.clone().into_gil_ref())
31+
}
2832
}
2933

3034
impl<'a> StringBlock<'a> {

connectorx-python/src/pandas/pystring.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ unsafe impl Element for PyString {
1313
fn get_dtype_bound(py: Python<'_>) -> Bound<'_, PyArrayDescr> {
1414
PyArrayDescr::object_bound(py)
1515
}
16+
17+
fn clone_ref(&self, _py: Python<'_>) -> Self {
18+
Self(self.0.clone())
19+
}
1620
}
1721

1822
#[derive(Clone, Copy, Debug)]

0 commit comments

Comments
 (0)