From 029454afe36265cd482f6cca20ad257155d3c434 Mon Sep 17 00:00:00 2001 From: robfrank Date: Fri, 23 Oct 2026 01:14:24 +0200 Subject: [PATCH] fix(#5): drop build.sh's uv dev-environment refresh The refresh ran uv lock/uv sync in a separate uv project wrapping the package, a monorepo layout. Here the repository root is the package (managed = false, uv lock refuses it). The guard compared a physical and a logical path as strings, so a symlinked checkout ran the block and failed the build; compared correctly, it never runs. Removed, with a test that the build scripts call neither uv lock nor uv sync. Co-Authored-By: Claude Opus 5.5 --- scripts/build.sh | 17 ------------ tests/test_build_no_uv_refresh.py | 43 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 tests/test_build_no_uv_refresh.py diff --git a/scripts/build.sh b/scripts/build.sh index 4ac30bf4..a182a122 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -516,23 +516,6 @@ fi echo "" -# Refresh the repo-root uv dev environment so `uv run pytest` immediately uses -# the wheel that was just built. Skipped in CI, which installs wheels itself. -if [ -z "${CI:-}" ] && command -v uv > /dev/null 2>&1; then - REPO_ROOT=$(git rev-parse --show-toplevel 2> /dev/null || true) - # Only when a separate dev project wraps this package: at this repo's root the - # pyproject IS the package, `[tool.uv] managed = false`, so `uv lock` refuses it. - if [ -n "$REPO_ROOT" ] && [ "$REPO_ROOT" != "$PY_BINDINGS_DIR" ] && [ -f "$REPO_ROOT/pyproject.toml" ]; then - echo -e "${CYAN}๐Ÿ”„ Refreshing uv dev environment at repo root...${NC}" - ( - cd "$REPO_ROOT" && - uv lock --upgrade-package arcadedb-embedded && - uv sync --reinstall-package arcadedb-embedded - ) - fi -fi - -echo "" echo -e "${BLUE}๐Ÿ’ก Next steps:${NC}" echo -e " ๐Ÿงช Run tests (from the repository root):" echo -e " ${YELLOW}uv run pytest${NC}" diff --git a/tests/test_build_no_uv_refresh.py b/tests/test_build_no_uv_refresh.py new file mode 100644 index 00000000..0f0894b5 --- /dev/null +++ b/tests/test_build_no_uv_refresh.py @@ -0,0 +1,43 @@ +"""A local build does not run ``uv lock`` or ``uv sync``. + +scripts/build.sh used to refresh "the repo-root uv dev environment" after a +build, for the monorepo layout where a separate uv project wrapped this +package. Here the repository root is the package: its pyproject says +``[tool.uv] managed = false``, and ``uv lock`` refuses it. The block was guarded +by a string comparison of a physical and a logical path, so a checkout reached +through a symlink ran it and failed the build (#5); with a correct comparison it +never runs at all, so it is gone. Tests run against the wheel installed into a +virtual environment instead (README, Testing). +""" + +from __future__ import annotations + +import re +from pathlib import Path + +BUILD_SCRIPTS = sorted( + (Path(__file__).resolve().parents[1] / "scripts").glob("build*.sh") +) + +UV_PROJECT_COMMAND = re.compile(r"^\s*[^#\n]*\buv\s+(lock|sync)\b", re.MULTILINE) + + +def test_build_scripts_do_not_lock_or_sync_a_uv_project(): + offenders = [ + f"{script.name}: {match.group(0).strip()}" + for script in BUILD_SCRIPTS + for match in UV_PROJECT_COMMAND.finditer(script.read_text(encoding="utf-8")) + ] + assert offenders == [] + + +def test_the_scan_sees_the_old_refresh(): + old = ( + " (\n" + ' cd "$REPO_ROOT" &&\n' + " uv lock --upgrade-package arcadedb-embedded &&\n" + " uv sync --reinstall-package arcadedb-embedded\n" + " )\n" + " # uv lock in a comment is not a command\n" + ) + assert [m.group(1) for m in UV_PROJECT_COMMAND.finditer(old)] == ["lock", "sync"]