kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Extract the demo_server plugin into python_packages

Open rtibbles opened this issue 5 months ago • 1 comments

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

Overview

Extract the demo server plugin from kolibri/plugins/demo_server into its own package under python_packages/. It is an internal, demo-deployment-only plugin that need not ship in the Kolibri package. The extraction is bootstrapped with kolibri plugin create, then the existing code — the banner component and its user_auth page injection — is moved across.

Complexity: Medium Target branch: develop

Context

  • The in-tree plugin DemoServer registers DemoServerAsset(WebpackBundleHook) for its bundle.
  • DemoServerInclusionHook(UserAuthSyncHook) injects that bundle into user_auth sign-in pages.
  • The bundle pushes DemoServerBannerContent.vue onto window._coreBannerContent.
  • Files: kolibri_plugin.py, buildConfig.js, package.json (already kolibri-demo-server-plugin, workspace deps), frontend/module.js, frontend/DemoServerBannerContent.vue (8 translatable $trs).
  • Closest kolibri plugin create surface is global-injector (WebpackBundleHook + FrontEndBaseSyncHook).
  • Depends on kolibri.plugins.user_auth.hooks, a core in-tree plugin that stays importable from the package.

The Change

  • Scaffold python_packages/kolibri-demo-server-plugin/ with kolibri plugin create (global-injector surface), then move the plugin's code across.
  • Swap the generated inclusion hook for user_auth's UserAuthSyncHook.
  • Move DemoServerBannerContent.vue, module.js, and buildConfig.js across.
  • Carry package.json across, adding its build/clean/dev scripts and kolibri-build toolchain deps.
  • Add a Makefile dist target so the member builds and compresses its own bundle.
  • Gitignore the built static/; drop any committed build artifacts.
  • Declare the kolibri.plugins entry point in the package's pyproject.toml.
  • Remove kolibri/plugins/demo_server/ and its entry in the root pyproject.toml.

Acceptance Criteria

General

  • [ ] python_packages/kolibri-demo-server-plugin/ exists as a uv workspace member with its own pyproject.toml declaring the kolibri.plugins entry point.
  • [ ] The plugin injects DemoServerBannerContent into user_auth sign-in pages via UserAuthSyncHook, identical to the in-tree behaviour.
  • [ ] The package has a build script and a Makefile dist target that build the bundle and compress its static; built static/ is gitignored, not committed.
  • [ ] The banner's 8 translatable strings are extracted into the package's own locale via the per-package i18n recipes.
  • [ ] kolibri/plugins/demo_server/ and its root pyproject.toml entry-point line are removed.

Testing

  • [ ] Building the package's wheel and enabling it in a Kolibri install renders the demo banner on user_auth sign-in pages.

References

  • In-tree plugin being extracted: kolibri/plugins/demo_server
  • Frontend-member exemplar (build scripts + packaging): python_packages/kolibri-sentry-plugin
  • Injection hook: UserAuthSyncHook in kolibri/plugins/user_auth/hooks.py

AI usage

Drafted with Claude Code, which read the in-tree plugin, its user_auth hook dependency, and the build/publish tooling; I drove every scope decision. I verified the surface mapping, the translatable strings, and the frontend-build gap against the repo before creating the issue.

rtibbles avatar Jul 05 '26 04:07 rtibbles

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