github PyO3/pyo3 v0.18.0
PyO3 0.18.0

latest releases: v0.22.3, v0.22.2, v0.22.1...
20 months ago

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

Don't miss a new pyo3 release

NewReleases is sending notifications on new releases.