Releases: PyO3/pyo3
PyO3 0.25.0
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
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
PyO3 0.24.1
This release is a security fix for the PyString::from_object
method, which passed &str
data to the Python C API without checking for a terminating nul byte. All historical PyO3 versions are affected, and we recommend you upgrade if you are using PyString::from_object
. Thank you to @vthib for the report and @Dr-Emann for the fix. A RUSTSEC advisory will be published shortly.
Aside from the security fix, this release contains a number of other non-breaking additions:
- An
abi3-py313
feature to support compiling with the Python 3.13 stable ABI. PyAnyMethods::getattr_opt
to get optional attributes without paying the cost of a Python exception when the attribute in question does not exist.- Constructor for
PyInt::new
. with_critical_section2
for locking two objects at the same time on the free-threaded build.- Fix for a PyO3 0.24.0 regression with
Option<&str>
andOption<&T>
(whereT: PyClass
) function arguments no longer being permitted
There are also a few other small bug fixes for edge cases, mostly related to compile errors from PyO3's macro code.
Thank you to the following contributors for the improvements:
@bschoenmaeckers
@davidhewitt
@Dr-Emann
@emmagordon
@epontan
@Icxolu
@IvanIsCoding
@jelmer
@jonaspleyer
@ngoldbaum
@Owen-CH-Leung
@Tpt
@Trolldemorted
@XuehaiPan
PyO3 0.24.0
This release is an incremental improvement of refinements and optimizations following the new APIs established in PyO3's last few releases.
Support for jiff
datetime conversions have been added, and also UUID conversions.
The FromPyObject
derive macro has gained new #[pyo3(default = ...)]
and #[pyo3(rename_all = ...)]
options, and the IntoPyObject
derive macro has gained a new #[pyo3(into_py_with = ...)]
option.
PyO3 will now pass positional arguments to Python functions using the "vectorcall" protocol in many cases, which should be an optimization over the previous behaviour (of creating a Python tuple of positional arguments).
Many methods on iterators of Python collections have been optimized.
There are also many other incremental improvements, bug fixes and smaller features.
Thank you to everyone who contributed code, documentation, design ideas, bug reports, and feedback. The following contributors' commits are included in this release:
@0x676e67
@alex
@arielb1
@bschoenmaeckers
@davidhewitt
@dependabot[bot]
@eltociear
@Icxolu
@IvanIsCoding
@JeanArhancet
@kahojyun
@kemingy
@kylebarron
@LifeLex
@LilyFoote
@lundybernard
@matt-codecov
@mattip
@mejrs
@messense
@msimacek
@ngoldbaum
@nicolasavru
@Owen-CH-Leung
@peterjoel
@SilverBzH
@Tpt
@yoav-orca
@yotamofek
PyO3 0.23.5
This release is a final set of backports onto the PyO3 0.23 series:
- PyPy 3.11 support
- Fixes to
#[pyclass(freelist)]
on free-threaded Python 3.13 - Fix to
Python::run
for a case when__builtins__
is not loaded correctly on Python 3.10+
Thank you to the following contributors for the improvements:
@arielb1
@Icxolu
@LilyFoote
@mattip
@mgorny
@ngoldbaum
PyO3 0.23.4
This release contains a range of fixes on top of PyO3 0.23.3, primarily grouped into the following categories:
- Fixes for the new support for free-threaded Python 3.13
- Fixes to conversions between Python and
chrono
datetimes - Fixes to various build configuration cases for Windows
- Fixes to edge cases in PyO3's macros leading to compile failures
Thank you to the following contributors for the improvements:
@alex
@bschoenmaeckers
@davidhewitt
@Icxolu
@kahojyun
@LilyFoote
@mejrs
@messense
@msimacek
@ngoldbaum
@Owen-CH-Leung
@Tpt
PyO3 0.23.3
This release is a soundness fix for PyO3 0.23.0 through 0.23.2.
In PyO3 0.23.0 the PYO3_CONFIG_FILE
environment variable used to configure builds regressed such that changing the environment variable would no longer trigger PyO3 to reconfigure and recompile. In combination with workflows using tools such as maturin
to build for multiple versions in a single build, this leads to Python wheels being compiled against the wrong Python API version.
All users who distribute artefacts for multiple Python versions are encouraged to update and rebuild with PyO3 0.23.3. Affected wheels produced from PyO3 0.23.0 through 0.23.2 are highly unstable and will crash the Python interpreter in unpredictable ways.
Aside from this fix, PyO3 0.23.3 contains some fixes to link configuration for Python 3.13t on Windows.
Thank you to the following contributors for the improvements:
PyO3 0.23.2
This release fixes a build failure when attempting to compile for free-threaded Python when the abi3
or abi3-pyxx
features are enabled. With this fix, the compile will now ignore (with a warning) the abi3
and abi3-pyxx
flags (as is the case when compiling for PyPy, as neither support abi3
).
This release also iterates upon the new IntoPyObject
trait by adding an IntoPyObjectExt
helper trait with some common convenience functions.
Finally, a compile failure related to ambiguous_associated_items
lint errors inside generated #[pyclass]
and #[derive(IntoPyObject)]
output has been fixed.
Thank you to the following contributors for the improvements:
@davidhewitt
@LilyFoote
@ngoldbaum
PyO3 0.23.1
This is a re-release of PyO3 0.23.0 with corrections to fix docs.rs builds.
Thanks @yotamofek for the reports & fixes!
PyO3 0.23.0
This release is a significant iteration to both PyO3's internals and API with two major enhancements:
- Support for Python 3.13t, also known as "free-threaded Python".
- A new trait
IntoPyObject
, which unifies the existing to-Python conversion traitsIntoPy
andToPyObject
while also allowing new optimizations and proper error handling. The new trait also has a#[derive(IntoPyObject)]
macro.
While both of these new features have undergone extensive design, it will be no surprise to find teething issues. All feedback is encouraged so that we can follow up with iterative improvements for these new features in future releases.
On top of the major additions, the removal of the "GIL Refs" API deprecated in PyO3 0.21 is now complete. A number of PyO3 APIs have had new simpler names introduced now that the PyO3 API is no longer in a migration phase (for example PyTuple::new_bound
is now simplified to PyTuple::new
).
Beyond that, PyO3 0.23 contains nearly 5 months of incremental improvements, bug fixes and smaller features that have been implemented while the major work of this release was ongoing.
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:
@abrisco
@adamcavendish
@ahlinc
@akuhnregnier
@alex
@attack68
@birkenfeld
@Brogolem35
@bschoenmaeckers
@ChayimFriedman2
@Cheukting
@csernazs
@davidhewitt
@deedy5
@dependabot[bot]
@digitalsentinel
@exg
@FlickerSoul
@gi0baro
@glevco
@Icxolu
@jakelishman
@jeff-k
@jonaspleyer
@JRRudy1
@KLMatlock
@konstin
@LilyFoote
@MatthijsKok
@Mottl
@ngoldbaum
@obi1kenobi
@Owen-CH-Leung
@sansyrox
@shehabgamin
@Stranger6667
@styvane
@Thalyum
@Tlunch
@wangxiaoying
@WilliamTakeshi
@YesSeri
@Zyell