Skip to content

Commit be4d562

Browse files
authored
Merge pull request #3713 from PyO3/release-0.20.1
release: 0.20.1
2 parents c77deee + d3f034a commit be4d562

File tree

121 files changed

+1643
-541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+1643
-541
lines changed

.cargo/config

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
run: echo "TRYBUILD=overwrite" >> "$GITHUB_ENV"
6666

6767
- name: Build docs
68-
run: cargo doc --no-deps --no-default-features --features "full ${{ inputs.extra-features }}"
68+
run: nox -s docs
6969

7070
- name: Build (no features)
7171
run: cargo build --lib --tests --no-default-features

.github/workflows/ci.yml

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,19 @@ jobs:
2727
- uses: dtolnay/rust-toolchain@stable
2828
with:
2929
components: rustfmt
30-
- name: Check python formatting (black)
31-
run: nox -s fmt-py
30+
- name: Check python formatting and lints (ruff)
31+
run: nox -s ruff
3232
- name: Check rust formatting (rustfmt)
33-
run: nox -s fmt-rust
33+
run: nox -s rustfmt
34+
35+
semver-checks:
36+
if: github.ref != 'refs/heads/main'
37+
needs: [fmt]
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
- uses: actions/setup-python@v4
42+
- uses: obi1kenobi/cargo-semver-checks-action@v2
3443

