Skip to content

Commit 9bb927c

Browse files
build: add uv taskfile
1 parent 6d65cd0 commit 9bb927c

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

taskfile.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ includes:
2121
taskfile: ./taskfiles/poetry.yml
2222
redis:
2323
taskfile: ./taskfiles/redis.yml
24+
uv:
25+
taskfile: ./taskfiles/uv.yml
2426

2527
tasks:
2628
default:

taskfiles/uv.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
version: "3.0"
2+
3+
set: ['e', 'u', 'pipefail']
4+
shopt: ['globstar']
5+
6+
env:
7+
UV_PROJECT_ENVIRONMENT: ".venv"
8+
9+
tasks:
10+
install-uv:
11+
desc: "Install uv"
12+
cmds:
13+
- curl -LsSf https://astral.sh/uv/install.sh | sh
14+
status:
15+
- command -v uv 2>/dev/null
16+
17+
venv:
18+
desc: "Create a virtual environment"
19+
cmds:
20+
- uv venv
21+
dir: "{{.ROOT_DIR}}"
22+
status:
23+
- test -d "{{.ROOT_DIR}}/{{.UV_PROJECT_ENVIRONMENT}}"
24+
25+
install:
26+
desc: "Install project dependencies"
27+
cmds:
28+
- uv pip install -r pyproject.toml
29+
dir: "{{.ROOT_DIR}}"
30+
31+
lock:
32+
desc: "Update the project's lockfile."
33+
summary: |
34+
If the project lockfile (uv.lock) does not exist, it will be created. If a lockfile is present, its contents will be used as preferences for the resolution.
35+
36+
If there are no changes to the project's dependencies, locking will have no effect unless the --upgrade flag is provided.
37+
cmds:
38+
- uv lock
39+
dir: "{{.ROOT_DIR}}"
40+
41+
sync:
42+
desc: "Sync dependencies with lockfile"
43+
summary: |
44+
Syncing ensures that all project dependencies are installed and up-to-date with the lockfile.
45+
46+
By default, an exact sync is performed: uv removes packages that are not declared as dependencies of the project.
47+
cmds:
48+
- uv sync --frozen
49+
dir: "{{.ROOT_DIR}}"
50+
51+
update-deps:
52+
desc: "Update dependencies"
53+
summary: |
54+
Allow package upgrades, ignoring pinned versions in any existing output file. Implies --refresh
55+
cmds:
56+
- uv lock --upgrade
57+
58+
export-reqs:
59+
desc: "Export requirements.txt"
60+
summary: |
61+
Export the project dependencies to a requirements.txt file.
62+
cmds:
63+
- uv pip compile pyproject.toml -o {{.ROOT_DIR}}/requirements.txt
64+
ignore_error: true

0 commit comments

Comments
 (0)