chore: update versions in new project init (#18417)

<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

This updates the versions a bit in the new project init.
Scikit-build-core updated to 0.12+, pybind11 updated to 3+ (which allows
a small simplification), and PyO3 updated to 0.28.2+ (which is what I
was running into, it was on an old version).

I also wanted to update the gitignore, as it's missing a bunch of things
for Maturin (like `target/*` and `*.so`!), but I guess that's somewhere
else.

---------

Co-authored-by: konstin <konstin@mailbox.org>
This commit is contained in:
Henry Schreiner
2026-03-13 09:50:51 -04:00
committed by GitHub
parent 8b299789d2
commit 6541b475b9
2 changed files with 9 additions and 12 deletions
+3 -4
View File
@@ -1075,7 +1075,7 @@ fn pyproject_build_system(package: &PackageName, build_backend: ProjectBuildBack
cache-keys = [{ file = "pyproject.toml" }, { file = "src/**/*.{h,c,hpp,cpp}" }, { file = "CMakeLists.txt" }]
[build-system]
requires = ["scikit-build-core>=0.10", "pybind11"]
requires = ["scikit-build-core>=0.12", "pybind11>=3"]
build-backend = "scikit_build_core.build"
"#}
.to_string(),
@@ -1119,7 +1119,7 @@ fn pyproject_build_backend_prerequisites(
[dependencies]
# "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so)
# "abi3-py39" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.9
pyo3 = {{ version = "0.27.1", features = ["extension-module", "abi3-py39"] }}
pyo3 = {{ version = "0.28.2", features = ["extension-module", "abi3-py39"] }}
"#},
)?;
}
@@ -1131,10 +1131,9 @@ fn pyproject_build_backend_prerequisites(
fs_err::write(
build_file,
indoc::formatdoc! {r"
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.15...4.0)
project(${{SKBUILD_PROJECT_NAME}} LANGUAGES CXX)
set(PYBIND11_FINDPYTHON ON)
find_package(pybind11 CONFIG REQUIRED)
pybind11_add_module(_core MODULE src/main.cpp)
+6 -8
View File
@@ -3503,7 +3503,7 @@ fn init_app_build_backend_maturin() -> Result<()> {
[dependencies]
# "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so)
# "abi3-py39" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.9
pyo3 = { version = "0.27.1", features = ["extension-module", "abi3-py39"] }
pyo3 = { version = "0.28.2", features = ["extension-module", "abi3-py39"] }
"#
);
});
@@ -3559,7 +3559,7 @@ fn init_app_build_backend_scikit() -> Result<()> {
cache-keys = [{ file = "pyproject.toml" }, { file = "src/**/*.{h,c,hpp,cpp}" }, { file = "CMakeLists.txt" }]
[build-system]
requires = ["scikit-build-core>=0.10", "pybind11"]
requires = ["scikit-build-core>=0.12", "pybind11>=3"]
build-backend = "scikit_build_core.build"
"#
);
@@ -3618,10 +3618,9 @@ fn init_app_build_backend_scikit() -> Result<()> {
}, {
assert_snapshot!(
build_file_contents, @"
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.15...4.0)
project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX)
set(PYBIND11_FINDPYTHON ON)
find_package(pybind11 CONFIG REQUIRED)
pybind11_add_module(_core MODULE src/main.cpp)
@@ -3755,7 +3754,7 @@ fn init_lib_build_backend_maturin() -> Result<()> {
[dependencies]
# "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so)
# "abi3-py39" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.9
pyo3 = { version = "0.27.1", features = ["extension-module", "abi3-py39"] }
pyo3 = { version = "0.28.2", features = ["extension-module", "abi3-py39"] }
"#
);
});
@@ -3808,7 +3807,7 @@ fn init_lib_build_backend_scikit() -> Result<()> {
cache-keys = [{ file = "pyproject.toml" }, { file = "src/**/*.{h,c,hpp,cpp}" }, { file = "CMakeLists.txt" }]
[build-system]
requires = ["scikit-build-core>=0.10", "pybind11"]
requires = ["scikit-build-core>=0.12", "pybind11>=3"]
build-backend = "scikit_build_core.build"
"#
);
@@ -3867,10 +3866,9 @@ fn init_lib_build_backend_scikit() -> Result<()> {
}, {
assert_snapshot!(
build_file_contents, @"
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.15...4.0)
project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX)
set(PYBIND11_FINDPYTHON ON)
find_package(pybind11 CONFIG REQUIRED)
pybind11_add_module(_core MODULE src/main.cpp)