Skip to content

Commit b387e1a

Browse files
committed
feat: check if uv is already installed
1 parent c8a035a commit b387e1a

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repos:
3131
- repo: https://github.com/astral-sh/ruff-pre-commit
3232
rev: v0.12.4
3333
hooks:
34-
- id: ruff
34+
- id: ruff-check
3535
types_or: [python, pyi, jupyter]
3636
args: [--fix, --show-fixes, --exit-non-zero-on-fix]
3737
- id: ruff-format
@@ -48,8 +48,6 @@ repos:
4848
- id: prettier
4949
types_or: [markdown, yaml]
5050
- repo: https://github.com/astral-sh/uv-pre-commit
51-
# uv version.
5251
rev: 0.8.0
5352
hooks:
54-
# Update the uv lockfile
5553
- id: uv-lock

Makefile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,34 @@ DOCKER_IMG_NAME=ghcr.io/komorebi-ai/python-template
66
DOCKER_CONTAINER=template
77
GH_USER=GITHUB_USERNAME
88
GH_TOKEN_FILE=GITHUB_TOKEN_PATH
9+
RUN=uv run
910

1011
# Install uv, pre-commit hooks and dependencies
11-
# Note that `uv run` has an implicit `uv sync`, since it will (if necessary):
12+
# Note that `$(RUN)` has an implicit `uv sync`, since it will (if necessary):
1213
# - Download an install Python
1314
# - Create a virtual environment
1415
# - Update `uv.lock`
1516
# - Sync the virtual env, installing and removing dependencies as required
1617
install:
17-
curl -LsSf https://astral.sh/uv/install.sh | sh
18-
uv run pre-commit install
18+
@command -v uv && echo "uv already installed" || curl -LsSf https://astral.sh/uv/install.sh | sh
19+
$(RUN) pre-commit install
1920

2021
hooks:
21-
uv run pre-commit run --all-files
22+
$(RUN) pre-commit run --all-files
2223

2324
hooks-update:
24-
uv run pre-commit autoupdate
25+
$(RUN) pre-commit autoupdate
2526

2627
# Specific packages can be upgrade with `--upgrade-package PKG`
2728
upgrade:
2829
uv lock --upgrade
2930

3031
ruff:
31-
uv run ruff format .
32-
uv run ruff check --fix --show-fixes .
32+
$(RUN) ruff format .
33+
$(RUN) ruff check --fix --show-fixes .
3334

3435
test:
35-
uv run pytest
36+
$(RUN) pytest
3637

3738
test-api:
3839
uvx --from httpie http GET localhost:6000

0 commit comments

Comments
 (0)