diff --git a/src/python_interpreter/mod.rs b/src/python_interpreter/mod.rs index 0bd0916a1..e772a9fa1 100644 --- a/src/python_interpreter/mod.rs +++ b/src/python_interpreter/mod.rs @@ -626,10 +626,28 @@ impl PythonInterpreter { bridge: &BridgeModel, min_python_minor: Option, ) -> Result> { - 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 { diff --git a/src/templates/Cargo.toml.j2 b/src/templates/Cargo.toml.j2 index 369be4c16..86c240aef 100644 --- a/src/templates/Cargo.toml.j2 +++ b/src/templates/Cargo.toml.j2 @@ -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 -%} diff --git a/src/templates/pyproject.toml.j2 b/src/templates/pyproject.toml.j2 index d955a5e0d..4664e50eb 100644 --- a/src/templates/pyproject.toml.j2 +++ b/src/templates/pyproject.toml.j2 @@ -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",