From 3a24f6de8c03d202e9f65dd90b4b01cd4929fd98 Mon Sep 17 00:00:00 2001 From: Guilhem Bonnefille Date: Mon, 22 Dec 2025 14:21:01 +0100 Subject: [PATCH 1/2] feat: add python support from Rust Using pyo3. --- pdl-compiler/src/backends/rust/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pdl-compiler/src/backends/rust/mod.rs b/pdl-compiler/src/backends/rust/mod.rs index d37eca7..ae16f6c 100644 --- a/pdl-compiler/src/backends/rust/mod.rs +++ b/pdl-compiler/src/backends/rust/mod.rs @@ -527,6 +527,7 @@ fn generate_root_packet_decl( quote! { #[derive(Debug, Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] + #[cfg_attr(feature = "python", pyo3::pyclass(get_all, set_all))] pub struct #name { #( pub #data_field_ids: #data_field_types, )* #payload_field From 9a52cdf60f7872fda6d91c7ce5511495d1d91a5f Mon Sep 17 00:00:00 2001 From: Guilhem Bonnefille Date: Tue, 6 Jan 2026 09:07:37 +0100 Subject: [PATCH 2/2] fix: declare python feature Once enabled, it is possible to check the real impact of this change on tests. --- pdl-tests/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pdl-tests/Cargo.toml b/pdl-tests/Cargo.toml index 2d0345f..3022aae 100644 --- a/pdl-tests/Cargo.toml +++ b/pdl-tests/Cargo.toml @@ -6,7 +6,9 @@ edition = "2021" description = "PDL Rust generated code tests" [features] +default = ["python"] serde = [] +python = [] [dependencies] bytes = "1.4.0" @@ -19,3 +21,4 @@ proc-macro2 = "1.0.66" quote = "1.0.33" syn = {version = "2.0.29", features = ["full"]} termcolor = "1.2.0" +pyo3 = "0.27.2"