release: 0.22.0 (#4266)

This commit is contained in:
David Hewitt 2024-06-24 20:06:42 +01:00 committed by GitHub
parent 91d8683814
commit 2e2d4404a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
61 changed files with 85 additions and 75 deletions

View File

@ -10,6 +10,69 @@ To see unreleased changes, please see the [CHANGELOG on the main branch guide](h
<!-- towncrier release notes start -->
## [0.22.0] - 2024-06-24
### Packaging
- Update `heck` dependency to 0.5. [#3966](https://github.com/PyO3/pyo3/pull/3966)
- Extend range of supported versions of `chrono-tz` optional dependency to include version 0.10. [#4061](https://github.com/PyO3/pyo3/pull/4061)
- Update MSRV to 1.63. [#4129](https://github.com/PyO3/pyo3/pull/4129)
- Add optional `num-rational` feature to add conversions with Python's `fractions.Fraction`. [#4148](https://github.com/PyO3/pyo3/pull/4148)
- Support Python 3.13. [#4184](https://github.com/PyO3/pyo3/pull/4184)
### Added
- Add `PyWeakref`, `PyWeakrefReference` and `PyWeakrefProxy`. [#3835](https://github.com/PyO3/pyo3/pull/3835)
- Support `#[pyclass]` on enums that have tuple variants. [#4072](https://github.com/PyO3/pyo3/pull/4072)
- Add support for scientific notation in `Decimal` conversion. [#4079](https://github.com/PyO3/pyo3/pull/4079)
- Add `pyo3_disable_reference_pool` conditional compilation flag to avoid the overhead of the global reference pool at the cost of known limitations as explained in the performance section of the guide. [#4095](https://github.com/PyO3/pyo3/pull/4095)
- Add `#[pyo3(constructor = (...))]` to customize the generated constructors for complex enum variants. [#4158](https://github.com/PyO3/pyo3/pull/4158)
- Add `PyType::module`, which always matches Python `__module__`. [#4196](https://github.com/PyO3/pyo3/pull/4196)
- Add `PyType::fully_qualified_name` which matches the "fully qualified name" defined in [PEP 737](https://peps.python.org/pep-0737). [#4196](https://github.com/PyO3/pyo3/pull/4196)
- Add `PyTypeMethods::mro` and `PyTypeMethods::bases`. [#4197](https://github.com/PyO3/pyo3/pull/4197)
- Add `#[pyclass(ord)]` to implement ordering based on `PartialOrd`. [#4202](https://github.com/PyO3/pyo3/pull/4202)
- Implement `ToPyObject` and `IntoPy<PyObject>` for `PyBackedStr` and `PyBackedBytes`. [#4205](https://github.com/PyO3/pyo3/pull/4205)
- Add `#[pyclass(hash)]` option to implement `__hash__` in terms of the `Hash` implementation [#4206](https://github.com/PyO3/pyo3/pull/4206)
- Add `#[pyclass(eq)]` option to generate `__eq__` based on `PartialEq`, and `#[pyclass(eq_int)]` for simple enums to implement equality based on their discriminants. [#4210](https://github.com/PyO3/pyo3/pull/4210)
- Implement `From<Bound<'py, T>>` for `PyClassInitializer<T>`. [#4214](https://github.com/PyO3/pyo3/pull/4214)
- Add `as_super` methods to `PyRef` and `PyRefMut` for accesing the base class by reference. [#4219](https://github.com/PyO3/pyo3/pull/4219)
- Implement `PartialEq<str>` for `Bound<'py, PyString>`. [#4245](https://github.com/PyO3/pyo3/pull/4245)
- Implement `PyModuleMethods::filename` on PyPy. [#4249](https://github.com/PyO3/pyo3/pull/4249)
- Implement `PartialEq<[u8]>` for `Bound<'py, PyBytes>`. [#4250](https://github.com/PyO3/pyo3/pull/4250)
- Add `pyo3_ffi::c_str` macro to create `&'static CStr` on Rust versions which don't have 1.77's `c""` literals. [#4255](https://github.com/PyO3/pyo3/pull/4255)
- Support `bool` conversion with `numpy` 2.0's `numpy.bool` type [#4258](https://github.com/PyO3/pyo3/pull/4258)
- Add `PyAnyMethods::{bitnot, matmul, floor_div, rem, divmod}`. [#4264](https://github.com/PyO3/pyo3/pull/4264)
### Changed
- Change the type of `PySliceIndices::slicelength` and the `length` parameter of `PySlice::indices()`. [#3761](https://github.com/PyO3/pyo3/pull/3761)
- Deprecate implicit default for trailing optional arguments [#4078](https://github.com/PyO3/pyo3/pull/4078)
- `Clone`ing pointers into the Python heap has been moved behind the `py-clone` feature, as it must panic without the GIL being held as a soundness fix. [#4095](https://github.com/PyO3/pyo3/pull/4095)
- Add `#[track_caller]` to all `Py<T>`, `Bound<'py, T>` and `Borrowed<'a, 'py, T>` methods which can panic. [#4098](https://github.com/PyO3/pyo3/pull/4098)
- Change `PyAnyMethods::dir` to be fallible and return `PyResult<Bound<'py, PyList>>` (and similar for `PyAny::dir`). [#4100](https://github.com/PyO3/pyo3/pull/4100)
- The global reference pool (to track pending reference count decrements) is now initialized lazily to avoid the overhead of taking a mutex upon function entry when the functionality is not actually used. [#4178](https://github.com/PyO3/pyo3/pull/4178)
- Emit error messages when using `weakref` or `dict` when compiling for `abi3` for Python older than 3.9. [#4194](https://github.com/PyO3/pyo3/pull/4194)
- Change `PyType::name` to always match Python `__name__`. [#4196](https://github.com/PyO3/pyo3/pull/4196)
- Remove CPython internal ffi call for complex number including: add, sub, mul, div, neg, abs, pow. Added PyAnyMethods::{abs, pos, neg} [#4201](https://github.com/PyO3/pyo3/pull/4201)
- Deprecate implicit integer comparision for simple enums in favor of `#[pyclass(eq_int)]`. [#4210](https://github.com/PyO3/pyo3/pull/4210)
- Set the `module=` attribute of declarative modules' child `#[pymodule]`s and `#[pyclass]`es. [#4213](https://github.com/PyO3/pyo3/pull/4213)
- Set the `module` option for complex enum variants from the value set on the complex enum `module`. [#4228](https://github.com/PyO3/pyo3/pull/4228)
- Respect the Python "limited API" when building for the `abi3` feature on PyPy or GraalPy. [#4237](https://github.com/PyO3/pyo3/pull/4237)
- Optimize code generated by `#[pyo3(get)]` on `#[pyclass]` fields. [#4254](https://github.com/PyO3/pyo3/pull/4254)
- `PyCFunction::new`, `PyCFunction::new_with_keywords` and `PyCFunction::new_closure` now take `&'static CStr` name and doc arguments (previously was `&'static str`). [#4255](https://github.com/PyO3/pyo3/pull/4255)
- The `experimental-declarative-modules` feature is now stabilized and available by default. [#4257](https://github.com/PyO3/pyo3/pull/4257)
### Fixed
- Fix panic when `PYO3_CROSS_LIB_DIR` is set to a missing path. [#4043](https://github.com/PyO3/pyo3/pull/4043)
- Fix a compile error when exporting an exception created with `create_exception!` living in a different Rust module using the `declarative-module` feature. [#4086](https://github.com/PyO3/pyo3/pull/4086)
- Fix FFI definitions of `PY_VECTORCALL_ARGUMENTS_OFFSET` and `PyVectorcall_NARGS` to fix a false-positive assertion. [#4104](https://github.com/PyO3/pyo3/pull/4104)
- Disable `PyUnicode_DATA` on PyPy: not exposed by PyPy. [#4116](https://github.com/PyO3/pyo3/pull/4116)
- Correctly handle `#[pyo3(from_py_with = ...)]` attribute on dunder (`__magic__`) method arguments instead of silently ignoring it. [#4117](https://github.com/PyO3/pyo3/pull/4117)
- Fix a compile error when declaring a standalone function or class method with a Python name that is a Rust keyword. [#4226](https://github.com/PyO3/pyo3/pull/4226)
- Fix declarative modules discarding doc comments on the `mod` node. [#4236](https://github.com/PyO3/pyo3/pull/4236)
- Fix `__dict__` attribute missing for `#[pyclass(dict)]` instances when building for `abi3` on Python 3.9. [#4251](https://github.com/PyO3/pyo3/pull/4251)
## [0.21.2] - 2024-04-16
### Changed
@ -1745,7 +1808,8 @@ Yanked
- Initial release
[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.21.2...HEAD
[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.22.0...HEAD
[0.22.0]: https://github.com/pyo3/pyo3/compare/v0.21.2...v0.22.0
[0.21.2]: https://github.com/pyo3/pyo3/compare/v0.21.1...v0.21.2
[0.21.1]: https://github.com/pyo3/pyo3/compare/v0.21.0...v0.21.1
[0.21.0]: https://github.com/pyo3/pyo3/compare/v0.20.3...v0.21.0

View File

@ -1,6 +1,6 @@
[package]
name = "pyo3"
version = "0.22.0-dev"
version = "0.22.0"
description = "Bindings to Python interpreter"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
readme = "README.md"
@ -21,10 +21,10 @@ memoffset = "0.9"
once_cell = "1.13.0"
# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
pyo3-ffi = { path = "pyo3-ffi", version = "=0.22.0-dev" }
pyo3-ffi = { path = "pyo3-ffi", version = "=0.22.0" }
# support crates for macros feature
pyo3-macros = { path = "pyo3-macros", version = "=0.22.0-dev", optional = true }
pyo3-macros = { path = "pyo3-macros", version = "=0.22.0", optional = true }
indoc = { version = "2.0.1", optional = true }
unindent = { version = "0.2.1", optional = true }
@ -63,7 +63,7 @@ rayon = "1.6.1"
futures = "0.3.28"
[build-dependencies]
pyo3-build-config = { path = "pyo3-build-config", version = "=0.22.0-dev", features = ["resolve-config"] }
pyo3-build-config = { path = "pyo3-build-config", version = "=0.22.0", features = ["resolve-config"] }
[features]
default = ["macros"]

View File

@ -68,7 +68,7 @@ name = "string_sum"
crate-type = ["cdylib"]
[dependencies]
pyo3 = { version = "0.21.2", features = ["extension-module"] }
pyo3 = { version = "0.22.0", features = ["extension-module"] }
```
**`src/lib.rs`**
@ -137,7 +137,7 @@ Start a new project with `cargo new` and add `pyo3` to the `Cargo.toml` like th
```toml
[dependencies.pyo3]
version = "0.21.2"
version = "0.22.0"
features = ["auto-initialize"]
```

View File

@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.21.2");
variable::set("PYO3_VERSION", "0.22.0");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/pyproject.toml", "pyproject.toml");
file::delete(".template");

View File

@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.21.2");
variable::set("PYO3_VERSION", "0.22.0");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/pyproject.toml", "pyproject.toml");
file::delete(".template");

View File

@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.21.2");
variable::set("PYO3_VERSION", "0.22.0");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/plugin_api/Cargo.toml", "plugin_api/Cargo.toml");
file::delete(".template");

View File

@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.21.2");
variable::set("PYO3_VERSION", "0.22.0");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/setup.cfg", "setup.cfg");
file::delete(".template");

View File

@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.21.2");
variable::set("PYO3_VERSION", "0.22.0");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/pyproject.toml", "pyproject.toml");
file::delete(".template");

View File

@ -1 +0,0 @@
Change the type of `PySliceIndices::slicelength` and the `length` parameter of `PySlice::indices()`.

View File

@ -1 +0,0 @@
Add `PyWeakref`, `PyWeakrefReference` and `PyWeakrefProxy`.

View File

@ -1 +0,0 @@
Update `heck` dependency to 0.5.

View File

@ -1 +0,0 @@
Don't panic when `PYO3_CROSS_LIB_DIR` is set to a missing path.

View File

@ -1 +0,0 @@
Extend range of supported versions of `chrono-tz` optional dependency to include version 0.10.

View File

@ -1 +0,0 @@
Support `#[pyclass]` on enums that have tuple variants.

View File

@ -1 +0,0 @@
deprecate implicit default for trailing optional arguments

View File

@ -1 +0,0 @@
Added support for scientific notation in `Decimal` conversion

View File

@ -1 +0,0 @@
Fixes a compile error when exporting an exception created with `create_exception!` living in a different Rust module using the `declarative-module` feature.

View File

@ -1 +0,0 @@
Add `pyo3_disable_reference_pool` conditional compilation flag to avoid the overhead of the global reference pool at the cost of known limitations as explained in the performance section of the guide.

View File

@ -1 +0,0 @@
`Clone`ing pointers into the Python heap has been moved behind the `py-clone` feature, as it must panic without the GIL being held as a soundness fix.

View File

@ -1 +0,0 @@
Add `#[track_caller]` to all `Py<T>`, `Bound<'py, T>` and `Borrowed<'a, 'py, T>` methods which can panic.

View File

@ -1 +0,0 @@
Change `PyAnyMethods::dir` to be fallible and return `PyResult<Bound<'py, PyList>>` (and similar for `PyAny::dir`).

View File

@ -1 +0,0 @@
Changes definitions of `PY_VECTORCALL_ARGUMENTS_OFFSET` and `PyVectorcall_NARGS` to fix a false-positive assertion.

View File

@ -1 +0,0 @@
Disable `PyUnicode_DATA` on PyPy: Not exposed by PyPy.

View File

@ -1 +0,0 @@
Correctly handle `#[pyo3(from_py_with = ...)]` attribute on dunder (`__magic__`) method arguments instead of silently ignoring it.

View File

@ -1 +0,0 @@
Raised the MSRV to 1.63

View File

@ -1 +0,0 @@
Conversion between [num-rational](https://github.com/rust-num/num-rational) and Python's fractions.Fraction.

View File

@ -1 +0,0 @@
Added `#[pyo3(constructor = (...))]` to customize the generated constructors for complex enum variants

View File

@ -1 +0,0 @@
The global reference pool (to track pending reference count decrements) is now initialized lazily to avoid the overhead of taking a mutex upon function entry when the functionality is not actually used.

View File

@ -1 +0,0 @@
Support Python 3.13.

View File

@ -1 +0,0 @@
Added error messages when using `weakref` or `dict` when compiling for `abi3` for Python older than 3.9

View File

@ -1,4 +0,0 @@
Add `PyType::module`, which always matches Python `__module__`.
Add `PyType::fully_qualified_name` which matches the "fully qualified name"
defined in https://peps.python.org/pep-0737 (not exposed in Python),
which is useful for error messages and `repr()` implementations.

View File

@ -1 +0,0 @@
Change `PyType::name` to always match Python `__name__`.

View File

@ -1 +0,0 @@
Add `PyTypeMethods::mro` and `PyTypeMethods::bases`.

View File

@ -1 +0,0 @@
Remove CPython internal ffi call for complex number including: add, sub, mul, div, neg, abs, pow. Added PyAnyMethods::{abs, pos, neg}

View File

@ -1 +0,0 @@
Add `#[pyclass(ord)]` to implement ordering based on `PartialOrd`.

View File

@ -1 +0,0 @@
Added `ToPyObject` and `IntoPy<PyObject>` impls for `PyBackedStr` and `PyBackedBytes`.

View File

@ -1 +0,0 @@
Added `#[pyclass(hash)]` option to implement `__hash__` in terms of the `Hash` implementation

View File

@ -1,2 +0,0 @@
Added `#[pyclass(eq)]` option to generate `__eq__` based on `PartialEq`.
Added `#[pyclass(eq_int)]` for simple enums to implement equality based on their discriminants.

View File

@ -1 +0,0 @@
Deprecate implicit integer comparision for simple enums in favor of `#[pyclass(eq_int)]`.

View File

@ -1 +0,0 @@
Properly fills the `module=` attribute of declarative modules child `#[pymodule]` and `#[pyclass]`.

View File

@ -1 +0,0 @@
Added `From<Bound<'py, T>>` impl for `PyClassInitializer<T>`.

View File

@ -1,3 +0,0 @@
- Added `as_super` methods to `PyRef` and `PyRefMut` for accesing the base class by reference
- Updated user guide to recommend `as_super` for referencing the base class instead of `as_ref`
- Added `pyo3::internal_tricks::ptr_from_mut` function for casting `&mut T` to `*mut T`

View File

@ -1 +0,0 @@
Fixes a compile error when declaring a standalone function or class method with a Python name that is a Rust keyword.

View File

@ -1 +0,0 @@
Changed the `module` option for complex enum variants to inherit from the value set on the complex enum `module`.

View File

@ -1 +0,0 @@
Declarative modules: do not discard doc comments on the `mod` node.

View File

@ -1 +0,0 @@
Respect the Python "limited API" when building for the `abi3` feature on PyPy or GraalPy.

View File

@ -1 +0,0 @@
Implement `PyModuleMethods::filename` on PyPy.

View File

@ -1 +0,0 @@
Implement `PartialEq<str>` for `Bound<'py, PyBytes>`.

View File

@ -1 +0,0 @@
Fix `__dict__` attribute missing for `#[pyclass(dict)]` instances when building for `abi3` on Python 3.9.

View File

@ -1 +0,0 @@
Optimize code generated by `#[pyo3(get)]` on `#[pyclass]` fields.

View File

@ -1 +0,0 @@
Add `pyo3_ffi::c_str` macro to create `&'static CStr` on Rust versions which don't have 1.77's `c""` literals.

View File

@ -1 +0,0 @@
`PyCFunction::new`, `PyCFunction::new_with_keywords` and `PyCFunction::new_closure` now take `&'static CStr` name and doc arguments (previously was `&'static str`).

View File

@ -1 +0,0 @@
The `experimental-declarative-modules` feature is now stabilized and available by default

View File

@ -1 +0,0 @@
Added support for `bool` conversion with `numpy` 2.0's `numpy.bool` type

View File

@ -1 +0,0 @@
Implement `PartialEq<str>` for `Bound<'py, PyString>`.

View File

@ -1 +0,0 @@
Added `PyAnyMethods::{bitnot, matmul, floor_div, rem, divmod}` for completeness.

View File

@ -1,6 +1,6 @@
[package]
name = "pyo3-build-config"
version = "0.22.0-dev"
version = "0.22.0"
description = "Build configuration for the PyO3 ecosystem"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
keywords = ["pyo3", "python", "cpython", "ffi"]

View File

@ -1,6 +1,6 @@
[package]
name = "pyo3-ffi"
version = "0.22.0-dev"
version = "0.22.0"
description = "Python-API bindings for the PyO3 ecosystem"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
keywords = ["pyo3", "python", "cpython", "ffi"]
@ -38,7 +38,7 @@ abi3-py312 = ["abi3", "pyo3-build-config/abi3-py312"]
generate-import-lib = ["pyo3-build-config/python3-dll-a"]
[build-dependencies]
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.22.0-dev", features = ["resolve-config"] }
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.22.0", features = ["resolve-config"] }
[lints]
workspace = true

View File

@ -1,6 +1,6 @@
[package]
name = "pyo3-macros-backend"
version = "0.22.0-dev"
version = "0.22.0"
description = "Code generation for PyO3 package"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
keywords = ["pyo3", "python", "cpython", "ffi"]
@ -16,7 +16,7 @@ edition = "2021"
[dependencies]
heck = "0.5"
proc-macro2 = { version = "1.0.60", default-features = false }
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.22.0-dev", features = ["resolve-config"] }
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.22.0", features = ["resolve-config"] }
quote = { version = "1", default-features = false }
[dependencies.syn]
@ -25,7 +25,7 @@ default-features = false
features = ["derive", "parsing", "printing", "clone-impls", "full", "extra-traits"]
[build-dependencies]
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.22.0-dev" }
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.22.0" }
[lints]
workspace = true

View File

@ -1,6 +1,6 @@
[package]
name = "pyo3-macros"
version = "0.22.0-dev"
version = "0.22.0"
description = "Proc macros for PyO3 package"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
keywords = ["pyo3", "python", "cpython", "ffi"]
@ -22,7 +22,7 @@ gil-refs = ["pyo3-macros-backend/gil-refs"]
proc-macro2 = { version = "1.0.60", default-features = false }
quote = "1"
syn = { version = "2", features = ["full", "extra-traits"] }
pyo3-macros-backend = { path = "../pyo3-macros-backend", version = "=0.22.0-dev" }
pyo3-macros-backend = { path = "../pyo3-macros-backend", version = "=0.22.0" }
[lints]
workspace = true

View File

@ -3,7 +3,7 @@
[tool.towncrier]
filename = "CHANGELOG.md"
version = "0.22.0-dev"
version = "0.22.0"
start_string = "<!-- towncrier release notes start -->\n"
template = ".towncrier.template.md"
title_format = "## [{version}] - {project_date}"