github PyO3/pyo3 v0.20.0
PyO3 0.20.0

latest releases: v0.22.6, v0.22.5, v0.22.4...
13 months ago

This release is the first PyO3 release to be dual-licensed under Apache 2.0 OR MIT licensing (expanding from just Apache 2.0 of previous releases).

Python 3.12 stable is now supported. The minimum supported Rust version has been increased to Rust 1.56.

The __eq__, __ne__, __lt__, __le__, __gt__ and __ge__ magic methods are now usable in #[pymethods] to implement Python operators as an alternative to the __richcmp__ method PyO3 already offered.

#[pyclass(rename_all = "renaming_rule")] has been added to rename all fields of structs exposed to Python (e.g. rename_all = "snake_case") .

PyDict::get_item now returns Result<Option<&PyAny>> instead of just Option<&PyAny>. The previous implementation which ignored Python errors used APIs now considered deprecated by the Python language designers; it is now considered best practice to bubble up any exception raised during dictionary __getitem__. For most users migration for this change will simply require addition of a ? on each use of PyDict::get_item.

Note that Python 3.7 is end of life but PyO3 will continue to support for now as a number of downstream Python packages still have high proportions of downloads on 3.7. A future release is expected to drop Python 3.7 when these numbers reduce.

There have been numerous other smaller improvements, changes and fixes. For full details see the CHANGELOG.

Please consult the migration guide for help upgrading.

Thank you to everyone who contributed code, documentation, design ideas, bug reports, and feedback. The following users' commits are included in this release:

@adamreichold
@adriangb
@alex
@BooleanCat
@CallMeMSL
@cdce8p
@DataTriny
@davidhewitt
@ecarrara
@GoldsteinE
@grantslatton
@Hofer-Julian
@ijl
@iliya-malecki
@jakelishman
@jeffs
@juntyr
@krpatter-intc
@lucatrv
@mejrs
@messense
@mhils
@panpilkarz
@puradox
@ringsaturn
@rytheo
@SigureMo
@smheidrich
@Tpt
@youknowone
@zakstucke

Don't miss a new pyo3 release

NewReleases is sending notifications on new releases.