Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
43 changes: 43 additions & 0 deletions tests/test_build_no_uv_refresh.py
Original file line number Diff line number Diff line change
@@ -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"]
Loading