Skip to content

Upgrade pyo3 and pyo3-async-runtimes to version 0.25 #4152

Open
@drganjoo

Description

@drganjoo

Description

We need to upgrade our dependencies on pyo3 and pyo3-async-runtimes from their current versions to 0.25.x. This upgrade involves API breaking changes that require careful implementation and testing.

Background

Our initial attempt to include this upgrade in a previous PR revealed that version 0.25 introduces significant API changes. Rather than rushing the implementation, we decided to separate this work to ensure proper analysis and testing.

Required Changes

Based on the official migration guide, key changes include:

  • Update pyo3 and pyo3-async-runtimes to 0.25.x in Cargo.toml
  • Migrate from ToPyObject trait (removed) to IntoPy<PyObject>:
    // Before:
    impl ToPyObject for MyType {
        fn to_object(&self, py: Python<'_>) -> PyObject { ... }
    }
    
    // After:
    impl IntoPy<PyObject> for MyType {
        fn into_py(self, py: Python<'_>) -> PyObject { ... }
    }
  • Update any PyRef<T> and PyRefMut<T> implementations to match new trait bounds
  • Replace .extract() calls with the appropriate type-specialized extraction method
  • Check all FromPyObject implementations for compatibility with the trait's new design
  • Review usage of Python exception handling (errors may need adapting)

Potential Risks

  • Breaking changes in Python interoperability
  • Runtime behavior differences, especially in error propagation
  • GIL handling modifications may affect threaded code
  • Changed memory management behavior with Python objects

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions