Open
Description
in lib.rs
:
use once_cell::sync::Lazy;
pub(crate) static POLARS: Lazy<PyObject> = Lazy::new(|| {
Python::with_gil(|py| PyModule::import_bound(py, "polars").unwrap().to_object(py))
});
pub(crate) static SERIES: Lazy<PyObject> =
Lazy::new(|| Python::with_gil(|py| POLARS.getattr(py, "Series").unwrap()));
we could remove this dependency on once_cell by using LazyLock
in std::sync
use std::sync::LazyLock;
pub(crate) static POLARS: LazyLock<Py<PyModule>> = LazyLock::new(|| {
Python::with_gil(|py| {
let x = PyModule::import(py, "polars").unwrap().unbind();
x
})
});
pub(crate) static SERIES: LazyLock<PyObject> =
LazyLock::new(|| Python::with_gil(|py| POLARS.getattr(py, "Series").unwrap()));
benefit: drops an external dependency on once_cell
downside: may increase MSRV (minimum supported rust version)
Metadata
Metadata
Assignees
Labels
No labels