Skip to content

Migrate Python tooling to uv and ruff #211

@rtibbles

Description

@rtibbles

This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Migrate from pip/tox/setup.py to uv, and replace flake8/black with ruff, following the same approach as learningequality/kolibri#14457.

Complexity: Low
Target branch: main

Context

Kolibri has migrated to uv for Python version management, virtual environments, dependency resolution, and CI. The same migration should be applied across the ecosystem for consistency.

The Change

  • Convert setup.py/setup.cfg to pyproject.toml with PEP 735 dependency groups
  • Replace custom versioning with setuptools-scm
  • Replace tox with direct uv invocation in CI
  • Replace flake8/black/reorder-python-imports with ruff
  • Replace pre-commit with prek
  • Add yamlfmt and actionlint to pre-commit hooks
  • Update CI workflows to use astral-sh/setup-uv with enable-cache: true and cache-python: true
  • Update release workflow to produce a wheel file in addition to the source distribution
  • Configure exclude-newer = "7 days" in [tool.uv] for supply chain safety
  • Add uv-lock pre-commit hook (from astral-sh/uv-pre-commit) to keep uv.lock in sync
  • Update developer documentation

Acceptance Criteria

  • pyproject.toml replaces setup.py/setup.cfg as the single source of project metadata and configuration
  • Versioning handled by setuptools-scm
  • tox.ini removed; CI uses uv directly
  • Linting and formatting handled by ruff
  • Pre-commit hooks use prek with ruff, yamlfmt, and actionlint
  • CI workflows use astral-sh/setup-uv@v7
  • Release workflow produces both sdist and wheel, uploaded to PyPI
  • exclude-newer cooldown configured in pyproject.toml
  • uv-lock pre-commit hook added to .pre-commit-config.yaml
  • All existing tests pass
  • Developer documentation updated

References

AI usage

This issue was drafted by Claude Code based on the Kolibri uv migration work.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions