Skip to content

Migrate from Poetry to uv#197

Merged
kevinschaper merged 3 commits into
masterfrom
migrate-to-uv
May 7, 2026
Merged

Migrate from Poetry to uv#197
kevinschaper merged 3 commits into
masterfrom
migrate-to-uv

Conversation

@kevinschaper

Copy link
Copy Markdown
Collaborator

Summary

Supersedes #196 (which tried to keep Poetry but pin to 1.8.5).

The QC workflow's Poetry installer (`snok/install-poetry` + Poetry 2.4.0) has been broken since 2026-02 with `Installing Poetry (2.4.0): An error occurred. Removing partial environment.` Bumping the action alone didn't help — the failure is in the Poetry installer's own bootstrap, not workflow config. Rather than pinning Poetry to a soon-to-be-unsupported 1.x for the long term, migrate kg-phenio to uv to match the rest of the org.

Changes

  • `pyproject.toml`: PEP 621 `[project]` table; dev deps moved to `[dependency-groups.dev]`; build backend `hatchling`. License normalized to `BSD-3-Clause` (SPDX).
  • `setuptools<80` added explicitly — `eutils` (transitive via `oaklib`) does `import pkg_resources`, which setuptools 80+ removed. Poetry used to bundle setuptools implicitly; uv doesn't, so we declare it.
  • `.github/workflows/qc.yml`: Poetry install + `poetry install`/`poetry run` → `astral-sh/setup-uv@v4` + `uv sync` + `uv run`. Matrix bumped to `['3.10', '3.11', '3.12']` (3.9 is end-of-life and was the original sticking point).
  • `Jenkinsfile`: `python3.10 -m venv venv && pip install .` → `uv sync`; `awscli/boto3/s3cmd` install via `uv pip install` into the same venv; every `. venv/bin/activate && X` rewritten to `uv run X`.
  • `poetry.lock` removed, replaced by `uv.lock`.

Local validation

  • `uv sync` clean.
  • `uv run pytest` — 25/25 pass.
  • `uv run python run.py --help` — CLI mounts.
  • `uv run python run.py download` — all 4 files fetched successfully.
  • First Jenkins run after merge — confirms the production-pipeline parts (transform / merge / publish) still work under uv.

The QC workflow's Poetry installer (snok/install-poetry@v1.3 + Poetry
2.4.0) has been broken since Feb 2026 with "Installing Poetry (2.4.0):
An error occurred. Removing partial environment." Bumping the action
alone didn't help — the failure is in the Poetry installer's own
bootstrap, not workflow config. Rather than pinning Poetry to 1.x for
forever, migrate to uv to match every other ingest in the org.

- pyproject.toml: PEP 621 [project] table; dev deps moved to
  [dependency-groups.dev]; build backend hatchling. License normalized
  to BSD-3-Clause (SPDX). Added explicit setuptools<80 because eutils
  (transitive via oaklib) imports pkg_resources, which setuptools 80+
  removed; Poetry used to bundle setuptools implicitly, uv doesn't.
- .github/workflows/qc.yml: replace Poetry install + poetry install/run
  with astral-sh/setup-uv@v4 + uv sync + uv run. Bump matrix to
  ['3.10','3.11','3.12'] (3.9 is end-of-life and Poetry 2.x's Python-3.9
  bootstrap was the original sticking point anyway).
- Jenkinsfile: replace `python3.10 -m venv venv && pip install .` with
  `uv sync`; `awscli/boto3/s3cmd` install via `uv pip install` into the
  same venv; every `. venv/bin/activate && X` becomes `uv run X`.
- Drop poetry.lock; replace with uv.lock.

Local validation: `uv sync` clean, `uv run pytest` 25/25 pass,
`uv run python run.py download` fetches all 4 files successfully.
The flake8<5.0.0 pin in tox.ini broke under Python 3.12 (importlib_metadata
EntryPoints API change). Rather than untangle the flake8 + 8 plugin set,
swap the whole linting toolchain for ruff — same checks (E/W/F/B/I) in
one tool, modern, fast, and what the rest of the org uses.

- pyproject.toml: add ruff to dev deps; [tool.ruff] config (line 100,
  E/W/F/B/I, ignore E203, target py310).
- tox.ini: drop the [testenv:flake8] env (and its 8-package deps) plus
  the [flake8] config; add a one-line [testenv:ruff] env that runs
  `ruff check`.
- .github/workflows/qc.yml: matrix back to ['3.10','3.11','3.12'];
  "Lint with flake8" → "Lint with ruff", direct `uv run ruff check`.
- Code fixes ruff surfaced (5 errors total): 4 import-sort
  auto-fixes in tests + transform modules; 1 real `B018` useless
  expression in test_transform_class.py:51 (a bare attribute reference
  with no effect — removed). Two B905 zip()-without-strict in
  utils/transform_utils.py: explicit `strict=False` to preserve current
  truncate-to-shortest behavior.
@kevinschaper
kevinschaper merged commit 9e5b113 into master May 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant