Skip to content

Migrate to uv, setuptools-scm, prek, and ruff#14457

Open
rtibbles wants to merge 9 commits into
learningequality:developfrom
rtibbles:uv_or_not_uv_that_is_the_question
Open

Migrate to uv, setuptools-scm, prek, and ruff#14457
rtibbles wants to merge 9 commits into
learningequality:developfrom
rtibbles:uv_or_not_uv_that_is_the_question

Conversation

@rtibbles
Copy link
Copy Markdown
Member

@rtibbles rtibbles commented Mar 26, 2026

Summary

Migrate Kolibri's Python tooling from pip/tox/setup.py to uv, and replace flake8+black with ruff.

  • Dev environments use uv sync --group dev for venv creation, Python version management, and dependency installation
  • Versioning handled by setuptools-scm (replaces custom kolibri/utils/version.py generation logic)
  • Version tests rewritten to use setuptools-scm's versioning code directly, ensuring consistency with our versioning scheme (except for dev versioning, which differs)
  • CI test workflows use uv for Python 3.8+; EOL Python (3.6, 3.7) remains on Docker containers with pip
  • Build pipeline uses uv pip install --python-version 3.6 for staticdeps — no Python 3.6 runtime needed
  • PEX build uses uvx for isolated pex execution — no separate venv or requirements file needed
  • Pre-commit replaced with prek; flake8, black, reorder-python-imports replaced with ruff
  • Removed docker/build_whl.dockerfile and requirements/build.txt — uv handles the isolation that previously required Docker

References

Reviewer guidance

Verified locally:

  • make dist produces wheel and tarball
  • make pex builds PEX using uvx (isolated from dev venv)
  • PEX runs correctly in a Python 3.6 container
  • Full test suite passes on Python 3.8+ via uv
  • Full test suite passes on Python 3.6/3.7 via PYTHONPATH + pip in Docker containers
  • Version utility tests (74) pass on 3.8+ via setuptools-scm

For review:

  • The ruff reformatting commit touches 367 files — review the config commits individually, not the reformat
  • CI is the main verification — check that all workflow jobs pass across the Python version matrix
  • The Python unit tests for EOL Python versions (3.8) required check has moved to the modern job — branch protection will need updating

AI usage

This PR was authored collaboratively with Claude Code. Claude implemented the migration based on a brainstormed design, with each decision reviewed and approved interactively.

@github-actions github-actions Bot added DEV: dev-ops Continuous integration & deployment DEV: backend Python, databases, networking, filesystem... APP: Device Re: Device App (content import/export, facility-syncing, user permissions, etc.) APP: Facility Re: Facility App (user/class management, facility settings, csv import/export, etc.) APP: Learn Re: Learn App (content, quizzes, lessons, etc.) APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) APP: User Re: User app (sign-in, sign-up, user profile, etc.) APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) SIZE: very large labels Mar 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 26, 2026

@rtibbles rtibbles force-pushed the uv_or_not_uv_that_is_the_question branch from c290799 to f66bbd4 Compare March 26, 2026 23:17
@rtibbles rtibbles force-pushed the uv_or_not_uv_that_is_the_question branch 18 times, most recently from 895c776 to c05f5d3 Compare March 29, 2026 04:48
Copy link
Copy Markdown
Member

@akolson akolson left a comment

Choose a reason for hiding this comment

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

No concerns here! However, looks like we need to rebase and get it merged to to avoid conflicts build up

@rtibbles rtibbles force-pushed the uv_or_not_uv_that_is_the_question branch 2 times, most recently from d1adf97 to 5d17e6f Compare May 27, 2026 20:27
@rtibbles rtibbles force-pushed the uv_or_not_uv_that_is_the_question branch from 5d17e6f to e52d676 Compare May 27, 2026 23:37
@rtibbles rtibbles marked this pull request as ready for review May 27, 2026 23:47
@rtibbles
Copy link
Copy Markdown
Member Author

Note that the required Python 3.8 build will never complete as its name has changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) APP: Device Re: Device App (content import/export, facility-syncing, user permissions, etc.) APP: Facility Re: Facility App (user/class management, facility settings, csv import/export, etc.) APP: Learn Re: Learn App (content, quizzes, lessons, etc.) APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) APP: User Re: User app (sign-in, sign-up, user profile, etc.) DEV: backend Python, databases, networking, filesystem... DEV: dev-ops Continuous integration & deployment DEV: frontend SIZE: very large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants