Skip to content

Releases: PyO3/pyo3

PyO3 0.21.2

16 Apr 08:07
Compare
Choose a tag to compare

This release contains some fixes to compile-time edge cases for the PyO3 0.21 series:

  • A missing deprecation warning for the GIL Ref constructor PySet::empty has now been added.
  • #[pymodule] functions will no longer trigger missing_docs lints on their generated code.
  • Incorrect implementations of __traverse__ in #[pymethods] will now emit a better error.
  • Extension modules on AIX will now link to libpython.

This release also fixes some compile errors for the experimental-async and experimental-declarative-modules features, and corrects some documentation typos.

Thank you to the following users for the improvements:

@adamreichold
@blmarket
@davidhewitt
@Icxolu
@lfn3
@messense
@wyfo

PyO3 0.21.1

01 Apr 18:51
Compare
Choose a tag to compare

This release is a set of touch-ups to PyO3 0.21 to fix cases found as adoption of PyO3 0.21.0 progressed.

The new PyBackedStr and PyBackedBytes types have had a large range of standard traits implemented, including Clone, PartialEq, Hash, PartialOrd, Display, Debug, Send and Sync.

The argument to a #[setter] function now accepts the full range of input types as any other function argument in a #[pymethods] block, and will now correctly handle a #[pyo3(from_py_with = "...")] annotation.

Some procedural macro output has been adjusted to reuse more code and make it easier to reach complete code coverage in projects using PyO3. The import_exception_bound! macro has been added to further assist with coverage during migration, by skipping generating code which is only needed to use the exception as a GIL Ref.

Finally, the experimental-async feature now correctly handles async fn in #[pymethods] which have a &self or &mut self receiver plus additional arguments.

Thank you to the following users for the improvements:

@alex
@davidhewitt
@geo7
@Icxolu
@reswqa
@rikushoney
@tisonkun

PyO3 0.21.0

25 Mar 23:35
Compare
Choose a tag to compare

This release introduces a substantial new direction for PyO3's API. The Bound<'py, T> smart pointer type has been added that replaces "GIL Refs" such as &'py PyAny and &'py PyList with smart-pointer forms Bound<'py, PyAny> and Bound<'py, PyList>. This new smart pointer brings ownership out of PyO3's internals and into user control. This has been done for sake of both performance and soundness.

The migration guide extensively details the intended transition to the new API. To allow users a more graceful upgrade path, PyO3 0.21 and 0.22 will maintain backwards compatibility support for the existing "GIL Refs" API.

As well as the Bound API, highlights of PyO3 0.21 include:

  • Support for compiling for GraalPy
  • Extended chrono / datetime conversions, including support for the abi3 feature and the chrono-tz crate
  • Simplifications to __next__ and __anext__ methods

PyO3 0.21 also includes two new experimental features:

  • experimental-async for a simple async fn integration between Rust and Python.
  • experimental-declarative-modules for a new simpler #[pymodule] syntax.

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:

@acceptacross
@adamreichold
@aldanor
@alex
@alonme
@alxhill
@birkenfeld
@btel
@daemontus
@davidhewitt
@dmatos2012
@Hamatti
@Icxolu
@jadedpasta
@Jerry-Master
@jessekrubin
@Jgfrausing
@juntyr
@kushaldas
@LilyFoote
@maffoo
@mejrs
@messense
@mkovaxx
@neachdainn
@orhun
@samuelcolvin
@snuderl
@suriya-ganesh
@timfel
@Tpt
@wyfo
@Xuanwo

PyO3 0.21.0-beta.0

10 Mar 22:14
Compare
Choose a tag to compare
PyO3 0.21.0-beta.0 Pre-release
Pre-release

This release is a prerelease of PyO3 0.21 specifically aimed at confirming the new "Bound" API delivers the expected payoffs to downstream projects and that the migration pathway is manageable.

Some documentation is not yet completely polished, and there are some deprecation warnings which are due to be added. The expectation is that this work will take a week or two at most, and the final 0.21 release will follow at that point.

To read about the new Bound API, best to start with the migration guide entry.

If you test out the new API and have feedback, please open a new GitHub issue or discussion, or reach out on PyO3's new Discord. Feedback in this time period before the final release is particularly appreciated.

A more detailed release announcement and acknowledgements will be written with the final release.

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