diff --git a/Cargo.toml b/Cargo.toml index 7e99523..18a0716 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,8 @@ members = [ ] [workspace.dependencies] -polars = { version = "0.38.0", default-features = false } -polars-core = { version = "0.38.0", default-features = false } -polars-ffi = { version = "0.38.0", default-features = false } -polars-plan = { version = "0.38.0", default-feautres = false } -polars-lazy = { version = "0.38.0", default-features = false } +polars = { version = "0.39.0", default-features = false } +polars-core = { version = "0.39.0", default-features = false } +polars-ffi = { version = "0.39.0", default-features = false } +polars-plan = { version = "0.39.0", default-feautres = false } +polars-lazy = { version = "0.39.0", default-features = false } diff --git a/example/derive_expression/expression_lib/Cargo.toml b/example/derive_expression/expression_lib/Cargo.toml index 75ea2d5..8057b19 100644 --- a/example/derive_expression/expression_lib/Cargo.toml +++ b/example/derive_expression/expression_lib/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib"] [dependencies] polars = { workspace = true, features = ["fmt", "dtype-date", "timezones"], default-features = false } -pyo3 = { version = "0.20", features = ["abi3-py38"] } +pyo3 = { version = "0.21", features = ["abi3-py38"] } pyo3-polars = { version = "*", path = "../../../pyo3-polars", features = ["derive"] } serde = { version = "1", features = ["derive"] } rayon = "1.7.0" diff --git a/example/derive_expression/expression_lib/src/distances.rs b/example/derive_expression/expression_lib/src/distances.rs index 943aa4a..beabf73 100644 --- a/example/derive_expression/expression_lib/src/distances.rs +++ b/example/derive_expression/expression_lib/src/distances.rs @@ -1,4 +1,3 @@ -use polars::datatypes::PlHashSet; use polars::export::arrow::array::PrimitiveArray; use polars::export::num::Float; use polars::prelude::*; diff --git a/example/derive_expression/expression_lib/src/expressions.rs b/example/derive_expression/expression_lib/src/expressions.rs index c41640e..cc0e75e 100644 --- a/example/derive_expression/expression_lib/src/expressions.rs +++ b/example/derive_expression/expression_lib/src/expressions.rs @@ -196,12 +196,14 @@ fn convert_timezone(input_fields: &[Field], kwargs: TimeZone) -> PolarsResult PolarsResult { let input = &input[0]; let ca = input.datetime()?; - ca.clone() - .convert_time_zone(kwargs.tz) - .map(|ca| ca.into_series()) + let mut out = ca.clone(); + out.set_time_zone(kwargs.tz)?; + Ok(out.into_series()) } diff --git a/example/extend_polars_python_dispatch/extend_polars/Cargo.toml b/example/extend_polars_python_dispatch/extend_polars/Cargo.toml index aea69da..d24467e 100644 --- a/example/extend_polars_python_dispatch/extend_polars/Cargo.toml +++ b/example/extend_polars_python_dispatch/extend_polars/Cargo.toml @@ -12,6 +12,6 @@ crate-type = ["cdylib"] polars = { workspace = true, features = ["fmt"] } polars-core = { workspace = true } polars-lazy = { workspace = true } -pyo3 = { version = "0.20", features = ["extension-module"] } +pyo3 = { version = "0.21", features = ["extension-module"] } pyo3-polars = { version = "*", path = "../../../pyo3-polars", features = ["lazy"] } -rayon = "1.6" +rayon = "1.10" diff --git a/pyo3-polars-derive/Cargo.toml b/pyo3-polars-derive/Cargo.toml index e9dc992..1e415d7 100644 --- a/pyo3-polars-derive/Cargo.toml +++ b/pyo3-polars-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3-polars-derive" -version = "0.6.0" +version = "0.7.0" edition = "2021" license = "MIT" readme = "README.md" diff --git a/pyo3-polars-derive/src/attr.rs b/pyo3-polars-derive/src/attr.rs index 21838bf..e642068 100644 --- a/pyo3-polars-derive/src/attr.rs +++ b/pyo3-polars-derive/src/attr.rs @@ -6,6 +6,7 @@ use syn::Token; #[derive(Clone, Debug)] pub struct KeyWordAttribute { + #[allow(dead_code)] pub kw: K, pub value: V, } diff --git a/pyo3-polars/Cargo.toml b/pyo3-polars/Cargo.toml index 6071faa..ec879fe 100644 --- a/pyo3-polars/Cargo.toml +++ b/pyo3-polars/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3-polars" -version = "0.12.0" +version = "0.13.0" edition = "2021" license = "MIT" readme = "../README.md" @@ -16,8 +16,8 @@ polars-core = { workspace = true, default-features = false } polars-ffi = { workspace = true, optional = true } polars-lazy = { workspace = true, optional = true } polars-plan = { workspace = true, optional = true } -pyo3 = "0.20.0" -pyo3-polars-derive = { version = "0.6.0", path = "../pyo3-polars-derive", optional = true } +pyo3 = "0.21.0" +pyo3-polars-derive = { version = "0.7.0", path = "../pyo3-polars-derive", optional = true } serde = { version = "1", optional = true } serde-pickle = { version = "1", optional = true } thiserror = "1" diff --git a/pyo3-polars/src/ffi/to_py.rs b/pyo3-polars/src/ffi/to_py.rs index 9b4fa3a..e6debf9 100644 --- a/pyo3-polars/src/ffi/to_py.rs +++ b/pyo3-polars/src/ffi/to_py.rs @@ -4,7 +4,11 @@ use pyo3::ffi::Py_uintptr_t; use pyo3::prelude::*; /// Arrow array to Python. -pub(crate) fn to_py_array(array: ArrayRef, py: Python, pyarrow: &PyModule) -> PyResult { +pub(crate) fn to_py_array( + array: ArrayRef, + py: Python, + pyarrow: Bound<'_, PyModule>, +) -> PyResult { let schema = Box::new(ffi::export_field_to_c(&ArrowField::new( "", array.data_type().clone(), diff --git a/pyo3-polars/src/lib.rs b/pyo3-polars/src/lib.rs index 3e4479b..eec501f 100644 --- a/pyo3-polars/src/lib.rs +++ b/pyo3-polars/src/lib.rs @@ -53,7 +53,7 @@ use crate::ffi::to_py::to_py_array; use polars::export::arrow; use polars::prelude::*; use pyo3::ffi::Py_uintptr_t; -use pyo3::{FromPyObject, IntoPy, PyAny, PyObject, PyResult, Python, ToPyObject}; +use pyo3::prelude::*; #[cfg(feature = "lazy")] use {polars_lazy::frame::LazyFrame, polars_plan::logical_plan::LogicalPlan}; @@ -162,7 +162,7 @@ impl<'a> FromPyObject<'a> for PyLazyFrame { impl IntoPy for PySeries { fn into_py(self, py: Python<'_>) -> PyObject { - let polars = py.import("polars").expect("polars not installed"); + let polars = py.import_bound("polars").expect("polars not installed"); let s = polars.getattr("Series").unwrap(); match s.getattr("_import_from_c") { // Go via polars @@ -208,7 +208,7 @@ impl IntoPy for PySeries { let s = self.0.rechunk(); let name = s.name(); let arr = s.to_arrow(0, false); - let pyarrow = py.import("pyarrow").expect("pyarrow not installed"); + let pyarrow = py.import_bound("pyarrow").expect("pyarrow not installed"); let arg = to_py_array(arr, py, pyarrow).unwrap(); let s = polars.call_method1("from_arrow", (arg,)).unwrap(); @@ -228,7 +228,7 @@ impl IntoPy for PyDataFrame { .map(|s| PySeries(s.clone()).into_py(py)) .collect::>(); - let polars = py.import("polars").expect("polars not installed"); + let polars = py.import_bound("polars").expect("polars not installed"); let df_object = polars.call_method1("DataFrame", (pyseries,)).unwrap(); df_object.into_py(py) } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 4a5741c..9b6fc43 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly-2023-10-12" +channel = "nightly-2024-03-28"