Skip to content

Commit b5c63d7

Browse files
committed
Lock dependencies and python-version with uv
Locking is super important if you want to reproduce a certain state of the package, as has been the case for wpull these last few years. And provide a direnv integration to attach to the virtualenv.
1 parent 21869e9 commit b5c63d7

File tree

3 files changed

+339
-0
lines changed

3 files changed

+339
-0
lines changed

.envrc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# https://github.com/direnv/direnv/pull/1352
2+
layout_uv() {
3+
# Watch the uv configuration file for changes
4+
watch_file .python-version pyproject.toml uv.lock
5+
6+
# Use --frozen so that direnv entry does not change the lock contents. This
7+
# can fail if the lock file is badly out of sync, but it'll report that to the
8+
# user and the resolution is obvious.
9+
uv sync --frozen || true
10+
11+
# activate the virtualenv after syncing; this puts the newly-installed
12+
# binaries on PATH.
13+
venv_path="$(expand_path "${UV_PROJECT_ENVIRONMENT:-.venv}")"
14+
if [[ -e $venv_path ]]; then
15+
# shellcheck source=/dev/null
16+
source "$venv_path/bin/activate"
17+
fi
18+
}
19+
20+
layout_uv

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.9.23

0 commit comments

Comments
 (0)