layout_uv() {
# Watch the uv configuration file for changes
watch_file .python-version pyproject.toml uv.lock
# Use --frozen so that direnv entry does not change the lock contents. This
# can fail if the lock file is badly out of sync, but it'll report that to the
# user and the resolution is obvious.
uv sync --frozen --all-groups || true
# activate the virtualenv after syncing; this puts the newly-installed
# binaries on PATH.
venv_path="$(expand_path "${UV_PROJECT_ENVIRONMENT:-.venv}")"
if [[ -e $venv_path ]]; then
# shellcheck source=/dev/null
source "$venv_path/bin/activate"
fi
}
use flake
layout_uv