Crates.io | pyo3-object_store |
lib.rs | pyo3-object_store |
version | 0.1.0-beta.1 |
source | src |
created_at | 2024-11-01 21:56:30.787772 |
updated_at | 2024-11-01 21:56:30.787772 |
description | object_store integration for pyo3. |
homepage | |
repository | https://github.com/developmentseed/obstore |
max_upload_size | |
id | 1432395 |
size | 66,416 |
Integration between object_store
and pyo3
.
This provides Python builder classes so that Python users can easily create Arc<dyn ObjectStore>
instances, which can then be used in pure-Rust code.
Register the builders.
#[pymodule]
fn python_module(py: Python, m: &Bound<PyModule>) -> PyResult<()> {
pyo3_object_store::register_store_module(py, m, "python_module")?;
pyo3_object_store::register_exceptions_module(py, m, "python_module")?;
}
This exports the underlying Python classes from your own Rust-Python library.
Accept PyObjectStore
as a parameter in your function exported to Python. Its into_inner
method gives you an Arc<dyn ObjectStore>
.
#[pyfunction]
pub fn use_object_store(store: PyObjectStore) {
let store: Arc<dyn ObjectStore> = store.into_inner();
}
The obstore
Python library gives a full real-world example of using pyo3-object_store
. It
Note about not being able to use these across Python packages. It has to be used with the exported classes from your own library.