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

Compare minimum python version requirement between requires-python and bindings crate #954

Merged
merged 1 commit into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* **Breaking Change**: Drop support for python 3.6, which is end of life
* Fix incompatibility with cibuildwheel for 32-bit Windows in [#951](https://github.com/PyO3/maturin/pull/951)
* Don't require `pip` error messages to be utf-8 encoding in [#953](https://github.com/PyO3/maturin/pull/953)
* Compare minimum python version requirement between `requires-python` and bindings crate in [#954](https://github.com/PyO3/maturin/pull/954)

## [0.12.19] - 2022-06-05

Expand Down
26 changes: 22 additions & 4 deletions src/python_interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,28 @@ impl PythonInterpreter {
bridge: &BridgeModel,
min_python_minor: Option<usize>,
) -> Result<Vec<PythonInterpreter>> {
let min_python_minor = min_python_minor.unwrap_or(match bridge {
BridgeModel::Bindings(_, minor) => *minor,
_ => MINIMUM_PYTHON_MINOR,
});
let min_python_minor = match min_python_minor {
Some(requires_python_minor) => match bridge {
BridgeModel::Bindings(bridge_name, minor)
| BridgeModel::Bin(Some((bridge_name, minor))) => {
// requires-python minor version might be lower than bridge crate required minor version
if requires_python_minor >= *minor {
requires_python_minor
} else {
eprintln!(
"⚠️ Warning: 'requires-python' (3.{}) is lower than the requirement of {} crate (3.{}).",
requires_python_minor, bridge_name, *minor
);
*minor
}
}
_ => requires_python_minor,
},
None => match bridge {
BridgeModel::Bindings(_, minor) | BridgeModel::Bin(Some((_, minor))) => *minor,
_ => MINIMUM_PYTHON_MINOR,
},
};
let executables = if target.is_windows() {
find_all_windows(target, min_python_minor)?
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/templates/Cargo.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ crate-type = ["cdylib"]

[dependencies]
{%- if bindings == "pyo3" -%}
pyo3 = { version = "0.16.3", features = ["extension-module"] }
pyo3 = { version = "0.16.5", features = ["extension-module"] }
{%- elif bindings == "rust-cpython" -%}
cpython = { version = "0.7.0", features = ["extension-module"] }
{%- endif -%}
Expand Down
2 changes: 1 addition & 1 deletion src/templates/pyproject.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "{{ name }}"
requires-python = ">=3.6"
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
Expand Down