upgrade to pyo3 0.20

- no relevant changes in 0.18 -> 0.19
- two relevant change in 0.19 -> 0.20
https://pyo3.rs/main/migration.html#from-019-to-020
  - minimum Rust version raised to 1.56
  - removed #[args] in favour of #[pyo3(signature=...)]
This commit is contained in:
Johann150
2026-04-14 20:40:50 +02:00
parent 12c4e19d97
commit fb04c505eb
6 changed files with 74 additions and 34 deletions
+1 -1
View File
@@ -147,7 +147,7 @@ jobs:
platform:
[
{
toolchain: "1.53",
toolchain: "1.56",
manylinux: "2014",
target: "x86_64-unknown-linux-gnu",
arch: "x86_64",
+5
View File
@@ -5,6 +5,11 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a Ch
## Unreleased
---
### Changes
* Update PyO3 dependency to `0.20`.
### Breaks
* Minimum Rust version is now `1.56`.
## 0.6.0 - (2022-07-17)
---
Generated
+54 -19
View File
@@ -129,6 +129,12 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "idna"
version = "0.2.3"
@@ -142,9 +148,12 @@ dependencies = [
[[package]]
name = "indoc"
version = "1.0.9"
version = "2.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306"
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
dependencies = [
"rustversion",
]
[[package]]
name = "itertools"
@@ -184,9 +193,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
version = "0.8.0"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
dependencies = [
"autocfg",
]
@@ -250,6 +259,12 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "portable-atomic"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
[[package]]
name = "proc-macro2"
version = "1.0.106"
@@ -276,15 +291,16 @@ checksum = "e8eda7c62d9ecaafdf8b62374c006de0adf61666ae96a96ba74a37134aa4e470"
[[package]]
name = "pyo3"
version = "0.18.3"
version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3b1ac5b3731ba34fdaa9785f8d74d17448cd18f30cf19e0c7e7b1fdb5272109"
checksum = "53bdbb96d49157e65d45cc287af5f32ffadd5f4761438b527b055fb0d4bb8233"
dependencies = [
"cfg-if",
"indoc",
"libc",
"memoffset",
"parking_lot",
"portable-atomic",
"pyo3-build-config",
"pyo3-ffi",
"pyo3-macros",
@@ -293,9 +309,9 @@ dependencies = [
[[package]]
name = "pyo3-build-config"
version = "0.18.3"
version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cb946f5ac61bb61a5014924910d936ebd2b23b705f7a4a3c40b05c720b079a3"
checksum = "deaa5745de3f5231ce10517a1f5dd97d53e5a2fd77aa6b5842292085831d48d7"
dependencies = [
"once_cell",
"target-lexicon",
@@ -303,9 +319,9 @@ dependencies = [
[[package]]
name = "pyo3-ffi"
version = "0.18.3"
version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd4d7c5337821916ea2a1d21d1092e8443cf34879e53a0ac653fbb98f44ff65c"
checksum = "62b42531d03e08d4ef1f6e85a2ed422eb678b8cd62b762e53891c05faf0d4afa"
dependencies = [
"libc",
"pyo3-build-config",
@@ -313,25 +329,27 @@ dependencies = [
[[package]]
name = "pyo3-macros"
version = "0.18.3"
version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9d39c55dab3fc5a4b25bbd1ac10a2da452c4aca13bb450f22818a002e29648d"
checksum = "7305c720fa01b8055ec95e484a6eca7a83c841267f0dd5280f0c8b8551d2c158"
dependencies = [
"proc-macro2",
"pyo3-macros-backend",
"quote",
"syn",
"syn 2.0.117",
]
[[package]]
name = "pyo3-macros-backend"
version = "0.18.3"
version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97daff08a4c48320587b5224cc98d609e3c27b6d437315bd40b605c98eeb5918"
checksum = "7c7e9b68bb9c3149c5b0cade5d07f953d6d125eb4337723c4ccdb665f1f96185"
dependencies = [
"heck",
"proc-macro2",
"pyo3-build-config",
"quote",
"syn",
"syn 2.0.117",
]
[[package]]
@@ -402,6 +420,12 @@ dependencies = [
"serde",
]
[[package]]
name = "rustversion"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "scopeguard"
version = "1.2.0"
@@ -431,7 +455,7 @@ checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.98",
]
[[package]]
@@ -451,6 +475,17 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "target-lexicon"
version = "0.12.16"
@@ -511,9 +546,9 @@ dependencies = [
[[package]]
name = "unindent"
version = "0.1.11"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c"
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
[[package]]
name = "url"
+1 -1
View File
@@ -14,7 +14,7 @@ debug = true
[dependencies]
adblock = { version = "=0.5.6", default-features = false, features = ["full-regex-handling", "embedded-domain-resolver"] }
pyo3 = { version = "0.18", features = ["abi3-py37", "extension-module"] }
pyo3 = { version = "0.20", features = ["abi3-py37", "extension-module"] }
[lib]
name = "adblock"
+1 -1
View File
@@ -9,7 +9,7 @@ Python wrapper for Brave's adblocking library, which is written in Rust.
| Build Dependency | Versions | Arch Linux | Url |
| ---------------- | -------- | ---------- | ------------------------------- |
| Python | `>=3.7` | `python` | - |
| Rust | `>=1.53` | `rust` | - |
| Rust | `>=1.56` | `rust` | - |
| Maturin | `>=0.10` | `maturin` | https://github.com/PyO3/maturin |
#### PEP 517
+12 -12
View File
@@ -265,7 +265,7 @@ impl FilterSet {
/// the more compact internal representation. If enabled, this information
/// will be passed to the corresponding Engine.
#[new]
#[args(debug = false)]
#[pyo3(signature = (debug=false))]
pub fn new(debug: bool) -> Self {
Self {
filter_set: RustFilterSet::new(debug),
@@ -278,12 +278,12 @@ impl FilterSet {
///
/// The format is a string containing either "standard" (ABP/uBO-style)
/// or "hosts".
#[args(
#[pyo3(signature = (
filter_list,
format = "\"standard\"",
include_redirect_urls = "false",
rule_types = "\"all\""
)]
format = "standard",
include_redirect_urls = false,
rule_types = "all"
))]
pub fn add_filter_list(
&mut self,
filter_list: &str,
@@ -309,12 +309,12 @@ impl FilterSet {
///
/// The format is a string containing either "standard" (ABP/uBO-style)
/// or "hosts".
#[args(
#[pyo3(signature = (
filters,
format = "\"standard\"",
include_redirect_urls = "false",
rule_types = "\"all\""
)]
format = "standard",
include_redirect_urls = false,
rule_types = "all"
))]
pub fn add_filters(
&mut self,
filters: Vec<String>,
@@ -424,7 +424,7 @@ pub struct Engine {
impl Engine {
/// Create a new adblocking engine
#[new]
#[args(filter_set, optimize = true)]
#[pyo3(signature = (filter_set, optimize = true))]
pub fn new(filter_set: FilterSet, optimize: bool) -> Self {
let engine = RustEngine::from_filter_set(filter_set.filter_set, optimize);
Self { engine, optimize }