You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor to store CPython ABI metadata in a struct combining two enums (#3110)
Towards #3064.
This is purely refactoring, there should be no functional changes as a
result of this.
Currently the build metadata special-cases ABI3 builds or more generally
assumes stable ABI builds and ABI3 builds are the same thing. With PEP
803 and the new abi3t ABI in Python 3.15, that is no longer the case.
This replaces the old `ABI3Version` enum with a new struct combining two
enums:
```rust
/// struct describing ABI layout to use for build
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct StableAbi {
/// The "kind" of stable ABI. Either abi3 or abi3t currently.
pub kind: StableAbiKind,
/// The minimum Python version to build for.
pub version: StableAbiVersion,
}
/// Python version to use as the abi3/abi3t target.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum StableAbiVersion {
/// Stable ABI wheels will have a minimum Python version matching the
/// version of the current Python interpreter
CurrentPython,
/// Stable ABI wheels will have a fixed user-specified minimum Python
/// version
Version(u8, u8),
}
/// The "kind" of stable ABI. Either abi3 or abi3t currently.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum StableAbiKind {
/// The original stable ABI, supporting Python 3.2 and up
Abi3,
}
```
`StableAbiVersion` is just the old `Abi3Version` enum renamed since the
concept of a minimum supported version is shared by abi3t.
I have [a
branch](main...ngoldbaum:maturin:abi3t)
that adds an `Abi3t` variant for `StableAbiKind`. My goal with this PR
is to make reviewing the subsequent PR adding abi3t support easier.
Also see PyO3/pyo3#5924 where I made a similar
change in PyO3. Here in Maturin I needed different types but in
principle I could make the two implementations use shared code. I'm not
sure if that's actually useful for anything in practice.
---------
Co-authored-by: messense <messense@icloud.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
0 commit comments