inventory: update to 0.3

This commit is contained in:
David Hewitt 2022-07-03 14:38:26 +01:00
parent 17742dc766
commit 0391b3b0c1
6 changed files with 19 additions and 8 deletions

View File

@ -72,8 +72,8 @@ jobs:
echo "suppress_build_script_link_lines=true" >> config.txt echo "suppress_build_script_link_lines=true" >> config.txt
PYO3_BUILD_CONFIG=$(pwd)/config.txt cargo check --all-targets --no-default-features PYO3_BUILD_CONFIG=$(pwd)/config.txt cargo check --all-targets --no-default-features
PYO3_BUILD_CONFIG=$(pwd)/config.txt cargo check --all-targets --no-default-features --features "abi3" PYO3_BUILD_CONFIG=$(pwd)/config.txt cargo check --all-targets --no-default-features --features "abi3"
PYO3_BUILD_CONFIG=$(pwd)/config.txt cargo check --all-targets --features full PYO3_BUILD_CONFIG=$(pwd)/config.txt cargo check --all-targets --features "full multiple-pymethods"
PYO3_BUILD_CONFIG=$(pwd)/config.txt cargo check --all-targets --features "abi3 full" PYO3_BUILD_CONFIG=$(pwd)/config.txt cargo check --all-targets --features "abi3 full multiple-pymethods"
done done
build: build:
@ -84,6 +84,7 @@ jobs:
# If one platform fails, allow the rest to keep testing if `CI-no-fail-fast` label is present # If one platform fails, allow the rest to keep testing if `CI-no-fail-fast` label is present
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }} fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
matrix: matrix:
extra_features: ["multiple-pymethods"] # Because MSRV doesn't support this
rust: [stable] rust: [stable]
python-version: [ python-version: [
"3.7", "3.7",
@ -124,6 +125,7 @@ jobs:
rust-target: "x86_64-unknown-linux-gnu", rust-target: "x86_64-unknown-linux-gnu",
} }
msrv: "MSRV" msrv: "MSRV"
extra_features: ""
# Test the `nightly` feature # Test the `nightly` feature
- rust: nightly - rust: nightly
@ -134,7 +136,7 @@ jobs:
python-architecture: "x64", python-architecture: "x64",
rust-target: "x86_64-unknown-linux-gnu", rust-target: "x86_64-unknown-linux-gnu",
} }
extra_features: "nightly" extra_features: "nightly multiple-pymethods"
# Test 32-bit Windows only with the latest Python version # Test 32-bit Windows only with the latest Python version
- rust: stable - rust: stable
@ -145,6 +147,7 @@ jobs:
python-architecture: "x86", python-architecture: "x86",
rust-target: "i686-pc-windows-msvc", rust-target: "i686-pc-windows-msvc",
} }
extra_features: "multiple-pymethods"
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3

View File

@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Packaging
- Update inventory dependency to `0.3` (the `multiple-pymethods` feature now requires Rust 1.62 for correctness). [#2492](https://github.com/PyO3/pyo3/pull/2492)
### Added ### Added
- Implement `ToPyObject` for `[T; N]`. [#2313](https://github.com/PyO3/pyo3/pull/2313) - Implement `ToPyObject` for `[T; N]`. [#2313](https://github.com/PyO3/pyo3/pull/2313)

View File

@ -28,7 +28,7 @@ indoc = { version = "1.0.3", optional = true }
unindent = { version = "0.1.4", optional = true } unindent = { version = "0.1.4", optional = true }
# support crate for multiple-pymethods feature # support crate for multiple-pymethods feature
inventory = { version = "0.2.0", optional = true } inventory = { version = "0.3.0", optional = true }
# crate integrations that can be added using the eponymous features # crate integrations that can be added using the eponymous features
anyhow = { version = "1.0", optional = true } anyhow = { version = "1.0", optional = true }
@ -98,7 +98,7 @@ nightly = []
full = [ full = [
"macros", "macros",
"pyproto", "pyproto",
"multiple-pymethods", # "multiple-pymethods", # TODO re-add this when MSRV is greater than 1.62
"num-bigint", "num-bigint",
"num-complex", "num-complex",
"hashbrown", "hashbrown",

View File

@ -944,9 +944,9 @@ This simple technique works for the case when there is zero or one implementatio
The `#[pyclass]` macro expands to roughly the code seen below. The `PyClassImplCollector` is the type used internally by PyO3 for dtolnay specialization: The `#[pyclass]` macro expands to roughly the code seen below. The `PyClassImplCollector` is the type used internally by PyO3 for dtolnay specialization:
```rust ```rust
# #[cfg(not(feature = "multiple-pymethods"))] { # #[cfg(not(any(feature = "multiple-pymethods", feature = "pyproto")))] {
# use pyo3::prelude::*; # use pyo3::prelude::*;
// Note: the implementation differs slightly with the `multiple-pymethods` feature enabled. // Note: the implementation differs slightly with the `pyproto` or `multiple-pymethods` features enabled.
struct MyClass { struct MyClass {
# #[allow(dead_code)] # #[allow(dead_code)]
num: i32, num: i32,

View File

@ -69,7 +69,7 @@ These macros require a number of dependencies which may not be needed by users w
### `multiple-pymethods` ### `multiple-pymethods`
This feature enables a dependency on `inventory`, which enables each `#[pyclass]` to have more than one `#[pymethods]` block. This feature enables a dependency on `inventory`, which enables each `#[pyclass]` to have more than one `#[pymethods]` block. This feature also requires a minimum Rust version of 1.62 due to limitations in the `inventory` crate.
Most users should only need a single `#[pymethods]` per `#[pyclass]`. In addition, not all platforms (e.g. Wasm) are supported by `inventory`. For this reason this feature is not enabled by default, meaning fewer dependencies and faster compilation for the majority of users. Most users should only need a single `#[pymethods]` per `#[pyclass]`. In addition, not all platforms (e.g. Wasm) are supported by `inventory`. For this reason this feature is not enabled by default, meaning fewer dependencies and faster compilation for the majority of users.

View File

@ -5,6 +5,10 @@ For a detailed list of all changes, see the [CHANGELOG](changelog.md).
## from 0.16.* to 0.17 ## from 0.16.* to 0.17
### The `multiple-pymethods` feature now requires Rust 1.62
Due to limitations in the `inventory` crate which the `multiple-pymethods` feature depends on, this feature now
requires Rust 1.62. For more information see [dtolnay/inventory#32](https://github.com/dtolnay/inventory/issues/32).
### Added `impl IntoPy<Py<PyString>> for &str` ### Added `impl IntoPy<Py<PyString>> for &str`