Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.22.0 #4266

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 65 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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 }

Expand Down Expand Up @@ -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"]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`**
Expand Down Expand Up @@ -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"]
```

Expand Down
2 changes: 1 addition & 1 deletion examples/decorator/.template/pre-script.rhai
Original file line number Diff line number Diff line change
@@ -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");
2 changes: 1 addition & 1 deletion examples/maturin-starter/.template/pre-script.rhai
Original file line number Diff line number Diff line change
@@ -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");
2 changes: 1 addition & 1 deletion examples/plugin/.template/pre-script.rhai
Original file line number Diff line number Diff line change
@@ -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");
2 changes: 1 addition & 1 deletion examples/setuptools-rust-starter/.template/pre-script.rhai
Original file line number Diff line number Diff line change
@@ -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");
2 changes: 1 addition & 1 deletion examples/word-count/.template/pre-script.rhai
Original file line number Diff line number Diff line change
@@ -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");
1 change: 0 additions & 1 deletion newsfragments/3761.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/3835.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/3966.packaging.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4043.fixed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4061.packaging.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4072.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4078.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4079.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4086.fixed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4095.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4095.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4098.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4100.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4104.fixed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4116.fixed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4117.fixed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4129.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4148.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4158.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4178.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4184.packaging.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4194.added.md

This file was deleted.

4 changes: 0 additions & 4 deletions newsfragments/4196.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4196.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4197.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4201.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4202.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4205.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4206.added.md

This file was deleted.

2 changes: 0 additions & 2 deletions newsfragments/4210.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4210.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4213.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4214.added.md

This file was deleted.

3 changes: 0 additions & 3 deletions newsfragments/4219.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4226.fixed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4228.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4236.fixed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4237.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4249.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4250.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4251.fixed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4254.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4255.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4255.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4257.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4258.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4259.added.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4264.changed.md

This file was deleted.

2 changes: 1 addition & 1 deletion pyo3-build-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
4 changes: 2 additions & 2 deletions pyo3-ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions pyo3-macros-backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand All @@ -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]
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pyo3-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand All @@ -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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
Loading