|
| 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