kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Build member frontend assets when publishing python_packages wheels

Open rtibbles opened this issue 5 months ago • 2 comments

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

Overview

The PyPI publish pipeline builds member wheels with a bare uv build, which silently ships frontend-bearing members — e.g. kolibri-sentry-plugin — without their compiled JS bundle. Give every python_packages/ member a Makefile with a dist target that owns its full build (frontend build + compress where needed, then the wheel), and have the publish pipeline call make dist per member instead of assuming uv build suffices.

Complexity: Medium Target branch: develop

Context

  • Publishing runs .github/workflows/pypi_packages_publish.yml → scripts/pypi_publish.sh, which only does uv build --package <name> then uv publish.
  • Members with a frontend output their webpack bundle to a gitignored static/ and ship it via setuptools include-package-data. Nothing builds that static/ in CI, so a fresh checkout packages an empty static/.
  • kolibri-build prod --plugins <module> builds a member's bundle; kolibri-build compress <glob> gzips static and writes .gz/.file_size sidecars.
  • The root compress script is scoped to kolibri/ only, so it never touches python_packages/ members.
  • kolibri-sentry-plugin has a build script but no compress; other members may lack build scripts entirely.

The Change

  • Every python_packages/ member has a Makefile with a dist target that produces its wheel, first running whatever that package needs: a frontend-bearing member builds its bundle (kolibri-build prod) and compresses its static; a backend-only member's dist just builds the wheel.
  • scripts/pypi_publish.sh builds each to-be-published member via its make dist and publishes the resulting wheel — it makes no assumptions about uv build or frontend layout.
  • Members whose dist builds a frontend require the JS toolchain in the build environment (workspace pnpm install has run).

Out of Scope

  • Extracting context_translation/demo_server (separate issues that depend on this).

Acceptance Criteria

General

  • [ ] Every python_packages/ member has a Makefile with a dist target that builds its wheel.
  • [ ] A frontend-bearing member's dist builds its bundle and compresses its static before building the wheel; a backend-only member's dist just builds the wheel.
  • [ ] scripts/pypi_publish.sh builds each published member via make dist and publishes the resulting wheel, making no uv build or frontend-layout assumptions.
  • [ ] A dist-built kolibri-sentry-plugin wheel contains the compiled, compressed JS bundle.

Testing

  • [ ] Running make dist for a frontend-bearing member in a clean checkout (after workspace pnpm install) produces a wheel whose contents include the compiled bundle and its .gz.

References

  • Publish pipeline: .github/workflows/pypi_packages_publish.yml, scripts/pypi_publish.sh
  • Pattern to mirror: the main Kolibri dist target in Makefile (assets built before uv build)
  • Build tooling: packages/kolibri-build (prod, compress)

AI usage

Drafted with Claude Code, which read the publish workflow and build tooling; I drove every scope decision. I verified the missing-bundle gap and the assets-first pattern against the repo and uv's build-backend docs before creating the issue.

rtibbles avatar Jul 05 '26 04:07 rtibbles

Plan: Give every python_packages/ member a Makefile with a dist target that owns its full build (frontend build + compress where needed, then the wheel), and make scripts/pypi_publish.sh call make dist per member instead of assuming a bare uv build suffices — so kolibri-sentry-plugin's compiled JS bundle actually ships.

  • [ ] dist Makefile for the four backend-only members
  • [ ] dist Makefile for kolibri-sentry-plugin (the frontend-bearing member)
  • [ ] scripts/pypi_publish.sh — build via make dist per member
  • [ ] CI — provide the JS toolchain for the frontend-bearing member's build
  • [ ] Document the Makefile requirement for future publishable packages

@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 05 '26 05:07 rtibblesbot

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

rtibblesbot avatar Jul 05 '26 07:07 rtibblesbot