Clean up duplication left by the platform migration
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Co-locating the installer repos into platforms/ made some standalone-era duplication removable. Consolidate the genuinely-shared bits and drop stale pre-migration scaffolding.
Complexity: Low Target branch: develop
Context
- The Kolibri-version read is reimplemented four ways (debian-server, desktop-app, android, raspberry-pi).
build_tools/read_whl_version.pyalready provides that read but sits unused.- android builds Kolibri from the workspace via
stage-workspace-tar. - desktop-app has no equivalent target; its
get-whlfetches a whl from a URL for local dev. platforms/android/README.mdstill documents pre-migration setup that contradicts its own monorepo section.
Acceptance Criteria
- [ ] The "read the workspace Kolibri version" step goes through one shared helper across platforms; per-platform version conversions stay separate.
- [ ] desktop-app has a
stage-workspace-whlMakefile target mirroring android'sstage-workspace-tar. - [ ] The stale clone/venv/
get-tarinstructions inplatforms/android/README.mdare removed or reconciled with the monorepo workflow.
AI usage
Claude Code located the duplications across platforms/; I triaged which are the same knowledge vs coincidental and edited the issue.
Scoping this before implementation. AC2 and AC3 are clear and I'll implement them as written:
- AC2 — add
stage-workspace-whltoplatforms/desktop-app/Makefile, mirroring android'sstage-workspace-tar: run$(MAKE) -C ../.. dist, glob the freshest../../dist/kolibri-*.whl, stage it intowhl/, and hand it to the existinginstall-whl. (uv buildemits both the whl and the sdist tar, so the whl is always there.) - AC3 — reconcile
platforms/android/README.md: drop the standalone "Initial Setup" clone/uv venv/get-tarsteps (lines ~60–98) and theget-tarline in Quick Start, deferring to the existing "Monorepo & Android Studio" section (uv sync --all-packages,stage-workspace-tar).
AC1 needs a decision before I touch it. The helper build_tools/read_whl_version.py reads a whl (pkginfo.Wheel), but only desktop-app has a whl at its version-read point. The four reads are genuinely different artifacts/stages:
| Platform | Reads version from | Artifact | Where |
|---|---|---|---|
| desktop-app | pkginfo.Installed('kolibri') (Makefile:20) |
whl → kolibrisrc/ |
Makefile |
| android | kolibri/VERSION text (app/build.gradle:105-110) |
extracted tar | Gradle (Groovy) |
| debian-server | strip kolibri-…tar.gz filename (platform-debian-server-build_deb.yml:41-42) |
tar | CI workflow |
| raspberry-pi | regex on kolibri_*.deb filename (Makefile:62) |
.deb | Makefile |
So "one shared helper" is not a drop-in. Two questions:
Q1 — how should the helper cover non-whl reads? android and debian-server read a tar; the helper reads a whl. Either:
- (a) generalize
read_whl_version.pyto read any workspace dist artifact (whl and sdist tar viapkginfo), or - (b) keep it whl-only and have each platform read the version from the sibling
dist/kolibri-*.whlthatuv buildalways emits, even when it ultimately packages the tar/deb.
I lean (b) — it keeps the helper unchanged ("already provides that read") and gives one source of truth, at the cost of reading a whl you don't package.
Q2 — are android and raspberry-pi in scope?
- android's read is in Gradle (Groovy), from the tar's
VERSIONfile. Route it through the Python helper (shelling out, as it already does forversionCode), or leave the Gradle read as-is? - raspberry-pi reads a
.debfilename to name its.img— it never handles a workspace whl/tar. Is this in scope, or does it count as a "per-platform version conversion" that stays separate (matching the AC carve-out)?
My default if unanswered: (b) for Q1; route debian-server (CI) and desktop-app through the helper; leave android's Gradle read and raspberry-pi's .deb read alone. Happy to widen scope if that's the intent.
The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.
For 1, I would say a) - we should make it a single Python package that is able to read the version from an arbitrary entity. However, what we can do is standardize it to read from the _version.py file emitted by the setuptools-scm build. Noting that the current Android behaviour to read VERSION is either broken or deprecated!
For 2, they should both be in scope - however I also think that the actual answer for 1 should be based on what works best for each of the platforms. If reading the whl file version is not actually the best path forward, and each one should have its own logic, that's fine - but we should be deferring to the correct artifact as the source of truth. VERSION file is no longer used or created, so it has to read from _version.py at a minimum. The exact mechanism for doing that is whatever is appropriate for the platform - but if it can be unified across platforms, then we should do so.
Thanks — that resolves it. Confirming the resolved scope before implementation.
One factual correction: kolibri/VERSION isn't gone yet — the root Makefile writeversion target (a dist prerequisite) still generates it as a plaintext copy of _version.py, it ships in the sdist (MANIFEST.in:6), and android is its sole remaining reader (app/build.gradle:95,105). So it's deprecated-in-intent but live-in-fact. _version.py (setuptools-scm, pyproject.toml:168) is the real source of truth — kolibri.__version__ reads only it. This makes the VERSION retirement a concrete deletion step, not a no-op.
AC1 — shared helper, standardized on _version.py:
- Generalize
build_tools/read_whl_version.pyinto one helper that reads the version fromkolibri/_version.py, accepting an extracted tree, a wheel, or an sdist. Update the existingMakefile:227pex consumer to the new interface. - android: read
tar/extracted/kolibri/_version.pyvia the helper (shelling out to Python, as it already does forversionCode), replacing theVERSION-file read. The sdist android extracts contains_version.py, so this is a clean swap. - desktop-app: read
_version.pyfrom the staged whl via the helper, replacingpkginfo.Installed('kolibri'). - debian-server: read via the helper (workspace/artifact) instead of the CI tar-filename strip; PEP 440 → Debian conversion in
generate_changelog.pystays separate. - raspberry-pi: keep its
.deb-filename parse. Its correct artifact is the.debit packages (the Debian-converted version — a per-platform conversion that "stays separate" per the AC); no_version.pyexists at Pi-image build. Considered, deliberately not forced through the helper — matching your "defer to the correct artifact" steer. - VERSION retirement: once android is off it,
kolibri/VERSIONhas no readers → removewriteversion(target +distdep +rm -fclean line) andinclude kolibri/VERSIONfromMANIFEST.in. Aligns the tree with "VERSION is deprecated." If you'd rather keepVERSIONfor now, android's switch stands alone and this is the only separable sub-step — shout if you want it left in.
AC2 — stage-workspace-whl: mirrors stage-workspace-tar ($(MAKE) -C ../.. dist → glob freshest ../../dist/kolibri-*.whl → stage into whl/ → install-whl).
AC3 — android README: drop the standalone "Initial Setup" (clone/uv venv/get-tar) and the get-tar Quick Start step, deferring to the "Monorepo & Android Studio" section; keep the SDK/JDK/emulator setup.
Proceeding on this basis.
Correction to my last comment: kolibri/VERSION cannot be retired. I said android was its sole remaining reader. That was true only of this repo — I hadn't checked the external installers, which consume the sdist we publish:
| Reader | Called from | Effect of deleting kolibri/VERSION |
|---|---|---|
[email protected] Makefile:18-21 (tar -zxvf … kolibri/VERSION) |
pr_build_kolibri.yml:24-30 (deb) + release path |
Every PR red — deb fails, taking zip, pi_smoke_test, server_smoke_test with it |
[email protected] app/build.gradle:93,103 |
release_kolibri.yml:122 (apk) |
Release APK breaks — silent until a release is cut |
The Kolibri .deb still comes from the external Debian installer (platforms/debian-server packages kolibri-server, a different package), and the release APK still comes from the external android repo even though platforms/android/ builds the PR one. So retirement is blocked on those two consumers, not on anything in this issue — the release-path half is #15072.
Revised plan: writeversion, MANIFEST.in:6 and the .gitignore entry all stay, with a comment at the generator naming the two external readers so this dead end isn't re-walked. AC1/AC2/AC3 are unaffected — android still moves to _version.py, it just isn't the last reader of the file.
One consequence worth knowing: no released sdist ships kolibri/_version.py (v0.19.5 built from setup.py with version=kolibri.__version__; the setuptools-scm version_file commit is in no release tag). After the android switch, make get-tar tar=<release URL> + ./gradlew fails rather than building. CI is unaffected (it always builds from the same commit) and AC3 removes the README's get-tar recommendation, so the fix is a directive error message pointing at make stage-workspace-tar.
Plan: Route every platform's "read the workspace Kolibri version" step through one shared helper standardized on kolibri/_version.py, add desktop-app's missing stage-workspace-whl target, and strip pre-migration setup from the android README.
- [x] Generalized version-read helper
- [x] android reads
_version.pyinstead ofVERSION - [x] Pin why
kolibri/VERSIONsurvives - [x] desktop-app version read via the helper
- [x] desktop-app
stage-workspace-whl(AC2) - [x] debian-server CI reads the version via the helper
- [x] android README reconciliation (AC3)
All seven landed in #15106.
Acceptance criteria — ticked here rather than in the issue body, because this account lacks UpdateIssue permission on the body:
- [x] AC1 — one shared helper for the version read; per-platform conversions stay separate.
build_tools/read_kolibri_version.pyis the single reader ofkolibri/_version.py; android (app/build.gradle:121), desktop-app (Makefile:23), debian-server CI (platform-debian-server-build_deb.yml:33) and the rootpextarget (Makefile:232) all call it. PEP 440 → Debian (generate_changelog.py) and AndroidversionCodeare untouched. raspberry-pi is deliberately excluded — it parses the.debfilename it packages, which is the correct artifact at that stage (no_version.pyexists at Pi-image build), matching your "defer to the correct artifact" steer and the AC's own carve-out for per-platform conversions. - [x] AC2 —
platforms/desktop-app/Makefile:86stage-workspace-whl, mirroring android'sstage-workspace-tar. - [x] AC3 —
platforms/android/README.md: the standalone clone/uv venv/get-tarInitial Setup is gone and Quick Start prescribes the monorepo commands.grep -n "get-tar\|kolibri-installer-android\|uv venv\|--extra build\|0\.17\.0" platforms/android/README.mdreturns nothing.
Not delivered as scoped: the kolibri/VERSION retirement I proposed on 2026-07-29 and then withdrew. Two external installer repos read that file out of the sdist we publish ([email protected], [email protected]), both called from this repo's workflows, so deleting it reddens the PR deb job. Makefile:204 now carries a comment naming them; the PR body has the evidence.
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
- Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
- Ran the project's full test suite and linter before committing
- For UI changes: captured live screenshots to verify rendering
- For backend changes: verified with example API/CLI output
The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.
The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.