kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Migrate kolibri-installer-android into the Python monorepo

Open rtibbles opened this issue 4 months ago • 4 comments

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

Overview

Migrate kolibri-installer-android from its standalone repo into platforms/android/ as a uv workspace member. It builds an Android APK/AAB via Gradle + Chaquopy (which embeds Python 3.10 into the app), consuming Kolibri as a built wheel/tar — it does not build Kolibri from the workspace, so it takes no kolibri = { workspace = true } dependency.

Installer migration under #13720. Framed "deferred — active dev", pulled forward now because upcoming zeroconf/mDNS work needs coordinated Kolibri core API changes, which co-location makes tractable. Follows the platforms/ pattern established by the server (#14964) and Pi (#14967) migrations.

Complexity: High · Target branch: develop

Context

kolibri-installer-android wraps Kolibri as an Android app. Standalone repo contains:

  • Gradle project rooted at repo top level: settings.gradle, build.gradle, app/, gradlew, gradle/, .idea/ — single :app module, rootProject.name = "Kolibri".
  • Chaquopy (com.chaquo.python) embeds Python 3.10; app/build.gradle pip-installs Kolibri from an extracted tarball (../tar/extracted) plus requirements.txt (Chaquopy-resolved: cryptography, ifaddr).
  • pyproject.toml with host-only tooling (dependencies = []; extras: build = google-api-python-client==2.96.0 + google-auth==2.22.0 for Play Store publishing, test = pytest, dev = prek); its own uv.lock, .python-version (3.10).
  • Version: app/build.gradle reads Kolibri's VERSION for versionName; versionCode from the Play Store API (scripts/version.py) for official builds, timestamp-based for dev.
  • Maestro smoke-test flows (.maestro/), Makefile, scripts/.

The Change

  • Move the repo into platforms/android/, preserving git history via git filter-repo --to-subdirectory-filter + merge --allow-unrelated-histories.
  • Register it as a uv workspace member (shared lockfile), per #14663.
  • Bump the stale Play Store publishing pins (google-api-python-client, google-auth) to align with Kolibri's google-auth==2.38.0 so the shared lockfile resolves.
  • Keep the Chaquopy embedded runtime (requirements.txt: cryptography, ifaddr) out of the workspace — Chaquopy resolves it against prebuilt wheels.
  • Add a make target that stages the workspace-built Kolibri tar into platforms/android/tar/, replacing the manual make get-tar tar=<URL> download for local dev.
  • Repoint the Gradle buildPython from ../.venv to the shared workspace .venv.
  • Derive versionName from the Kolibri version, removing the hardcoded installer version.
  • Migrate build_apk.yml (the reusable APK builder) as platform-android-build_apk.yml.
  • Rewire pr_build_kolibri.yml's existing apk job to call the migrated reusable locally, dropping the learningequality/kolibri-installer-android/…@v0.2.0 cross-repo pin and the tar-from-URL download in favour of the workspace-built tar.
  • Migrate release_apk.yml (Play Store publish) as platform-android-release_apk.yml, workflow_dispatch only.
  • Drop build_and_test.yml — its APK build is superseded by pr_build_kolibri.yml's apk job.
  • Fold build_and_test.yml's Maestro smoke_test job into pr_build_kolibri.yml's smoke-test block, beside pi_smoke_test.
  • Drop pre-commit.yml and call-pull-request-target.yml, collapsing into the monorepo's existing pre-commit and pull-request-target workflows.
  • Document the Android Studio workflow: open platforms/android/ (not the repo root), which Android Studio maps to the monorepo VCS root above it.

Out of Scope

  • Migrating other installers — separate per-repo tasks under #13720.
  • Archiving the source repo.
  • Building Kolibri from workspace source into the app — a workspace-source fallback for rapid core-dev iteration is a follow-up.
  • Behavioural changes to the app or the Play Store publish path — like-for-like migration (dependency bumps allowed where migration requires).
  • Reworking the versionCode mechanism.
  • Making the APK build/smoke-test blocking — the WHL smoke-test fan-in remains the sole blocking gate.
  • Admin/infra setup (Play Store signing keys, service-account credentials) — tracked as admin tasks on #13720.

Acceptance Criteria

Code migration

  • [ ] Repo content at platforms/android/, Gradle project buildable from the subfolder.
  • [ ] Play Store publishing pins bumped to align with Kolibri's google-auth==2.38.0.
  • [ ] versionName derives from the Kolibri version, with the hardcoded installer version removed.
  • [ ] Passes monorepo pre-commit without per-file ignores.
  • [ ] History + git blame preserved via git filter-repo.

Workspace integration

  • [ ] uv workspace member; included by uv sync --group dev --all-packages.
  • [ ] Shared lockfile resolves with no google-* version conflict.
  • [ ] Chaquopy embedded runtime stays Chaquopy-resolved, out of the workspace lock.

Developer experience

  • [ ] platforms/android/ opens as a project in Android Studio with VCS mapped to the monorepo root.
  • [ ] A make target stages the workspace-built Kolibri tar into platforms/android/tar/.
  • [ ] A clean build produces an APK embedding the workspace Kolibri with no download.
  • [ ] Gradle buildPython resolves to the shared workspace .venv.

Build / validation CI

  • [ ] pr_build_kolibri.yml's apk job calls the migrated platform-android-build_apk.yml locally, using the workspace-built tar.
  • [ ] The Maestro smoke test runs in pr_build_kolibri.yml's smoke-test block on every Kolibri PR.
  • [ ] Duplicated PR scaffolding (pre-commit, pull-request-target) collapsed into existing monorepo workflows.

Publish / release pipeline

  • [ ] platform-android-release_apk.yml runs from the monorepo (workflow_dispatch), publishing to the Play Store as before.

Runtime

  • [ ] The APK built from platforms/android/ installs and runs Kolibri on-device as before.

References

  • Source repository: https://github.com/learningequality/kolibri-installer-android
  • Chaquopy (Gradle Python SDK): https://chaquo.com/chaquopy/doc/current/
  • uv workspaces: https://docs.astral.sh/uv/concepts/projects/workspaces/

AI usage

Used Claude Code to draft this issue from the migration-framework design; I drove scope and decisions. Claude read the source repo's workflows, build.gradle, and pyproject.toml to ground the CI/build details, checked the Google-libs pin against Kolibri's lockfile, and verified them against the monorepo's conventions.

rtibbles avatar Jul 12 '26 23:07 rtibbles

Which do you want?


@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

rtibblesbot avatar Jul 13 '26 01:07 rtibblesbot

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Jul 13 '26 03:07 rtibblesbot

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Jul 13 '26 06:07 rtibblesbot

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Jul 14 '26 05:07 rtibblesbot