Skip to content

Commit 6abce0b

Browse files
mattgodboltclaude
andauthored
Migrate from Poetry to uv (#51)
Poetry has been causing CI issues (pinned to 1.8.5 as a workaround). Mirrors the approach already used in the infra repo for consistency. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f013524 commit 6abce0b

File tree

7 files changed

+347
-588
lines changed

7 files changed

+347
-588
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ jobs:
88
ci:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/setup-python@v2
12-
with:
13-
python-version: '3.9'
1411
- uses: actions/checkout@v4
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v4
14+
with:
15+
enable-cache: true
1516
- name: pre-commit hooks
1617
run: env SKIP=test make pre-commit
1718
- name: tests

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.pyc
22
*.swp
33
/.env
4-
/.poetry
4+
/.uv
5+
/.venv
56
/.pytest_cache

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

Makefile

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
1-
export POETRY_HOME=$(CURDIR)/.poetry
2-
# https://github.com/python-poetry/poetry/issues/1917
3-
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
1+
UV_SYSTEM:=$(shell command -v uv 2>/dev/null)
2+
UV_BIN:=$(if $(UV_SYSTEM),$(UV_SYSTEM),$(CURDIR)/.uv/uv)
3+
UV_VENV:=$(CURDIR)/.venv
4+
UV_DEPS:=$(UV_VENV)/.deps
45

5-
POETRY:=$(POETRY_HOME)/bin/poetry
6-
POETRY_DEPS:=$(POETRY_HOME)/.deps
7-
SYS_PYTHON:=$(shell command -v python3 || command -v python || echo .no-python-found)
86
default: test
97

108
help: # with thanks to Ben Rady
119
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
1210

13-
$(SYS_PYTHON):
14-
@echo Could not find a system python
15-
exit 1
11+
$(CURDIR)/.uv/uv:
12+
@echo "Installing uv..."
13+
@mkdir -p $(dir $@)
14+
@curl -LsSf https://astral.sh/uv/install.sh | UV_NO_MODIFY_PATH=1 UV_INSTALL_DIR=$(CURDIR)/.uv sh -s
1615

1716
.PHONY: deps
18-
deps: $(POETRY) $(POETRY_DEPS)
19-
$(POETRY): $(SYS_PYTHON)
20-
curl -sSL https://install.python-poetry.org | $(SYS_PYTHON) - --version 1.8.5
21-
$(POETRY_DEPS): $(POETRY) pyproject.toml poetry.lock
22-
$(POETRY) install
17+
deps: $(UV_BIN) $(UV_DEPS)
18+
$(UV_DEPS): $(UV_BIN) pyproject.toml
19+
$(UV_BIN) sync --no-install-project
2320
@touch $@
2421

2522
.PHONY: pre-commit
2623
pre-commit: deps ## Runs all pre-commit hooks
27-
$(POETRY) run pre-commit run --all-files
24+
$(UV_BIN) run pre-commit run --all-files
2825

2926
.PHONY: install-pre-commit
3027
install-pre-commit: deps ## Install pre-commit hooks
31-
$(POETRY) run pre-commit install
28+
$(UV_BIN) run pre-commit install
3229

3330
.PHONY: test
3431
test: deps ## Runs tests
@@ -37,4 +34,4 @@ test: deps ## Runs tests
3734

3835
.PHONY: build-yamls
3936
build-yamls: deps ## Builds all the yaml build files
40-
$(POETRY) run python make_builds.py
37+
$(UV_BIN) run python make_builds.py

0 commit comments

Comments
 (0)