3544
check-msrv:
3645
needs: [fmt]
@@ -104,7 +113,17 @@ jobs:
104113
rust-target: "i686-pc-windows-msvc",
105114
},
106115
]
116+
include:
117+
# Run beta clippy as a way to detect any incoming lints which may affect downstream users
118+
- rust: beta
119+
platform:
120+
{
121+
os: "ubuntu-latest",
122+
python-architecture: "x64",
123+
rust-target: "x86_64-unknown-linux-gnu",
124+
}
107125
name: clippy/${{ matrix.platform.rust-target }}/${{ matrix.rust }}
126+
continue-on-error: ${{ matrix.platform.rust != 'stable' }}
108127
steps:
109128
- uses: actions/checkout@v4
110129
- uses: dtolnay/rust-toolchain@master
@@ -144,7 +163,7 @@ jobs:
144163
matrix:
145164
extra-features: ["multiple-pymethods"]
146165
rust: [stable]
147-
python-version: ["3.11"]
166+
python-version: ["3.12"]
148167
platform:
149168
[
150169
{
@@ -221,7 +240,7 @@ jobs:
221240
include:
222241
# Test minimal supported Rust version
223242
- rust: 1.56.0
224-
python-version: "3.11"
243+
python-version: "3.12"
225244
platform:
226245
{
227246
os: "ubuntu-latest",
@@ -233,7 +252,7 @@ jobs:
233252

234253
# Test the `nightly` feature
235254
- rust: nightly
236-
python-version: "3.11"
255+
python-version: "3.12"
237256
platform:
238257
{
239258
os: "ubuntu-latest",
@@ -244,7 +263,7 @@ jobs:
244263

245264
# Test 32-bit Windows only with the latest Python version
246265
- rust: stable
247-
python-version: "3.11"
266+
python-version: "3.12"
248267
platform:
249268
{
250269
os: "windows-latest",
@@ -287,7 +306,7 @@ jobs:
287306
- uses: dtolnay/rust-toolchain@nightly
288307
with:
289308
components: rust-src
290-
- run: cargo install cargo-careful
309+
- uses: taiki-e/install-action@cargo-careful
291310
- run: python -m pip install --upgrade pip && pip install nox
292311
- run: nox -s test-rust -- careful skip-full
293312
env:
@@ -318,7 +337,7 @@ jobs:
318337
- uses: dtolnay/rust-toolchain@stable
319338
if: steps.should-skip.outputs.skip != 'true'
320339
with:
321-
components: llvm-tools-preview
340+
components: llvm-tools-preview,rust-src
322341
- name: Install cargo-llvm-cov
323342
if: steps.should-skip.outputs.skip != 'true'
324343
uses: taiki-e/install-action@cargo-llvm-cov
@@ -334,17 +353,21 @@ jobs:
334353

335354
emscripten:
336355
name: emscripten
337-
if: ${{ github.event_name != 'pull_request' && github.ref != 'refs/heads/main' }}
356+
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main') }}
338357
runs-on: ubuntu-latest
339358
steps:
340359
- uses: actions/checkout@v4
341360
- uses: actions/setup-python@v4
361+
with:
362+
# TODO bump emscripten builds to test on 3.12
363+
python-version: 3.11
342364
id: setup-python
343365
- name: Install Rust toolchain
344366
uses: dtolnay/rust-toolchain@stable
345367
with:
346368
targets: wasm32-unknown-emscripten
347-
- uses: actions/setup-node@v3
369+
components: rust-src
370+
- uses: actions/setup-node@v4
348371
with:
349372
node-version: 14
350373
- run: python -m pip install --upgrade pip && pip install nox

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ valgrind-python.supp
2323
*.pyd
2424
lcov.info
2525
netlify_build/
26+
.nox/

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.11
1+
3.12

CHANGELOG.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@ To see unreleased changes, please see the [CHANGELOG on the main branch guide](h
1010

1111
<!-- towncrier release notes start -->
1212

13+
## [0.20.1] - 2023-12-30
14+
15+
### Added
16+
17+
- Add optional `either` feature to add conversions for `either::Either<L, R>` sum type. [#3456](https://github.com/PyO3/pyo3/pull/3456)
18+
- Add optional `smallvec` feature to add conversions for `smallvec::SmallVec`. [#3507](https://github.com/PyO3/pyo3/pull/3507)
19+
- Add `take` and `into_inner` methods to `GILOnceCell` [#3556](https://github.com/PyO3/pyo3/pull/3556)
20+
- `#[classmethod]` methods can now also receive `Py<PyType>` as their first argument. [#3587](https://github.com/PyO3/pyo3/pull/3587)
21+
- `#[pyfunction(pass_module)]` can now also receive `Py<PyModule>` as their first argument. [#3587](https://github.com/PyO3/pyo3/pull/3587)
22+
- Add `traverse` method to `GILProtected`. [#3616](https://github.com/PyO3/pyo3/pull/3616)
23+
- Added `abi3-py312` feature [#3687](https://github.com/PyO3/pyo3/pull/3687)
24+
25+
### Fixed
26+
27+
- Fix minimum version specification for optional `chrono` dependency. [#3512](https://github.com/PyO3/pyo3/pull/3512)
28+
- Silenced new `clippy::unnecessary_fallible_conversions` warning when using a `Py<Self>` `self` receiver. [#3564](https://github.com/PyO3/pyo3/pull/3564)
29+
30+
1331
## [0.20.0] - 2023-10-11
1432

1533
### Packaging
@@ -1599,7 +1617,8 @@ Yanked
15991617

16001618
- Initial release
16011619

1602-
[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.20.0...HEAD
1620+
[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.20.1...HEAD
1621+
[0.20.1]: https://github.com/pyo3/pyo3/compare/v0.20.0...v0.20.1
16031622
[0.20.0]: https://github.com/pyo3/pyo3/compare/v0.19.2...v0.20.0
16041623
[0.19.2]: https://github.com/pyo3/pyo3/compare/v0.19.1...v0.19.2
16051624
[0.19.1]: https://github.com/pyo3/pyo3/compare/v0.19.0...v0.19.1

Cargo.toml

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyo3"
3-
version = "0.20.0"
3+
version = "0.20.1"
44
description = "Bindings to Python interpreter"
55
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
66
readme = "README.md"
@@ -21,10 +21,10 @@ parking_lot = ">= 0.11, < 0.13"
2121
memoffset = "0.9"
2222

2323
# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
24-
pyo3-ffi = { path = "pyo3-ffi", version = "=0.20.0" }
24+
pyo3-ffi = { path = "pyo3-ffi", version = "=0.20.1" }
2525

2626
# support crates for macros feature
27-
pyo3-macros = { path = "pyo3-macros", version = "=0.20.0", optional = true }
27+
pyo3-macros = { path = "pyo3-macros", version = "=0.20.1", optional = true }
2828
indoc = { version = "2.0.1", optional = true }
2929
unindent = { version = "0.2.1", optional = true }
3030

@@ -33,14 +33,16 @@ inventory = { version = "0.3.0", optional = true }
3333

3434
# crate integrations that can be added using the eponymous features
3535
anyhow = { version = "1.0", optional = true }
36-
chrono = { version = "0.4", default-features = false, optional = true }
36+
chrono = { version = "0.4.25", default-features = false, optional = true }
37+
either = { version = "1.9", optional = true }
3738
eyre = { version = ">= 0.4, < 0.7", optional = true }
3839
hashbrown = { version = ">= 0.9, < 0.15", optional = true }
3940
indexmap = { version = ">= 1.6, < 3", optional = true }
4041
num-bigint = { version = "0.4", optional = true }
4142
num-complex = { version = ">= 0.2, < 0.5", optional = true }
4243
rust_decimal = { version = "1.0.0", default-features = false, optional = true }
4344
serde = { version = "1.0", optional = true }
45+
smallvec = { version = "1.0", optional = true }
4446

4547
[dev-dependencies]
4648
assert_approx_eq = "1.1.0"
@@ -51,12 +53,11 @@ proptest = { version = "1.0", default-features = false, features = ["std"] }
5153
send_wrapper = "0.6"
5254
serde = { version = "1.0", features = ["derive"] }
5355
serde_json = "1.0.61"
54-
rayon = "1.0.2"
55-
rust_decimal = { version = "1.8.0", features = ["std"] }
56+
rayon = "1.6.1"
5657
widestring = "0.5.1"
5758

5859
[build-dependencies]
59-
pyo3-build-config = { path = "pyo3-build-config", version = "0.20.0", features = ["resolve-config"] }
60+
pyo3-build-config = { path = "pyo3-build-config", version = "0.20.1", features = ["resolve-config"] }
6061

6162
[features]
6263
default = ["macros"]
@@ -84,7 +85,8 @@ abi3-py37 = ["abi3-py38", "pyo3-build-config/abi3-py37", "pyo3-ffi/abi3-py37"]
8485
abi3-py38 = ["abi3-py39", "pyo3-build-config/abi3-py38", "pyo3-ffi/abi3-py38"]
8586
abi3-py39 = ["abi3-py310", "pyo3-build-config/abi3-py39", "pyo3-ffi/abi3-py39"]
8687
abi3-py310 = ["abi3-py311", "pyo3-build-config/abi3-py310", "pyo3-ffi/abi3-py310"]
87-
abi3-py311 = ["abi3", "pyo3-build-config/abi3-py311", "pyo3-ffi/abi3-py311"]
88+
abi3-py311 = ["abi3-py312", "pyo3-build-config/abi3-py311", "pyo3-ffi/abi3-py311"]
89+
abi3-py312 = ["abi3", "pyo3-build-config/abi3-py312", "pyo3-ffi/abi3-py312"]
8890

8991
# Automatically generates `python3.dll` import libraries for Windows targets.
9092
generate-import-lib = ["pyo3-ffi/generate-import-lib"]
@@ -104,8 +106,10 @@ full = [
104106
"num-bigint",
105107
"num-complex",
106108
"hashbrown",
109+
"smallvec",
107110
"serde",
108111
"indexmap",
112+
"either",
109113
"eyre",
110114
"anyhow",
111115
"experimental-inspect",
@@ -124,5 +128,34 @@ members = [
124128

125129
[package.metadata.docs.rs]
126130
no-default-features = true
127-
features = ["macros", "num-bigint", "num-complex", "hashbrown", "serde", "multiple-pymethods", "indexmap", "eyre", "chrono", "rust_decimal"]
131+
features = ["macros", "num-bigint", "num-complex", "hashbrown", "serde", "multiple-pymethods", "indexmap", "eyre", "either", "chrono", "rust_decimal"]
128132
rustdoc-args = ["--cfg", "docsrs"]
133+
134+
[workspace.lints.clippy]
135+
checked_conversions = "warn"
136+
dbg_macro = "warn"
137+
explicit_into_iter_loop = "warn"
138+
explicit_iter_loop = "warn"
139+
filter_map_next = "warn"
140+
flat_map_option = "warn"
141+
let_unit_value = "warn"
142+
manual_assert = "warn"
143+
manual_ok_or = "warn"
144+
todo = "warn"
145+
unnecessary_wraps = "warn"
146+
useless_transmute = "warn"
147+
used_underscore_binding = "warn"
148+
149+
[workspace.lints.rust]
150+
elided_lifetimes_in_paths = "warn"
151+
invalid_doc_attributes = "warn"
152+
rust_2018_idioms = "warn"
153+
rust_2021_prelude_collisions = "warn"
154+
unused_lifetimes = "warn"
155+
156+
[workspace.lints.rustdoc]
157+
broken_intra_doc_links = "warn"
158+
bare_urls = "warn"
159+
160+
[lints]
161+
workspace = true

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ name = "string_sum"
6868
crate-type = ["cdylib"]
6969

7070
[dependencies]
71-
pyo3 = { version = "0.20.0", features = ["extension-module"] }
71+
pyo3 = { version = "0.20.1", features = ["extension-module"] }
7272
```
7373

7474
**`src/lib.rs`**
@@ -137,7 +137,7 @@ Start a new project with `cargo new` and add `pyo3` to the `Cargo.toml` like th
137137

138138
```toml
139139
[dependencies.pyo3]
140-
version = "0.20.0"
140+
version = "0.20.1"
141141
features = ["auto-initialize"]
142142
```
143143

build.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ fn ensure_auto_initialize_ok(interpreter_config: &InterpreterConfig) -> Result<(
3333
fn configure_pyo3() -> Result<()> {
3434
let interpreter_config = pyo3_build_config::get();
3535

36-
interpreter_config.emit_pyo3_cfgs();
37-
3836
ensure_auto_initialize_ok(interpreter_config)?;
3937

38+
for cfg in interpreter_config.build_script_outputs() {
39+
println!("{}", cfg)
40+
}
41+
4042
// Emit cfgs like `thread_local_const_init`
4143
print_feature_cfgs();
4244

emscripten/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pybuilddir.txt

examples/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ publish = false
55
edition = "2021"
66

77
[dev-dependencies]
8-
pyo3 = { version = "0.20.0", path = "..", features = ["auto-initialize", "extension-module"] }
8+
pyo3 = { version = "0.20.1", path = "..", features = ["auto-initialize", "extension-module"] }
99

1010
[[example]]
1111
name = "decorator"

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Below is a brief description of each of these:
1111
| `setuptools-rust-starter` | A template project which is configured to use [`setuptools_rust`](https://github.com/PyO3/setuptools-rust/) for development. |
1212
| `word-count` | A quick performance comparison between word counter implementations written in each of Rust and Python. |
1313
| `plugin` | Illustrates how to use Python as a scripting language within a Rust application |
14+
| `sequential` | Illustrates how to use pyo3-ffi to write subinterpreter-safe modules |
1415

1516
## Creating new projects from these examples
1617

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
variable::set("PYO3_VERSION", "0.20.0");
1+
variable::set("PYO3_VERSION", "0.20.1");
22
file::rename(".template/Cargo.toml", "Cargo.toml");
33
file::rename(".template/pyproject.toml", "pyproject.toml");
44
file::delete(".template");

examples/decorator/.template/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ build-backend = "maturin"
55
[project]
66
name = "{{project-name}}"
77
version = "0.1.0"
8+
9+
[project.optional-dependencies]
10+
dev = ["pytest"]

examples/decorator/noxfile.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33

44
@nox.session
5-
def python(session):
6-
session.install("-rrequirements-dev.txt")
7-
session.install("maturin")
8-
session.run_always("maturin", "develop")
5+
def python(session: nox.Session):
6+
session.env["MATURIN_PEP517_ARGS"] = "--profile=dev"
7+
session.install(".[dev]")
98
session.run("pytest")

examples/decorator/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ classifiers = [
1414
"Operating System :: POSIX",
1515
"Operating System :: MacOS :: MacOS X",
1616
]
17+
18+
[project.optional-dependencies]
19+
dev = ["pytest"]

examples/decorator/requirements-dev.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/decorator/tests/example.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from decorator import Counter
2+
3+
14
@Counter
25
def say_hello():
36
print("hello")

0 commit comments

Comments
 (0)