Skip to content

Commit

Permalink
Merge pull request #2492 from davidhewitt/inventory-0.3
Browse files Browse the repository at this point in the history
inventory: update to 0.3
  • Loading branch information
davidhewitt committed Jul 4, 2022
2 parents 1cd1dbf + 0391b3b commit eb2e080
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Expand Up @@ -72,8 +72,8 @@ jobs:
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 --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 "abi3 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 multiple-pymethods"
done
build:
Expand All @@ -84,6 +84,7 @@ jobs:
# 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') }}
matrix:
extra_features: ["multiple-pymethods"] # Because MSRV doesn't support this
rust: [stable]
python-version: [
"3.7",
Expand Down Expand Up @@ -124,6 +125,7 @@ jobs:
rust-target: "x86_64-unknown-linux-gnu",
}
msrv: "MSRV"
extra_features: ""

# Test the `nightly` feature
- rust: nightly
Expand All @@ -134,7 +136,7 @@ jobs:
python-architecture: "x64",
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
- rust: stable
Expand All @@ -145,6 +147,7 @@ jobs:
python-architecture: "x86",
rust-target: "i686-pc-windows-msvc",
}
extra_features: "multiple-pymethods"
steps:
- uses: actions/checkout@v3

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [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

- Implement `ToPyObject` for `[T; N]`. [#2313](https://github.com/PyO3/pyo3/pull/2313)
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Expand Up @@ -28,7 +28,7 @@ indoc = { version = "1.0.3", optional = true }
unindent = { version = "0.1.4", optional = true }

# 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
anyhow = { version = "1.0", optional = true }
Expand Down Expand Up @@ -98,7 +98,7 @@ nightly = []
full = [
"macros",
"pyproto",
"multiple-pymethods",
# "multiple-pymethods", # TODO re-add this when MSRV is greater than 1.62
"num-bigint",
"num-complex",
"hashbrown",
Expand Down
4 changes: 2 additions & 2 deletions guide/src/class.md
Expand Up @@ -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:

```rust
# #[cfg(not(feature = "multiple-pymethods"))] {
# #[cfg(not(any(feature = "multiple-pymethods", feature = "pyproto")))] {
# 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 {
# #[allow(dead_code)]
num: i32,
Expand Down
2 changes: 1 addition & 1 deletion guide/src/features.md
Expand Up @@ -69,7 +69,7 @@ These macros require a number of dependencies which may not be needed by users w
### `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.

Expand Down
4 changes: 4 additions & 0 deletions guide/src/migration.md
Expand Up @@ -5,6 +5,10 @@ For a detailed list of all changes, see the [CHANGELOG](changelog.md).

## 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`

Expand Down

0 comments on commit eb2e080

Please sign in to comment.