From 77dc889968a94ea1ae2b68422cc9fd0ea7c0f594 Mon Sep 17 00:00:00 2001 From: Andrej Orsula Date: Thu, 9 May 2024 16:32:03 +0200 Subject: [PATCH] Bump to 0.5.0 Signed-off-by: Andrej Orsula --- Cargo.lock | 10 +++++----- Cargo.toml | 8 ++++---- README.md | 7 +++++-- pyo3_bindgen/src/lib.rs | 4 ++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 314d4a0..b343dce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -282,7 +282,7 @@ checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "examples" -version = "0.4.1" +version = "0.5.0" dependencies = [ "pyo3", "pyo3_bindgen", @@ -582,7 +582,7 @@ dependencies = [ [[package]] name = "pyo3_bindgen" -version = "0.4.1" +version = "0.5.0" dependencies = [ "pyo3", "pyo3_bindgen_engine", @@ -591,7 +591,7 @@ dependencies = [ [[package]] name = "pyo3_bindgen_cli" -version = "0.4.1" +version = "0.5.0" dependencies = [ "assert_cmd", "clap", @@ -603,7 +603,7 @@ dependencies = [ [[package]] name = "pyo3_bindgen_engine" -version = "0.4.1" +version = "0.5.0" dependencies = [ "criterion", "indoc", @@ -621,7 +621,7 @@ dependencies = [ [[package]] name = "pyo3_bindgen_macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "libc", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index 307f775..443a5c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,12 +28,12 @@ license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/AndrejOrsula/pyo3_bindgen" rust-version = "1.74" -version = "0.4.1" +version = "0.5.0" [workspace.dependencies] -pyo3_bindgen = { path = "pyo3_bindgen", version = "0.4.1" } -pyo3_bindgen_engine = { path = "pyo3_bindgen_engine", version = "0.4.1" } -pyo3_bindgen_macros = { path = "pyo3_bindgen_macros", version = "0.4.1" } +pyo3_bindgen = { path = "pyo3_bindgen", version = "0.5.0" } +pyo3_bindgen_engine = { path = "pyo3_bindgen_engine", version = "0.5.0" } +pyo3_bindgen_macros = { path = "pyo3_bindgen_macros", version = "0.5.0" } assert_cmd = { version = "2" } clap = { version = "4.5", features = ["derive"] } diff --git a/README.md b/README.md index fbefbdf..5dad593 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,9 @@ This project is intended to simplify the integration or transition of existing P On its own, the generated Rust code does not provide any performance benefits over using the Python code. However, it can be used as a starting point for further optimization if you decide to rewrite performance-critical parts of your codebase in pure Rust. +> \[!NOTE\] +> Version `0.5` of `pyo3_bindgen` adapts the new `pyo3::Bound<'py, T>` smart pointer that was introduced in `pyo3` version `0.21`. Use version `0.4` of `pyo3_bindgen` if you require the old "GIL Refs" API. + ## Overview The workspace contains these packages: @@ -91,7 +94,7 @@ First, add `pyo3_bindgen` as a **build dependency** to your [`Cargo.toml`](https ```toml [build-dependencies] -pyo3_bindgen = { version = "0.4" } +pyo3_bindgen = { version = "0.5" } [dependencies] pyo3 = { version = "0.21", features = ["auto-initialize"] } @@ -141,7 +144,7 @@ As an alternative to build scripts, you can use procedural macros to generate th ```toml [dependencies] -pyo3_bindgen = { version = "0.4" } +pyo3_bindgen = { version = "0.5" } ``` Subsequently, the `import_python!` macro can be used to generate Rust bindings for the selected Python modules anywhere in your crate. As demonstrated in the example below, Rust bindings are generated for the "math" Python module and can directly be used in the same scope. Similar to the previous approach, the generated bindings must be used within the `pyo3::Python::with_gil` closure to ensure that Python [GIL](https://wiki.python.org/moin/GlobalInterpreterLock) is held. diff --git a/pyo3_bindgen/src/lib.rs b/pyo3_bindgen/src/lib.rs index ce17ff5..fd2c2a0 100644 --- a/pyo3_bindgen/src/lib.rs +++ b/pyo3_bindgen/src/lib.rs @@ -16,7 +16,7 @@ //! //! ```toml //! [build-dependencies] -//! pyo3_bindgen = { version = "0.4" } +//! pyo3_bindgen = { version = "0.5" } //! //! [dependencies] //! pyo3 = { version = "0.21", features = ["auto-initialize"] } @@ -66,7 +66,7 @@ //! //! ```toml //! [dependencies] -//! pyo3_bindgen = { version = "0.4" } +//! pyo3_bindgen = { version = "0.5" } //! ``` //! //! Subsequently, the `import_python!` macro can be used to generate Rust bindings for the selected Python modules anywhere in your crate. As demonstrated in the example below, Rust bindings are generated for the "math" Python module and can directly be used in the same scope. Similar to the previous approach, the generated bindings must be used within the `pyo3::Python::with_gil` closure to ensure that Python [GIL](https://wiki.python.org/moin/GlobalInterpreterLock) is held.