From da2e2a0249324e7297941c1ccd3fa39fc781cb0a Mon Sep 17 00:00:00 2001 From: zackees Date: Sun, 21 Jun 2026 23:00:46 -0700 Subject: [PATCH] fix(uv): re-sync editable on Rust edits via cache-keys (#2 item 7) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Default uv only watches pyproject.toml for cache invalidation, so an editable install silently leaves a stale `_native.pyd` after .rs edits. `uv run` then executes against pre-edit Rust code with no warning — a particularly silent footgun in a maturin-backed project where the .pyd is invisible to the developer. Add `[tool.uv] cache-keys` globs that cover Cargo.toml, Cargo.lock, rust-toolchain.toml, and crates/**/*.rs / crates/**/Cargo.toml. Now `uv run` triggers re-sync on real source changes. Correctness fix, not raw speed — but the fast iteration loop depends on it. Ported from FastLED/fbuild#661. Refs zackees/template-python-rust-cmd#2 (item 7). Co-Authored-By: Claude Opus 4.7 --- pyproject.toml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index c9695d4..fd2b4c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,3 +34,19 @@ minversion = "8.0" addopts = ["-ra", "--strict-markers"] testpaths = ["tests"] pythonpath = ["src"] + +# Re-sync the editable install when these files change. Default uv +# only watches pyproject.toml, so editable installs silently leave a +# stale `_native.pyd` after .rs edits — `uv run` would then execute +# against pre-edit Rust code with no visible warning. The globs trigger +# re-sync on real source changes. Correctness, not raw speed, but the +# fast iteration loop depends on it. See fbuild#661 / #2 item (7). +[tool.uv] +cache-keys = [ + { file = "pyproject.toml" }, + { file = "Cargo.toml" }, + { file = "Cargo.lock" }, + { file = "rust-toolchain.toml" }, + { file = "crates/**/*.rs" }, + { file = "crates/**/Cargo.toml" }, +]