Skip to content

Releases: PyO3/pyo3

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

PyO3 0.18.0

17 Jan 20:39
Compare
Choose a tag to compare

This release contains a number of new features for PyO3's macros which should make maintaining PyO3 projects easier.

#[pyfunction] and #[pymethods] have a new #[pyo3(signature = (...))] option which allows specifying the Python signature. This replaces the #[args] option already present for #[pymethods]; the new option is better-validated and offers a syntax much more intuitive to users familiar with writing pure-Python functions.

#[pyclass] has new get_all and set_all options for cases where all fields of a type should be readable or writable from Python.

The #[pyo3(text_signature = "...")] option is now autogenerated for all functions created with #[pyfunction] and #[pymethods]. It can still be applied manually when it is necessary to override the generated form.

As well as the macro API improvements, some other notable changes include:

  • PySet::new and PyFrozenSet::new now accept Rust iterators rather than requiring a slice.
  • Rust types have been added for all Python's built-in Warning types.
  • Non-zero integer types in std::num now have a conversion to/from Python int.
  • The deprecated #[pyproto] attribute is now 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:

@a1phyr
@adamreichold
@AdilZouitine
@alex
@birkenfeld
@CLOVIS-AI
@ctb
@dalcde
@datapythonista
@davidhewitt
@dylanbstorey
@flickpp
@gnaaman-dn
@haixuanTao
@hauntsaninja
@ijl
@itamarst
@jqnatividad
@matthewlloyd
@mejrs
@messense
@mrob95
@ongchi
@Oppen
@prehner
@Psykopear
@qbx2
@ryanrussell
@saethlin
@santokalayil
@saulshanabrook
@smheidrich
@SquidDev

PyO3 0.17.3

01 Nov 20:46
Compare
Choose a tag to compare

This release confirms support for Python 3.11 in PyO3.

(Previous versions of PyO3 0.17 had been tested against release candidates of Python 3.11 and no Python 3.11 fixes have been added since 0.17.0, so all PyO3 0.17 versions should in practice be fine to use with Python 3.11.)

In addition, some other small additions and fixes have been added on top of PyO3 0.17.2.

Thank you to the following users for the improvements:

@adamreichold
@ctb
@datapythonista
@davidhewitt
@messense
@saethlin

PyO3 0.17.2

04 Oct 07:12
Compare
Choose a tag to compare

This release contains non-breaking improvements and bugfixes over PyO3 0.17.1.

A new chrono feature has been added to support converting from types in chrono to types in the Python datetime module. The num-bigint feature has been expanded to add support to PyPy.

There has also been fixes for a couple of regressions observed in PyO3 0.17.

Thank you to the following users for the improvements:

@adamreichold
@AdilZouitine
@davidhewitt
@messense
@mrob95
@Oppen
@prehner
@Psykopear
@ryanrussell
@smheidrich
@SquidDev