Skip to content

Releases: PyO3/pyo3

PyO3 0.28.2

18 Feb 10:35

Choose a tag to compare

This patch release contains a soundness fix for subclassing native types such as PyList with the abi3 feature enabled when targeting a minimum version of Python 3.12 or higher. (Support for doing such subclassing was newly added in PyO3 0.28.0.)

PyO3 0.28.0 and 0.28.1 will be yanked.

This release also contains a correction to the FFI definition PyType_GetTypeDataSize and incorrectly-generated __qualname__ on #[pyclass] enum variant types when using #[pyo3(name = "...")] option to rename the enum and/or variant.

Thank you to the following contributors for the improvements:

@davidhewitt
@Icxolu
@ngoldbaum

PyO3 0.28.1

14 Feb 13:18

Choose a tag to compare

This patch contains a number of minor compile-time fixes for PyO3 0.28.0.

Thank you to the following contributors for the improvements:

@davidhewitt
@funsafemath
@ngoldbaum
@rara64
@tdyas

PyO3 0.28.0

01 Feb 22:31
f0c1523

Choose a tag to compare

This release contains many improvements across PyO3's feature set:

  • Proper support for __init__ methods for #[pyclass] types
  • Support for #[deleter]s to complement the existing #[getter] and #[setter] attributes when implementing class "properties".
  • Support for subclassing many Python types with the abi3 feature (requires Python 3.12+).
  • A new #[pyclass(new = "from_fields")] option to automatically define the constructor from the class fields.
  • Many corrections to FFI definitions (including removal of many private CPython methods)
  • Many improvements to the experimental-inspect feature's functionality.

The minimum supported Rust version has been increased to Rust 1.83.

This release also switches #[pymodule] to use PEP 489 multi-phase initialization internally. This should have no immediate functional impact other than preparing PyO3 to support newer technologies such as Python subinterpreters.

There are also many other incremental improvements, bug fixes and smaller features; full detail can be found in 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 contributors' commits are included in this release:

@ABorgna
@ahlinc
@alex
@altendky
@bazaah
@bschoenmaeckers
@chirizxc
@clin1234
@davidhewitt
@dependabot[bot]
@freakboy3742
@henryp3278
@Icxolu
@lazka
@LilyFirefly
@linkmauve
@lmmx
@lukaslueg
@MatthieuDartiailh
@MusicalNinjaDad
@ngoldbaum
@pkalivas
@reaperhulk
@RedKinda
@SilasMarvin
@SoroushMoosapour
@stijndcl
@tpoliaw
@Tpt

PyO3 0.27.2

30 Nov 09:22

Choose a tag to compare

This patch contains very minor fixes for the PyO3 0.27 series:

  • Workaround a rustc 1.92+ crash compiling PyO3 with both debug assertions and optimizations enabled.
  • Fix runtime crash when subclassing dicts on PyPy and GraalPy.

There are also a number of documentation improvements applied across the codebase.

Thank you to the following contributors for the improvements:

@davidhewitt
@dependabot[bot]
@MusicalNinjaDad
@pkalivas
@tpoliaw
@Tpt

PyO3 0.27.1

21 Oct 20:40

Choose a tag to compare

This release fixes a clippy lint regression in PyO3 0.27.0, and exposes the PySendResult type (the return value from Bound<PyIterator>::send).

Thank you to the following contributors for the improvements:

@alex
@davidhewitt
@reaperhulk
@tpoliaw

PyO3 0.27.0

19 Oct 11:17
7525512

Choose a tag to compare

This release is the first PyO3 release to be tested against Python 3.14.0 final. There are no significant changes to 3.14 support since PyO3 0.26 which was tested against the 3.14 release candidates.

Support for PyPy 3.9 and PyPy 3.10 (both no longer supported upstream) has been dropped.

The FromPyObject trait has been reworked in a similar fashion to the IntoPyObject trait introduced in PyO3 0.23. This has established a performant and flexible implementation of both these traits and no further changes to the traits are anticipated in the future. Thank you for the patience upgrading through these incremental improvements at the core of PyO3.

The .downcast() family of functions are now deprecated in favour of the .cast() family of functions, which are an incremental improvement to API usability and to error messages on failed conversions.

Operations on the PyCapsule type have been changed without deprecation to fix some issues with lifetimes of return values (in .name() and .reference() specifically). The capsule API now also encourages checking of capsule names, which is one of the few defences available to protect the validity of casting data read by the capsule API.

There are also many other incremental improvements, bug fixes and smaller features.

Please consult the migration guide for help upgrading.

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

