Skip to content

🐛 Pin pyo3 to 0.27.1 and pyo3-stub-gen to 0.21.0#115

Merged
pierre-rouanet merged 1 commit into
pollen-robotics:developfrom
jurmy24:fix/pyo3-dependencies
May 26, 2026
Merged

🐛 Pin pyo3 to 0.27.1 and pyo3-stub-gen to 0.21.0#115
pierre-rouanet merged 1 commit into
pollen-robotics:developfrom
jurmy24:fix/pyo3-dependencies

Conversation

@jurmy24

@jurmy24 jurmy24 commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Pin pyo3 and pyo3-stub-gen to the last versions compatible with the current macro-generated Python bindings so the python feature builds again.

Problem

Building with the python feature (e.g. cargo run --bin stub_gen --features python or maturin develop --features python --features pyo3/extension-module) failed with a bunch of errors like:

error[E0034]: multiple applicable items in scope --> src/servo/servo_macro.rs:NNN:22 | NNN | ) -> PyResult<PyObject> { | ^^^^^^^^ multiple wrap found | = note: candidate #1: IntoPyObjectConverter<T> = note: candidate #2: IntoPyObjectConverter<Result<T, E>>

The error came from every macro-expanded controller because generate_servo! produces methods returning PyResult, and newer pyo3 / pyo3-stub-gen don't resolve the conversion properly.

Cause: the open ranges in Cargo.toml

pyo3 = { version = ">=0.27.1", ... }
pyo3-stub-gen = { version = ">=0.17.0", ... }
resolved to pyo3 0.28.3 and pyo3-stub-gen 0.22.3, which broke the existing macro layer.

Fix

Pin to the last compatible versions:

pyo3 = { version = "=0.27.1", ... }
pyo3-stub-gen = { version = "=0.21.0", ... }
After this, cargo run --bin stub_gen --features python and maturin develop build cleanly. Default cargo check / cargo test are unaffected.

Notes

Some deprecation warnings about pyo3::PyObject -> Py remain in the macro layer. They are non-blocking.

@pierre-rouanet
pierre-rouanet self-requested a review May 26, 2026 14:12

@pierre-rouanet pierre-rouanet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jurmy24,

Thanks again for the contribution!
Could you remove the change in the uv.lock file? Then I'll merge the PR.
I'll work on updating the macro to use newer pyo3 when possible.

@jurmy24
jurmy24 force-pushed the fix/pyo3-dependencies branch from a5d0ee6 to 2350145 Compare May 26, 2026 15:01
@jurmy24

jurmy24 commented May 26, 2026

Copy link
Copy Markdown
Contributor Author

Done!

@pierre-rouanet
pierre-rouanet self-requested a review May 26, 2026 15:31
@pierre-rouanet
pierre-rouanet merged commit dc249cb into pollen-robotics:develop May 26, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants