Skip to content

Commit 87a1241

Browse files
authored
ci: add uv (#465)
## on home internet (cold) curl -LsSf https://astral.sh/uv/install.sh | sh real 0m5.687s user 0m0.434s sys 0m0.180s uv pip install real 0m13.621s user 0m2.195s sys 0m1.532s pip install real 0m27.810s user 0m14.600s sys 0m1.172s ## ci (cold) make install (pip install) 34s make install (install uv + uv pip install) 10s
1 parent 50a53a8 commit 87a1241

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
key: ${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
2727
- name: make install
2828
if: steps.cache-venv.outputs.cache-hit != 'true'
29-
run: make install
29+
run: |
30+
curl -LsSf https://astral.sh/uv/install.sh | sh
31+
make install
3032
- name: make hooks
3133
run: make hooks

Makefile-common.mk

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MAKEFLAGS += --warn-undefined-variables
1+
MAKEFLAGS += --warn-undefined-variables --check-symlink-times
22
SHELL = /bin/bash -o pipefail
33
.DEFAULT_GOAL := help
44
.PHONY: help clean install format check pyright test dist hooks install-hooks
@@ -8,15 +8,17 @@ help:
88
@awk '/^##.*$$/,/^[~\/\.0-9a-zA-Z_-]+:/' $(MAKEFILE_LIST) | awk '!(NR%2){print $$0p}{p=$$0}' | awk 'BEGIN {FS = ":.*?##"}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | sort
99

1010
venv ?= .venv
11-
pip := $(venv)/bin/pip
11+
# this is a symlink so we set the --check-symlink-times makeflag above
12+
python := $(venv)/bin/python
13+
# use uv if present, else fall back to pip
14+
pip = $(shell command -v uv >/dev/null && echo "uv pip" || echo "$(venv)/bin/pip")
1215

13-
$(pip): $(if $(value CI),|,) .python-version
16+
$(python): $(if $(value CI),|,) .python-version
1417
# create venv using system python even when another venv is active
1518
PATH=$${PATH#$${VIRTUAL_ENV}/bin:} python3 -m venv --clear $(venv)
16-
$(venv)/bin/python --version
17-
$(pip) install --upgrade pip~=24.0
19+
$(python) --version
1820

19-
$(venv): $(if $(value CI),|,) pyproject.toml $(pip)
21+
$(venv): $(if $(value CI),|,) pyproject.toml $(python)
2022
$(pip) install -e '.[dev]'
2123
touch $(venv)
2224

toast.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ image: python:3.8-slim
22
command_prefix: set -euo pipefail
33
tasks:
44
install-packages:
5-
command:
5+
command: |
66
apt-get update && apt-get install -y curl git make
7+
curl -LsSf https://astral.sh/uv/install.sh | sh
78
install-node:
89
dependencies:
910
- install-packages
@@ -21,6 +22,8 @@ tasks:
2122
- .pre-commit-config.yaml
2223
- .python-version
2324
command: |
25+
# add uv to path
26+
export PATH="/root/.cargo/bin/:$PATH"
2427
# needed so the editable package (.pth) we install points at src
2528
mkdir src
2629
# needed to install hooks

0 commit comments

Comments
 (0)