Skip to content

Releases: PyO3/pyo3

PyO3 0.20.3

23 Feb 11:58
Compare
Choose a tag to compare

This is a stability & compatibility release to fix a couple of minor compilation edge cases from PyO3 0.20.2.

The portable-atomic dependency has been added to resolve compile failures on platforms without 64-bit atomic support.

A maximum Python version check (currently for Python 3.12) has been added to prevent using old PyO3 code against future Python versions beyond the supported range.

Thank you to the following users for the improvements:

@adamreichold
@davidhewitt

PyO3 0.20.2

04 Jan 21:31
Compare
Choose a tag to compare

This release corrects a failure to compile of the either feature when the experimental-inspect feature is not enabled.

It also adds backwards-compatibility for pyo3 0.20.0 to build against pyo3-build-config 0.20.2, as pyo3 0.20.0 was (unintentionally) not pinned against an exact patch version pyo3-build-config, and pyo3 0.20.0 could not build against pyo3-build-config 0.20.1 due to an internal API adjustment.

Thank you to the following users for the improvements:

@adamreichold
@davidhewitt

PyO3 0.20.1

30 Dec 21:31
Compare
Choose a tag to compare

This release is a maintenance release to resolve a clippy warning which triggers on function arguments of Py<Self>.

This release also contains a few minor API additions, including optional support for the either and smallvec crates.

Thank you to the following users for the improvements:

@adamreichold
@aldanor
@alex
@daemontus
@davidhewitt
@mejrs
@messense
@neachdainn
@orhun
@suriya-ganesh
@wyfo

PyO3 0.20.0

11 Oct 21:22
Compare
Choose a tag to compare

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

PyO3 0.19.2

01 Aug 06:25
Compare
Choose a tag to compare

This release is a bugfix release with the primary focus being improved compatibility with Python 3.12 betas. Please note that until Python 3.12.0 stable is released PyO3 cannot guarantee that code compiled using PyO3 and beta versions of Python 3.12 will support 3.12 stable.

There have been some new minor APIs added in this release: PyErr::Display, PyAny::downcast_exact and PySlice::full.

Other bugfixes shipped in this release include:

  • A correction to the conversion of Python datetime to chrono::DateTime<FixedOffset> with respect to the handling of timezones.
  • Fix an edge case where PyErr::matches and PyErr::get_type could return results inconsistent with each other.
  • Fix cases where converting a Python exception into a PyErr would cause its traceback to be lost.

Thank you to the following users for the improvements:

@adamreichold
@alex
@BooleanCat
@CallMeMSL
@cdce8p
@davidhewitt
@grantslatton
@juntyr
@mejrs
@panpilkarz
@ringsaturn
@zakstucke

PyO3 0.19.1

03 Jul 15:15
Compare
Choose a tag to compare

This release fixes a memory leak caused by a reference counting error which affected PySet::new, PyFrozenSet::new and conversions from Rust set types to Python's set.

There are several other notable quality-of-life changes in this release:

  • Support for PyPy 3.10.
  • Support for hashbrown 0.14 and indexmap 2.0.
  • Conversions for std::net::IpAddr have been added.
  • The num-bigint feature is now supported with the abi3 feature.
  • The num-complex feature with abi3 feature enabled will now correctly use __complex__ implementations (it always has without abi3 enabled).
  • #[new] methods can now return Py<Self> to return an existing object (e.g. for singleton classes).

There are also a handful of other additions and bugfixes included in this release.

Thank you to the following users for the improvements:

@adamreichold
@adriangb
@alex
@CallMeMSL
@davidhewitt
@ijl
@jakelishman
@lucatrv
@mejrs
@mhils
@youknowone

PyO3 0.19.0

31 May 14:58
Compare
Choose a tag to compare

This release completes the implementation of automatically generated __text_signature__ for #[pymethods] and #[pyfunctions] by extending support for #[new] functions as well as rendering the value of simple default values such as integers, bools, and None in the generated signature.

Support for rust_decimal conversions to Python's decimal.Decimal has been added.

Usage of #[pyclass(frozen)] types becomes more powerful with the addition of Py::get to access contents of frozen classes without needing the Python GIL.

Some important fixes and removals have landed:

  • __traverse__ implementations may no longer access Python APIs or acquire the Python GIL. Attempting to use Python::with_gil will panic.
  • #[pyclass(unsendable)] types will now warn and skip Drop implementations when dropped on a thread other than the one the type was created on.
  • The deprecated Python::acquire_gil has been removed.

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
@AdilZouitine
@adriangb
@alex
@AntoineRR
@BlueGlassBlock
@cardoe
@cfour2
@davidhewitt
@decathorpe
@Enyium
@est31
@iajoiner
@ijl
@jond01
@kngwyu
@lifthrasiir
@lycantropos
@mattip
@mejrs
@messense
@OliverBalfour
@samuelcolvin
@sollyucko
@stuhood
@suyanhanx
@Walnut356
@why-not-try-calmer
@willstott101
@wjones127
@xcharleslin

PyO3 0.18.3

13 Apr 21:45
Compare
Choose a tag to compare

This release fixes an issue with PyDateTime::type_object() incorrectly returning the type object for PyDate, which would cause some is_instance checks to behave incorrectly.

In addition, this release contains a handful of minor quality-of-life corrections over PyO3 0.18.2.

Thank you to the following users for the improvements:

@adamreichold
@davidhewitt
@decathorpe
@ijl
@mejrs
@messense
@sollyucko
@willstott101
@wjones127

PyO3 0.18.2

24 Mar 20:35
Compare
Choose a tag to compare

This release fixes a rare ref-counting race condition when a PyObject is cloned inside of closure passed to Python::allow_threads. It is advised to update to this release if possible.

Conversions for Cell<T> and Cow<[u8]> have been added, as well as PyList::to_tuple and PyTuple::to_list as the most efficient way to convert between those types.

This release also contains some other minor performance optimisations and bugfixes.

Thank you to the following users for the improvements:

@adamreichold
@AdilZouitine
@adriangb
@AntoineRR
@davidhewitt
@Enyium
@iajoiner
@kngwyu
@lycantropos
@mattip
@mejrs
@messense
@OliverBalfour
@samuelcolvin

PyO3 0.18.1

07 Feb 21:35
Compare
Choose a tag to compare

This release fixes several bugs identified since PyO3 0.18.0, including a segfault and a Windows-specific issue with the PyIterator type, which would incorrectly accept any Python class regardless of whether it defined __next__ or not.

Some new APIs have been added such as PyErr::write_unraisable(), PyAny::is_ellipsis() and PyDict::update.

Thank you to the following users for the improvements:

@adamreichold
@alexpyattaev
@davidhewitt
@jjerphan
@jmhodges
@mejrs
@messense
@mitsuhiko
@neachdainn
@qbx2
@samuelcolvin