Skip to content

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

Merged
rtibbles merged 9 commits into
learningequality:developfrom
rtibbles:uv_or_not_uv_that_is_the_question
Jun 5, 2026
Merged

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

Conversation

@rtibbles

@rtibbles rtibbles commented Mar 26, 2026

Copy link
Copy Markdown
Member

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

github-actions Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

@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
@rtibbles
rtibbles force-pushed the uv_or_not_uv_that_is_the_question branch 3 times, most recently 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.

@rtibbles
rtibbles force-pushed the uv_or_not_uv_that_is_the_question branch from 74b5d73 to 3329dd6 Compare June 4, 2026 21:29
rtibbles added 2 commits June 4, 2026 20:34
kolibri-format/cli.js requires minimatch directly but never declared it,
relying on it being hoisted into a parent node_modules. Declare it
explicitly and bump the package version.
@rtibbles
rtibbles force-pushed the uv_or_not_uv_that_is_the_question branch from 3329dd6 to 7aec0cf Compare June 5, 2026 03:35

@akolson akolson left a comment

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.

Changes look correct to me! and build passes! Thanks @rtibbles

@akolson

akolson commented Jun 5, 2026

Copy link
Copy Markdown
Member

Qn: is there any reason why the "Python unit tests for EOL Python versions (3.8)" build step is still hanging?

@rtibbles

rtibbles commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

Answer to question:

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

@rtibbles
rtibbles merged commit 4aa2737 into learningequality:develop Jun 5, 2026
66 checks passed
@rtibbles
rtibbles deleted the uv_or_not_uv_that_is_the_question branch June 5, 2026 16:00
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