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.20.1 #3713

Merged
merged 52 commits into from Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
427b2e9
Add support for `SmallVec` in conversion traits (#3440)
orhun Oct 11, 2023
8392ed2
bump "latest" CI jobs to 3.12
davidhewitt Oct 2, 2023
9e07203
also test emscripten with CI-build-full
davidhewitt Oct 8, 2023
84264b3
keep emscripten back on 3.11 for now
davidhewitt Oct 13, 2023
779eb24
Add an entry to features table in lib
orhun Oct 13, 2023
826fa97
Set version of smallvec to 1.0
orhun Oct 13, 2023
d468f57
Align chrono dev and runtime dependency version specifications.
adamreichold Oct 14, 2023
f745299
ci: drop psutil dependency
davidhewitt Oct 15, 2023
30463b6
remove comparison to rust-cpython
davidhewitt Oct 15, 2023
422f866
ci: install prebuilt cargo-careful
davidhewitt Oct 16, 2023
97bf194
Bump actions/setup-node from 3 to 4
dependabot[bot] Oct 23, 2023
e900df0
ci: use older hashbrown and indexmap for MSRV
davidhewitt Oct 24, 2023
8c272a6
ci: tidy up some dev deps
davidhewitt Oct 24, 2023
92cde09
add coverage for `emit_pyo3_cfgs`
davidhewitt Oct 22, 2023
410ef89
docs: improve detail around pyenv install
davidhewitt Oct 25, 2023
ba5a1da
ci: fix nightly unused import warnings
davidhewitt Oct 25, 2023
7f32876
Note about `pyenv activate` and `pyenv virtualenv` commands
davidhewitt Oct 26, 2023
8e08e4a
examples: remove requirements-dev.txt files
davidhewitt Oct 20, 2023
04af02f
ci: switch from black to ruff
davidhewitt Oct 26, 2023
2aca7f5
Add example of dynamic return type in the "Python classes" section of…
daemontus Oct 26, 2023
15c2800
Update guide/src/class.md
daemontus Oct 26, 2023
10086d1
Finish rename
daemontus Oct 27, 2023
04bb9f2
feat: add `take` and `into_inner` methods to `GILOnceCell`
Oct 29, 2023
a4aba0a
refactor: remove useless `unsafe` in `get_mut`
Oct 29, 2023
b08c92b
docs: add newsfragment
Oct 29, 2023
d649f66
add link to user guide to cross compile error message
davidhewitt Oct 30, 2023
c8ef081
fix missing char conversion
suriya-ganesh Nov 10, 2023
aa6f146
ci: try to run without rust-toolchain.toml
davidhewitt Nov 14, 2023
8d637b0
ci: updates for rust 1.74
davidhewitt Nov 16, 2023
bbc5404
ci: move lints to new 1.74 cargo.toml tables
davidhewitt Nov 17, 2023
9dbd81b
enable cargo-semver-checks, try 2
davidhewitt Nov 18, 2023
466359a
feat: allow `classmethod`/`pass_module` to receive owned types
Nov 20, 2023
3d17f74
fix: replace removed `fmt` session by `rustfmt` and `ruff`
wyfo Nov 22, 2023
25b8a37
remove type_is_pymodule
davidhewitt Nov 22, 2023
e0513d7
improve error for invalid `#[classmethod]` receivers
davidhewitt Nov 24, 2023
2312270
add conversion support for `either::Either`
aldanor Sep 16, 2023
b1de927
docs: fixup docs for smallvec feature
davidhewitt Nov 24, 2023
405d722
Create subinterpreter example
mejrs Oct 12, 2023
830b3bb
fixes #3561 -- silence new clippy warning
alex Nov 7, 2023
485f5c0
ci: run beta clippy as an allowed-to-fail job
davidhewitt Nov 26, 2023
413dda0
fix pyo3-ffi beta clippy warnings
davidhewitt Nov 26, 2023
856b859
fix test-serde beta clippy warning
davidhewitt Nov 26, 2023
1166a99
Refactor create_type_object so that most of the code is monomorphic
alex Nov 29, 2023
7032789
Add additional definitions for `_PyImport_Frozen*`
messense Dec 3, 2023
1896a32
ci: refactor pytests dev dependencies
davidhewitt Dec 4, 2023
5c1e4d1
ci: fixup pytests to compile in debug
davidhewitt Dec 5, 2023
8f6976d
Enable `GILProtected` access via `PyVisit`
neachdainn Nov 30, 2023
d897479
Fix the Crossbeam ecosystem to point releases before it required Rust…
adamreichold Dec 14, 2023
b842711
Fixes #3645 -- added `abi3-py312` feature
alex Dec 21, 2023
ecb0e9c
Copy note on using check_signals on non-main thread/interpreter from …
adamreichold Dec 22, 2023
985412f
ci: updates for Rust 1.75
davidhewitt Dec 29, 2023
d3f034a
release: 0.20.1
davidhewitt Dec 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 0 additions & 20 deletions .cargo/config

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Expand Up @@ -65,7 +65,7 @@ jobs:
run: echo "TRYBUILD=overwrite" >> "$GITHUB_ENV"

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

- name: Build (no features)
run: cargo build --lib --tests --no-default-features
Expand Down
45 changes: 34 additions & 11 deletions .github/workflows/ci.yml
Expand Up @@ -27,10 +27,19 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check python formatting (black)
run: nox -s fmt-py
- name: Check python formatting and lints (ruff)
run: nox -s ruff
- name: Check rust formatting (rustfmt)
run: nox -s fmt-rust
run: nox -s rustfmt

semver-checks:
if: github.ref != 'refs/heads/main'
needs: [fmt]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: obi1kenobi/cargo-semver-checks-action@v2

check-msrv:
needs: [fmt]
Expand Down Expand Up @@ -104,7 +113,17 @@ jobs:
rust-target: "i686-pc-windows-msvc",
},
]
include:
# Run beta clippy as a way to detect any incoming lints which may affect downstream users
- rust: beta
platform:
{
os: "ubuntu-latest",
python-architecture: "x64",
rust-target: "x86_64-unknown-linux-gnu",
}
name: clippy/${{ matrix.platform.rust-target }}/${{ matrix.rust }}
continue-on-error: ${{ matrix.platform.rust != 'stable' }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
Expand Down Expand Up @@ -144,7 +163,7 @@ jobs:
matrix:
extra-features: ["multiple-pymethods"]
rust: [stable]
python-version: ["3.11"]
python-version: ["3.12"]
platform:
[
{
Expand Down Expand Up @@ -221,7 +240,7 @@ jobs:
include:
# Test minimal supported Rust version
- rust: 1.56.0
python-version: "3.11"
python-version: "3.12"
platform:
{
os: "ubuntu-latest",
Expand All @@ -233,7 +252,7 @@ jobs:

# Test the `nightly` feature
- rust: nightly
python-version: "3.11"
python-version: "3.12"
platform:
{
os: "ubuntu-latest",
Expand All @@ -244,7 +263,7 @@ jobs:

# Test 32-bit Windows only with the latest Python version
- rust: stable
python-version: "3.11"
python-version: "3.12"
platform:
{
os: "windows-latest",
Expand Down Expand Up @@ -287,7 +306,7 @@ jobs:
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- run: cargo install cargo-careful
- uses: taiki-e/install-action@cargo-careful
- run: python -m pip install --upgrade pip && pip install nox
- run: nox -s test-rust -- careful skip-full
env:
Expand Down Expand Up @@ -318,7 +337,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
if: steps.should-skip.outputs.skip != 'true'
with:
components: llvm-tools-preview
components: llvm-tools-preview,rust-src
- name: Install cargo-llvm-cov
if: steps.should-skip.outputs.skip != 'true'
uses: taiki-e/install-action@cargo-llvm-cov
Expand All @@ -334,17 +353,21 @@ jobs:

emscripten:
name: emscripten
if: ${{ github.event_name != 'pull_request' && github.ref != 'refs/heads/main' }}
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
# TODO bump emscripten builds to test on 3.12
python-version: 3.11
id: setup-python
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-emscripten
- uses: actions/setup-node@v3
components: rust-src
- uses: actions/setup-node@v4
with:
node-version: 14
- run: python -m pip install --upgrade pip && pip install nox
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -23,3 +23,4 @@ valgrind-python.supp
*.pyd
lcov.info
netlify_build/
.nox/
2 changes: 1 addition & 1 deletion .python-version
@@ -1 +1 @@
3.11
3.12
21 changes: 20 additions & 1 deletion CHANGELOG.md
Expand Up @@ -10,6 +10,24 @@ To see unreleased changes, please see the [CHANGELOG on the main branch guide](h

<!-- towncrier release notes start -->

## [0.20.1] - 2023-12-30

### Added

- Add optional `either` feature to add conversions for `either::Either<L, R>` sum type. [#3456](https://github.com/PyO3/pyo3/pull/3456)
- Add optional `smallvec` feature to add conversions for `smallvec::SmallVec`. [#3507](https://github.com/PyO3/pyo3/pull/3507)
- Add `take` and `into_inner` methods to `GILOnceCell` [#3556](https://github.com/PyO3/pyo3/pull/3556)
- `#[classmethod]` methods can now also receive `Py<PyType>` as their first argument. [#3587](https://github.com/PyO3/pyo3/pull/3587)
- `#[pyfunction(pass_module)]` can now also receive `Py<PyModule>` as their first argument. [#3587](https://github.com/PyO3/pyo3/pull/3587)
- Add `traverse` method to `GILProtected`. [#3616](https://github.com/PyO3/pyo3/pull/3616)
- Added `abi3-py312` feature [#3687](https://github.com/PyO3/pyo3/pull/3687)

### Fixed

- Fix minimum version specification for optional `chrono` dependency. [#3512](https://github.com/PyO3/pyo3/pull/3512)
- Silenced new `clippy::unnecessary_fallible_conversions` warning when using a `Py<Self>` `self` receiver. [#3564](https://github.com/PyO3/pyo3/pull/3564)


## [0.20.0] - 2023-10-11

### Packaging
Expand Down Expand Up @@ -1599,7 +1617,8 @@ Yanked

- Initial release

[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.20.0...HEAD
[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.20.1...HEAD
[0.20.1]: https://github.com/pyo3/pyo3/compare/v0.20.0...v0.20.1
[0.20.0]: https://github.com/pyo3/pyo3/compare/v0.19.2...v0.20.0
[0.19.2]: https://github.com/pyo3/pyo3/compare/v0.19.1...v0.19.2
[0.19.1]: https://github.com/pyo3/pyo3/compare/v0.19.0...v0.19.1
Expand Down
51 changes: 42 additions & 9 deletions Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pyo3"
version = "0.20.0"
version = "0.20.1"
description = "Bindings to Python interpreter"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
readme = "README.md"
Expand All @@ -21,10 +21,10 @@ parking_lot = ">= 0.11, < 0.13"
memoffset = "0.9"

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

# support crates for macros feature
pyo3-macros = { path = "pyo3-macros", version = "=0.20.0", optional = true }
pyo3-macros = { path = "pyo3-macros", version = "=0.20.1", optional = true }
indoc = { version = "2.0.1", optional = true }
unindent = { version = "0.2.1", optional = true }

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

# crate integrations that can be added using the eponymous features
anyhow = { version = "1.0", optional = true }
chrono = { version = "0.4", default-features = false, optional = true }
chrono = { version = "0.4.25", default-features = false, optional = true }
either = { version = "1.9", optional = true }
eyre = { version = ">= 0.4, < 0.7", optional = true }
hashbrown = { version = ">= 0.9, < 0.15", optional = true }
indexmap = { version = ">= 1.6, < 3", optional = true }
num-bigint = { version = "0.4", optional = true }
num-complex = { version = ">= 0.2, < 0.5", optional = true }
rust_decimal = { version = "1.0.0", default-features = false, optional = true }
serde = { version = "1.0", optional = true }
smallvec = { version = "1.0", optional = true }

[dev-dependencies]
assert_approx_eq = "1.1.0"
Expand All @@ -51,12 +53,11 @@ proptest = { version = "1.0", default-features = false, features = ["std"] }
send_wrapper = "0.6"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.61"
rayon = "1.0.2"
rust_decimal = { version = "1.8.0", features = ["std"] }
rayon = "1.6.1"
widestring = "0.5.1"

[build-dependencies]
pyo3-build-config = { path = "pyo3-build-config", version = "0.20.0", features = ["resolve-config"] }
pyo3-build-config = { path = "pyo3-build-config", version = "0.20.1", features = ["resolve-config"] }

[features]
default = ["macros"]
Expand Down Expand Up @@ -84,7 +85,8 @@ abi3-py37 = ["abi3-py38", "pyo3-build-config/abi3-py37", "pyo3-ffi/abi3-py37"]
abi3-py38 = ["abi3-py39", "pyo3-build-config/abi3-py38", "pyo3-ffi/abi3-py38"]
abi3-py39 = ["abi3-py310", "pyo3-build-config/abi3-py39", "pyo3-ffi/abi3-py39"]
abi3-py310 = ["abi3-py311", "pyo3-build-config/abi3-py310", "pyo3-ffi/abi3-py310"]
abi3-py311 = ["abi3", "pyo3-build-config/abi3-py311", "pyo3-ffi/abi3-py311"]
abi3-py311 = ["abi3-py312", "pyo3-build-config/abi3-py311", "pyo3-ffi/abi3-py311"]
abi3-py312 = ["abi3", "pyo3-build-config/abi3-py312", "pyo3-ffi/abi3-py312"]

# Automatically generates `python3.dll` import libraries for Windows targets.
generate-import-lib = ["pyo3-ffi/generate-import-lib"]
Expand All @@ -104,8 +106,10 @@ full = [
"num-bigint",
"num-complex",
"hashbrown",
"smallvec",
"serde",
"indexmap",
"either",
"eyre",
"anyhow",
"experimental-inspect",
Expand All @@ -124,5 +128,34 @@ members = [

[package.metadata.docs.rs]
no-default-features = true
features = ["macros", "num-bigint", "num-complex", "hashbrown", "serde", "multiple-pymethods", "indexmap", "eyre", "chrono", "rust_decimal"]
features = ["macros", "num-bigint", "num-complex", "hashbrown", "serde", "multiple-pymethods", "indexmap", "eyre", "either", "chrono", "rust_decimal"]
rustdoc-args = ["--cfg", "docsrs"]

[workspace.lints.clippy]
checked_conversions = "warn"
dbg_macro = "warn"
explicit_into_iter_loop = "warn"
explicit_iter_loop = "warn"
filter_map_next = "warn"
flat_map_option = "warn"
let_unit_value = "warn"
manual_assert = "warn"
manual_ok_or = "warn"
todo = "warn"
unnecessary_wraps = "warn"
useless_transmute = "warn"
used_underscore_binding = "warn"

[workspace.lints.rust]
elided_lifetimes_in_paths = "warn"
invalid_doc_attributes = "warn"
rust_2018_idioms = "warn"
rust_2021_prelude_collisions = "warn"
unused_lifetimes = "warn"

[workspace.lints.rustdoc]
broken_intra_doc_links = "warn"
bare_urls = "warn"

[lints]
workspace = true
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -68,7 +68,7 @@ name = "string_sum"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.20.0", features = ["extension-module"] }
pyo3 = { version = "0.20.1", 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.20.0"
version = "0.20.1"
features = ["auto-initialize"]
```

Expand Down
6 changes: 4 additions & 2 deletions build.rs
Expand Up @@ -33,10 +33,12 @@ fn ensure_auto_initialize_ok(interpreter_config: &InterpreterConfig) -> Result<(
fn configure_pyo3() -> Result<()> {
let interpreter_config = pyo3_build_config::get();

interpreter_config.emit_pyo3_cfgs();

ensure_auto_initialize_ok(interpreter_config)?;

for cfg in interpreter_config.build_script_outputs() {
println!("{}", cfg)
}

// Emit cfgs like `thread_local_const_init`
print_feature_cfgs();

Expand Down
1 change: 1 addition & 0 deletions emscripten/.gitignore
@@ -0,0 +1 @@
pybuilddir.txt
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ publish = false
edition = "2021"

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

[[example]]
name = "decorator"
Expand Down
1 change: 1 addition & 0 deletions examples/README.md
Expand Up @@ -11,6 +11,7 @@ Below is a brief description of each of these:
| `setuptools-rust-starter` | A template project which is configured to use [`setuptools_rust`](https://github.com/PyO3/setuptools-rust/) for development. |
| `word-count` | A quick performance comparison between word counter implementations written in each of Rust and Python. |
| `plugin` | Illustrates how to use Python as a scripting language within a Rust application |
| `sequential` | Illustrates how to use pyo3-ffi to write subinterpreter-safe modules |

## Creating new projects from these examples

Expand Down
2 changes: 1 addition & 1 deletion examples/decorator/.template/pre-script.rhai
@@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.20.0");
variable::set("PYO3_VERSION", "0.20.1");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/pyproject.toml", "pyproject.toml");
file::delete(".template");
3 changes: 3 additions & 0 deletions examples/decorator/.template/pyproject.toml
Expand Up @@ -5,3 +5,6 @@ build-backend = "maturin"
[project]
name = "{{project-name}}"
version = "0.1.0"

[project.optional-dependencies]
dev = ["pytest"]
7 changes: 3 additions & 4 deletions examples/decorator/noxfile.py
Expand Up @@ -2,8 +2,7 @@


@nox.session
def python(session):
session.install("-rrequirements-dev.txt")
session.install("maturin")
session.run_always("maturin", "develop")
def python(session: nox.Session):
session.env["MATURIN_PEP517_ARGS"] = "--profile=dev"
session.install(".[dev]")
session.run("pytest")
3 changes: 3 additions & 0 deletions examples/decorator/pyproject.toml
Expand Up @@ -14,3 +14,6 @@ classifiers = [
"Operating System :: POSIX",
"Operating System :: MacOS :: MacOS X",
]

[project.optional-dependencies]
dev = ["pytest"]
3 changes: 0 additions & 3 deletions examples/decorator/requirements-dev.txt

This file was deleted.

3 changes: 3 additions & 0 deletions examples/decorator/tests/example.py
@@ -1,3 +1,6 @@
from decorator import Counter


@Counter
def say_hello():
print("hello")
Expand Down