Better defaults for native build backend cache keys (#15705)
<!-- 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 change extends the default initialized projects with scikit and maturin build backends to ensure that the rust or C++ build gets invoked when a source file changes. ## Test Plan `cargo run init cppextension-test --build-backend=scikit` followed by manual testing of the behaviour of the resulting project under `uv run --with jupyter jupyter lab` and changes to the source file of the extension. Analogous for `cargo run init maturin-test --build-backend=maturin `. ## Relevant Issues The question of why the python extension is not rebuilt on source changes has been discussed in https://github.com/astral-sh/uv/issues/15701#issuecomment-3258714942.
This commit is contained in:
@@ -989,6 +989,9 @@ fn pyproject_build_system(package: &PackageName, build_backend: ProjectBuildBack
|
||||
python-packages = ["{module_name}"]
|
||||
python-source = "src"
|
||||
|
||||
[tool.uv]
|
||||
cache-keys = [{{ file = "pyproject.toml" }}, {{ file = "src/**/*.rs" }}, {{ file = "Cargo.toml" }}, {{ file = "Cargo.lock" }}]
|
||||
|
||||
[build-system]
|
||||
requires = ["maturin>=1.0,<2.0"]
|
||||
build-backend = "maturin"
|
||||
@@ -998,6 +1001,9 @@ fn pyproject_build_system(package: &PackageName, build_backend: ProjectBuildBack
|
||||
minimum-version = "build-system.requires"
|
||||
build-dir = "build/{wheel_tag}"
|
||||
|
||||
[tool.uv]
|
||||
cache-keys = [{ file = "pyproject.toml" }, { file = "src/**/*.{h,c,hpp,cpp}" }, { file = "CMakeLists.txt" }]
|
||||
|
||||
[build-system]
|
||||
requires = ["scikit-build-core>=0.10", "pybind11"]
|
||||
build-backend = "scikit_build_core.build"
|
||||
|
||||
@@ -3322,6 +3322,9 @@ fn init_app_build_backend_maturin() -> Result<()> {
|
||||
python-packages = ["foo"]
|
||||
python-source = "src"
|
||||
|
||||
[tool.uv]
|
||||
cache-keys = [{ file = "pyproject.toml" }, { file = "src/**/*.rs" }, { file = "Cargo.toml" }, { file = "Cargo.lock" }]
|
||||
|
||||
[build-system]
|
||||
requires = ["maturin>=1.0,<2.0"]
|
||||
build-backend = "maturin"
|
||||
@@ -3451,6 +3454,9 @@ fn init_app_build_backend_scikit() -> Result<()> {
|
||||
minimum-version = "build-system.requires"
|
||||
build-dir = "build/{wheel_tag}"
|
||||
|
||||
[tool.uv]
|
||||
cache-keys = [{ file = "pyproject.toml" }, { file = "src/**/*.{h,c,hpp,cpp}" }, { file = "CMakeLists.txt" }]
|
||||
|
||||
[build-system]
|
||||
requires = ["scikit-build-core>=0.10", "pybind11"]
|
||||
build-backend = "scikit_build_core.build"
|
||||
@@ -3573,6 +3579,9 @@ fn init_lib_build_backend_maturin() -> Result<()> {
|
||||
python-packages = ["foo"]
|
||||
python-source = "src"
|
||||
|
||||
[tool.uv]
|
||||
cache-keys = [{ file = "pyproject.toml" }, { file = "src/**/*.rs" }, { file = "Cargo.toml" }, { file = "Cargo.lock" }]
|
||||
|
||||
[build-system]
|
||||
requires = ["maturin>=1.0,<2.0"]
|
||||
build-backend = "maturin"
|
||||
@@ -3699,6 +3708,9 @@ fn init_lib_build_backend_scikit() -> Result<()> {
|
||||
minimum-version = "build-system.requires"
|
||||
build-dir = "build/{wheel_tag}"
|
||||
|
||||
[tool.uv]
|
||||
cache-keys = [{ file = "pyproject.toml" }, { file = "src/**/*.{h,c,hpp,cpp}" }, { file = "CMakeLists.txt" }]
|
||||
|
||||
[build-system]
|
||||
requires = ["scikit-build-core>=0.10", "pybind11"]
|
||||
build-backend = "scikit_build_core.build"
|
||||
|
||||
Reference in New Issue
Block a user