Skip to content

Migrate to uv, ruff, and prek#212

Merged
rtibbles merged 3 commits intolearningequality:mainfrom
rtibblesbot:issue-211-d81051
Apr 4, 2026
Merged

Migrate to uv, ruff, and prek#212
rtibbles merged 3 commits intolearningequality:mainfrom
rtibblesbot:issue-211-d81051

Conversation

@rtibblesbot
Copy link
Copy Markdown
Contributor

@rtibblesbot rtibblesbot commented Mar 31, 2026

Summary

Migrates le-utils from pip/tox/setup.py to uv, replaces flake8/black with ruff, and replaces pre-commit with prek — matching the approach taken in learningequality/kolibri#14457.

  • setup.py/setup.cfg/tox.ini/MANIFEST.in/requirements-*.txt replaced by pyproject.toml with PEP 735 dependency groups
  • Versioning via setuptools-scm (from git tags)
  • CI workflows use astral-sh/setup-uv@v7 with caching
  • Pre-commit hooks use ruff, yamlfmt, actionlint, and uv-lock via prek
  • Release workflow produces both sdist and wheel
  • exclude-newer configured for supply chain safety

References

Closes #211
Reference: learningequality/kolibri#14457

Reviewer guidance

  • EOL Python (3.6-3.8) CI jobs still use pip in Docker containers since uv doesn't support Python <3.8
  • fetch-depth: 0 is required on checkout steps that trigger setuptools-scm (test and publish workflows, but NOT EOL Python jobs which use PYTHONPATH instead)
  • Risky areas: .github/workflows/pypi-publish.yml and .github/workflows/npm-publish.yml — verify these release workflows have correct permissions and build steps
  • To test locally: uv sync --group dev && uv run pytest -s

AI usage

This PR was implemented by Claude Code following a detailed plan based on the Kolibri uv migration (learningequality/kolibri#14457). All tests were verified passing, ruff formatting was applied, and build artifacts were validated (sdist + wheel with correct setuptools-scm versioning).


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks

@rtibblesbot rtibblesbot marked this pull request as ready for review April 1, 2026 02:04
Copy link
Copy Markdown
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one thing that I can see needs changing so far. One question.

Also, would be good to cleanup the commits into a more logical grouping. Maybe a single commit for the code reformatting that we can add to a git blame ignore revs file.

pyproject.toml Outdated
# Bump periodically — prevents installing packages published less than 7 days ago.
# uv requires an ISO 8601 date, not a relative duration.
# To update: set to today's date minus 7 days in YYYY-MM-DD format.
exclude-newer = "2026-03-24T00:00:00Z"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we could just set

exclude-newer = "7 days"

It is not restricted to absolute timestamps, because that would be very silly: https://docs.astral.sh/uv/reference/settings/#exclude-newer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to exclude-newer = "7 days". Much better than manually bumping a date.

rtibblesbot and others added 2 commits April 3, 2026 21:44
Replace pip/tox/setup.py with uv and pyproject.toml using setuptools-scm
for versioning. Replace flake8/black/reorder-python-imports with ruff.
Replace pre-commit with prek. Update all CI/CD workflows to use
astral-sh/setup-uv@v7 and j178/prek-action@v2. Add yamlfmt, actionlint,
and uv-lock pre-commit hooks. Release workflow now produces both sdist
and wheel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Automated formatting pass — no functional changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rtibblesbot
Copy link
Copy Markdown
Contributor Author

Cleaned up the commit history into two commits:

  1. feat: migrate to uv, pyproject.toml, ruff, and prek — all functional changes
  2. style: apply ruff and yamlfmt formatting to codebase — formatting-only, suitable for .git-blame-ignore-revs

Also switched exclude-newer to "7 days" relative duration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rtibblesbot
Copy link
Copy Markdown
Contributor Author

Added .git-blame-ignore-revs with the formatting commit (fdf3066). GitHub will automatically use this file to skip that commit in blame views.

Copy link
Copy Markdown
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as tests pass, this is good to go.

@rtibbles rtibbles merged commit ee48988 into learningequality:main Apr 4, 2026
14 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.

Migrate Python tooling to uv and ruff

2 participants