Skip to content

Commit

Permalink
crates/python: Add numpy as dependency and py03 as dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
etemesi254 committed Oct 24, 2023
1 parent 35a54ac commit 0096e60
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 352 deletions.
5 changes: 3 additions & 2 deletions crates/zune-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ zune-png = { path = "../zune-png" }
zune-jpeg = { path = "../zune-jpeg" }
zune-image = { path = "../zune-image" }
zune-core = { path = "../zune-core" }
zune-imageprocs = { path = "../zune-imageprocs",features = ["threads"] }
numpy = "0.20.0"
zune-imageprocs = { path = "../zune-imageprocs", features = ["threads", "exif"] }
numpy = "0.20.0"
pyo3-log = "0.9.0"
1 change: 1 addition & 0 deletions crates/zune-python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy",
]
dynamic = ["version"]
dependencies=["numpy>=1.16"]

[tool.maturin]
features = ["pyo3/extension-module"]
7 changes: 7 additions & 0 deletions crates/zune-python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ mod py_enums;
mod py_functions;
mod py_image;


#[pyfunction]
#[allow(unused_results)]
pub fn init_logger(){
let _= pyo3_log::try_init();
}
/// A Python module implemented in Rust.
#[pymodule]
#[pyo3(name = "zil")]
Expand All @@ -25,6 +31,7 @@ fn zune_image(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_class::<ZImage>()?;
m.add_class::<ZImageDepth>()?;
m.add_class::<ZImageThresholdType>()?;
m.add_function(wrap_pyfunction!(init_logger, m)?)?;

m.add_function(wrap_pyfunction!(guess_format, m)?)?;
m.add_function(wrap_pyfunction!(decode_image, m)?)?;
Expand Down
2 changes: 0 additions & 2 deletions crates/zune-python/src/py_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@ pub fn guess_format(bytes: &[u8]) -> PyResult<ZImageFormats> {
None => Ok(ZImageFormats::Unknown)
}
}


Loading

0 comments on commit 0096e60

Please sign in to comment.