@alex
@altendky
@bazaah
@bschoenmaeckers
@crepererum
@davidhewitt
@dependabot[bot]
@elbaro
@Icxolu
@jqnatividad
@mbrobbel
@NilsIrl
@rvben
@sanders41
@tdyas
@Tpt
@vvsagar

PyO3 0.26.0

29 Aug 13:41
4502c2e

Choose a tag to compare

This version solidifies support for Python 3.14 and free-threaded Python 3.14t. A number of PyO3 APIs have been renamed to reflect the fact the GIL is no longer a universal feature of all Python implementations. For example:

  • Python::with_gil is now known as Python::attach
  • Python::allow_threads is now known as Python::detach
  • pyo3::prepare_freethreaded_python is now known as Python::initialize()

The minimum supported Rust version has been increased to Rust 1.74.

An optional dependency on the bytes crate has been added to allow support for converting bytes::Bytes to / from Python.

The PyObject type alias for Py<PyAny> has also been deprecated; the Py and Bound smart pointers have been the primary interface for all Python-facing types since PyO3 0.21 and the PyObject type alias had been a frequent source of confusion.

There are also many other incremental improvements, bug fixes and smaller features.

Please consult the migration guide for help upgrading.

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

@ahlinc
@alex
@anilbey
@bschoenmaeckers
@Cheukting
@codeguru42
@davidhewitt
@decathorpe
@dependabot[bot]
@drewkett
@FlickerSoul
@Icxolu
@jder
@jessekrubin
@jjmarchewitz
@kemingy
@msimacek
@musicinmybrain
@ngoldbaum
@Nnamdi-sys
@nucccc
@olp-cs
@robsdedude
@rrricharrrd
@sxlijin
@timfel
@tonybaloney
@Tpt
@wxianxin
@xushiyan
@yogevm15

PyO3 0.25.1

12 Jun 21:19

Choose a tag to compare

This release adds testing for arm64 Windows, and fixes a bug with Python 3.14 support on 32-bit systems.

This release also adds a chrono-local feature to enable support for chrono::Local timezone (this was previously available in PyO3 0.24 but would convert the local timezone to a fixed offset, which did not round-trip well).

There are a few other fixes, mostly correcting FFI definitions and improving compiler errors when writing async code without the experimental-async feature enabled.

Thank you to the following contributors for the improvements:

@bschoenmaeckers
@Cheukting
@davidhewitt
@decathorpe
@dependabot[bot]
@Icxolu
@jessekrubin
@musicinmybrain
@ngoldbaum
@timfel
@tonybaloney
@Tpt
@yogevm15

PyO3 0.25.0

14 May 11:36
ec1a350

Choose a tag to compare

This version extends Python version support to include the new Python 3.14, currently in beta. Please note it is possible that there may yet be changes to 3.14 before stable release which may impact final compatibility.

New optional dependencies on bigdecimal, ordered_float, and time have been added to permit converting types from those crates to Python types (and vice versa).

The experimental-inspect feature now has the capability to autogenerate type stubs. These stubs are still extremely basic and lack much information. Tooling such as setuptools-rust and maturin will also need to be updated to make adoption of these easier. Please follow #5137 to keep abreast of developments of this feature.

The #[pyclass] macro has gained new options #[pyclass(generic)] and #[pyclass(immutable_type)] to offer additional control over the runtime behaviour of the generated Python type object.

The AsPyPointer trait has been removed as PyO3's smart pointer types such as Py<T>, Bound<T> and Borrowed<T> covered this use case with a better API.

As part of the upgrade to support 3.14, there have also been many cleanups to pyo3-ffi. Many definitions which are private implementation details of CPython have been removed; projects downstream of CPython cannot rely on stability of these even across CPython patch releases.

There are also many other incremental improvements, bug fixes and smaller features.

Please consult the migration guide for help upgrading.

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

@0x676e67
@bschoenmaeckers
@clin1234
@davidbrochart
@davidhewitt
@ddelange
@decathorpe
@dependabot[bot]
@exg
@hgmich
@Icxolu
@IvanIsCoding
@m-ou-se
@n-eq
@ngoldbaum
@Owen-CH-Leung
@prutschman-iv
@superserious-dev
@Tpt
@trim21
@Vrajs16
@xhochy

PyO3 0.24.2

21 Apr 21:27

Choose a tag to compare

This is a small patch release containing minor bugfixes and documentation improvements, including an unused imports lint warning raised from inside PyO3's proc macros.

Thank you to the following contributors for the improvements:

@davidbrochart
@davidhewitt
@ddelange
@decathorpe
@hgmich
@Icxolu
@n-eq
@Tpt
@trim21