|
1 | | -# See ../justfile |
| 1 | +# uv |
2 | 2 |
|
3 | 3 |
|
4 | | -# create the virtualenv |
| 4 | +# use existing env-variable 'UV_PYTHON_INSTALL_DIR' or default to '/opt/python' |
| 5 | +export UV_PYTHON_INSTALL_DIR := env('UV_PYTHON_INSTALL_DIR', '/opt/python') |
| 6 | + |
| 7 | +# install uv/uvx directly in /opt/bin |
| 8 | +export UV_INSTALL_DIR := env('UV_INSTALL_DIR', '/usr/local/bin') |
| 9 | +export TMPDIR := env('TMPDIR', '/tmp') |
| 10 | + |
| 11 | + |
| 12 | +# install uv + uvx |
5 | 13 | [group: 'uv'] |
6 | | -uv-create-venv: |
7 | | - uv venv --seed |
| 14 | +uv-install: |
| 15 | + @ echo "Using temp-folder {{TMPDIR}}" |
| 16 | + mkdir -p {{TMPDIR}} |
| 17 | + curl --create-dirs --fail --location --no-progress-bar --silent --show-error --proto '=https' --tlsv1.2 https://astral.sh/uv/install.sh | env INSTALLER_NO_MODIFY_PATH=1 bash -s -- --verbose |
8 | 18 |
|
| 19 | +alias install-uv := uv-install |
9 | 20 |
|
10 | | -# run uv install to create the virtualenv |
| 21 | + |
| 22 | +# upgrade uv itself |
11 | 23 | [group: 'uv'] |
12 | | -uv-pip-install: |
13 | | - uv pip install --editable . |
| 24 | +uv-upgrade target_version="": |
| 25 | + uv self update {{target_version}} |
| 26 | + |
| 27 | +alias upgrade-uv := uv-upgrade |
14 | 28 |
|
15 | 29 |
|
16 | | -# run uv install without dev-dependencies |
| 30 | +# show location of uv |
17 | 31 | [group: 'uv'] |
18 | | -uv-pip-install-no-dev: |
19 | | - uv pip install --no-dev |
| 32 | +uv-which: |
| 33 | + @ which uv |
20 | 34 |
|
| 35 | +alias which-uv := uv-which |
21 | 36 |
|
22 | | -# run uv sync |
| 37 | + |
| 38 | +# display uv version |
23 | 39 | [group: 'uv'] |
24 | | -uv-sync: |
25 | | - uv sync |
| 40 | +uv-version: |
| 41 | + uv --version |
| 42 | + |
| 43 | +alias version-uv := uv-version |
26 | 44 |
|
27 | 45 |
|
28 | | -# run uv lock |
| 46 | +# clear the cache used by uv |
29 | 47 | [group: 'uv'] |
30 | | -uv-lock: |
31 | | - uv lock |
| 48 | +uv-cache-clean *args: |
| 49 | + uv cache cleans {{args}} |
32 | 50 |
|
33 | 51 |
|
34 | | -# run uv lock --upgrade |
| 52 | +# display cache-dir used by uv |
35 | 53 | [group: 'uv'] |
36 | | -uv-lock-upgrade: |
37 | | - uv lock --upgrade |
| 54 | +uv-cache-dir *args: |
| 55 | + uv cache dir {{args}} |
38 | 56 |
|
39 | 57 |
|
40 | | -# run uv build to create the python-package |
| 58 | +# install the project and all dependencies from only the default groups |
41 | 59 | [group: 'uv'] |
42 | | -uv-build: |
43 | | - uv build --out-dir var/dist |
| 60 | +uv-sync *args: |
| 61 | + uv sync {{args}} |
44 | 62 |
|
| 63 | +# alias uv-install := uv-sync |
| 64 | +alias create-venv := uv-sync |
45 | 65 |
|
46 | | -# publish the package to pypi |
| 66 | + |
| 67 | +# install the project including all dependencies from all groups |
47 | 68 | [group: 'uv'] |
48 | | -uv-publish: |
49 | | - uv publish var/dist/* |
| 69 | +uv-sync-all-groups *args: |
| 70 | + uv sync --all-groups {{args}} |
| 71 | + |
| 72 | +alias uv-sync-all := uv-sync-all-groups |
50 | 73 |
|
51 | 74 |
|
52 | | -# generate a requirements.txt-file |
| 75 | +# install the project with only runtime dependencies (no dev groups) |
| 76 | +[group: 'uv'] |
| 77 | +uv-sync-minimal *args: |
| 78 | + uv sync --no-default-groups {{args}} |
| 79 | + |
| 80 | +alias uv-sync-prod := uv-sync-minimal |
| 81 | + |
| 82 | + |
| 83 | +# update all dependencies from all groups |
| 84 | +[group: 'uv'] |
| 85 | +uv-sync-upgrade-all-groups *args: |
| 86 | + uv sync --upgrade --all-groups {{args}} |
| 87 | + |
| 88 | + |
| 89 | +# update uv.lock |
| 90 | +[group: 'uv'] |
| 91 | +uv-lock *args: |
| 92 | + uv lock {{args}} |
| 93 | + |
| 94 | + |
| 95 | +# check uv.lock is up-to-date |
| 96 | +[group: 'uv'] |
| 97 | +uv-lock-check *args: |
| 98 | + uv lock --check {{args}} |
| 99 | + |
| 100 | + |
| 101 | +# build the python-package |
| 102 | +[group: 'uv'] |
| 103 | +uv-build *args: |
| 104 | + uv build {{args}} |
| 105 | + |
| 106 | + |
| 107 | +# publish the python-package |
| 108 | +[group: 'uv'] |
| 109 | +uv-publish path="dist/" *args: |
| 110 | + uv publish {{path}} --verbose {{args}} |
| 111 | + |
| 112 | + |
| 113 | +# export uv-defined requirements to a pip-installable requirements-file |
53 | 114 | [group: 'uv'] |
54 | 115 | uv-export-requirements: |
55 | | - uv export --format requirements-txt --output-file requirements.txt |
| 116 | + uv export --format requirements-txt --no-hashes --output-file etc/requirements.txt |
| 117 | + @ echo -e "Updated etc/requirements.txt" |
| 118 | + |
| 119 | +alias uv-export := uv-export-requirements |
56 | 120 |
|
57 | 121 |
|
58 | | -# generate a requirements.txt-file for readthedocs |
| 122 | +# set python-version in .python-version file |
59 | 123 | [group: 'uv'] |
60 | | -uv-export-requirements-docs: |
61 | | - uv export --format requirements-txt --only-group docs --no-hashes --output-file docs/requirements.txt |
| 124 | +[unix] |
| 125 | +uv-set-python-version version="3.10" *args: |
| 126 | + mv .python-version .python-version.backup |
| 127 | + @ echo "{{version}}" > .python-version |
| 128 | + @ echo -e "Set python version to {{version}}" |
| 129 | + |
| 130 | + |
| 131 | +# bump project version in pyproject.toml |
| 132 | +[group: 'uv'] |
| 133 | +uv-bump-version value="patch": |
| 134 | + uv version {{value}} |
| 135 | + |
0 commit comments