awestlake87 / pyo3-asyncio

Other
315 stars 48 forks source link

Update pyo3 requirement from 0.20 to 0.21 #122

Open dependabot[bot] opened 8 months ago

dependabot[bot] commented 8 months ago

Updates the requirements on pyo3 to permit the latest version.

Release notes

Sourced from pyo3's releases.

PyO3 0.21.0

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

... (truncated)

Changelog

Sourced from pyo3's changelog.

[0.21.0] - 2024-03-25

Added

  • Add support for GraalPy (24.0 and up). #3247
  • Add PyMemoryView type. #3514
  • Allow async fn in for #[pyfunction] and #[pymethods], with the experimental-async feature. #3540 #3588 #3599 #3931
  • Implement PyTypeInfo for PyEllipsis, PyNone and PyNotImplemented. #3577
  • Support #[pyclass] on enums that have non-unit variants. #3582
  • Support chrono feature with abi3 feature. #3664
  • FromPyObject, IntoPy<PyObject> and ToPyObject are implemented on std::duration::Duration #3670
  • Add PyString::to_cow. Add Py<PyString>::to_str, Py<PyString>::to_cow, and Py<PyString>::to_string_lossy, as ways to access Python string data safely beyond the GIL lifetime. #3677
  • Add Bound<T> and Borrowed<T> smart pointers as a new API for accessing Python objects. #3686
  • Add PyNativeType::as_borrowed to convert "GIL refs" to the new Bound smart pointer. #3692
  • Add FromPyObject::extract_bound method, to migrate FromPyObject implementations to the Bound API. #3706
  • Add gil-refs feature to allow continued use of the deprecated GIL Refs APIs. #3707
  • Add methods to PyAnyMethods for binary operators (add, sub, etc.) #3712
  • Add chrono-tz feature allowing conversion between chrono_tz::Tz and zoneinfo.ZoneInfo #3730
  • Add FFI definition PyType_GetModuleByDef. #3734
  • Conversion between std::time::SystemTime and datetime.datetime #3736
  • Add Py::as_any and Py::into_any. #3785
  • Add PyStringMethods::encode_utf8. #3801
  • Add PyBackedStr and PyBackedBytes, as alternatives to &str and &bytes where a Python object owns the data. #3802 #3991
  • Allow #[pymodule] macro on Rust mod blocks, with the experimental-declarative-modules feature. #3815
  • Implement ExactSizeIterator for set and frozenset iterators on abi3 feature. #3849
  • Add Py::drop_ref to explicitly drop a `Py`` and immediately decrease the Python reference count if the GIL is already held. #3871
  • Allow #[pymodule] macro on single argument functions that take &Bound<'_, PyModule>. #3905
  • Implement FromPyObject for Cow<str>. #3928
  • Implement Default for GILOnceCell. #3971
  • Add PyDictMethods::into_mapping, PyListMethods::into_sequence and PyTupleMethods::into_sequence. #3982

Changed

  • PyDict::from_sequence now takes a single argument of type &PyAny (previously took two arguments Python and PyObject). #3532
  • Deprecate Py::is_ellipsis and PyAny::is_ellipsis in favour of any.is(py.Ellipsis()). #3577
  • Split some PyTypeInfo functionality into new traits HasPyGilRef and PyTypeCheck. #3600
  • Deprecate PyTryFrom and PyTryInto traits in favor of any.downcast() via the PyTypeCheck and PyTypeInfo traits. #3601
  • Allow async methods to accept &self/&mut self #3609
  • FromPyObject for set types now also accept frozenset objects as input. #3632
  • FromPyObject for bool now also accepts NumPy's bool_ as input. #3638
  • Add AsRefSource associated type to PyNativeType. #3653
  • Rename .is_true to .is_truthy on PyAny and Py<PyAny> to clarify that the test is not based on identity with or equality to the True singleton. #3657
  • PyType::name is now PyType::qualname whereas PyType::name efficiently accesses the full name which includes the module name. #3660
  • The Iter(A)NextOutput types are now deprecated and __(a)next__ can directly return anything which can be converted into Python objects, i.e. awaitables do not need to be wrapped into IterANextOutput or Option any more. Option can still be used as well and returning None will trigger the fast path for __next__, stopping iteration without having to raise a StopIteration exception. #3661
  • Implement FromPyObject on chrono::DateTime<Tz> for all Tz, not just FixedOffset and Utc. #3663
  • Add lifetime parameter to PyTzInfoAccess trait. For the deprecated gil-ref API, the trait is now implemented for &'py PyTime and &'py PyDateTime instead of PyTime and PyDate. #3679
  • Calls to __traverse__ become no-ops for unsendable pyclasses if on the wrong thread, thereby avoiding hard aborts at the cost of potential leakage. #3689
  • Include PyNativeType in pyo3::prelude. #3692
  • Improve performance of extract::<i64> (and other integer types) by avoiding call to __index__() converting the value to an integer for 3.10+. Gives performance improvement of around 30% for successful extraction. #3742
  • Relax bound of FromPyObject for Py<T> to just T: PyTypeCheck. #3776

... (truncated)

Commits


Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)