Skip to content

Commit

Permalink
ci: add uv (#465)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
tekumara authored Aug 17, 2024
1 parent 50a53a8 commit 87a1241
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
key: ${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: make install
if: steps.cache-venv.outputs.cache-hit != 'true'
run: make install
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
make install
- name: make hooks
run: make hooks
14 changes: 8 additions & 6 deletions Makefile-common.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --warn-undefined-variables --check-symlink-times
SHELL = /bin/bash -o pipefail
.DEFAULT_GOAL := help
.PHONY: help clean install format check pyright test dist hooks install-hooks
Expand All @@ -8,15 +8,17 @@ help:
@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

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

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

$(venv): $(if $(value CI),|,) pyproject.toml $(pip)
$(venv): $(if $(value CI),|,) pyproject.toml $(python)
$(pip) install -e '.[dev]'
touch $(venv)

Expand Down
5 changes: 4 additions & 1 deletion toast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ image: python:3.8-slim
command_prefix: set -euo pipefail
tasks:
install-packages:
command:
command: |
apt-get update && apt-get install -y curl git make
curl -LsSf https://astral.sh/uv/install.sh | sh
install-node:
dependencies:
- install-packages
Expand All @@ -21,6 +22,8 @@ tasks:
- .pre-commit-config.yaml
- .python-version
command: |
# add uv to path
export PATH="/root/.cargo/bin/:$PATH"
# needed so the editable package (.pth) we install points at src
mkdir src
# needed to install hooks
Expand Down

0 comments on commit 87a1241

Please sign in to comment.