Migrate legacy constants from JSON-as-data to spec + code generation
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Refactoring
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- javascript, json, python
- Bereich
- build-system, tooling
Rechercherichtung
Beginne mit dem Lesen von generate_from_specs.py und der aktuellen Implementierung von file_formats.py, da file_formats die Grundlage für die anderen Migrationen bildet. Überprüfe die vorhandenen Tests und die modernen generierten Module, um die erwarteten Spec- und Ausgabemuster zu verstehen. Als abgeschlossen gilt die Arbeit, wenn alle fünf Module Specs und generierte Python/JavaScript-Dateien verwenden und die Bereinigung der Legacy-Ressourcen sowie der zugehörigen Setup- und Dokumentation abgeschlossen ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Overview
Five constant modules (file_formats, licenses, content_kinds, format_presets, languages) are hand-written Python that loads JSON from le_utils/resources/, and the two have to be kept in sync by hand. The JSON files were meant to make these constants available to JS too, but they were never published in the kolibri-constants npm package. They should move to spec/ files built by scripts/generate_from_specs.py, like the repo's other constants and schemas, which already reach JS that way. Studio could then delete deploy/generatejsconstantfiles.py, and Studio and Kolibri could import these constants from kolibri-constants. The Python API stays unchanged, except where an existing value is wrong.
Scope
- Migrate
file_formats,licenses,content_kinds,format_presetsandlanguagesto generated modules. - Remove
le_utils/resources/from the package; keeple_utils/resources/languagelookup.jsonin the repo as a symlink to its spec file, so external links still resolve. - Excluded: switching Studio and Kolibri to the npm package (follow-up in those repos).
Guidance
make buildregenerates the Python and JS fromspec/;make testruns the suite.- Generated JS follows the existing
kolibri-constantsmodules: a default export mapping constant names to values (js/Modalities.js), with extra data as named exports (SCHEMAinjs/CompletionCriteria.js). - Studio's generator shows which data Studio's frontend reads from these modules: https://github.com/learningequality/studio/blob/8ccaaa60efd1c07b220aefce5a307e4791345111/deploy/generatejsconstantfiles.py
Strategy
- Migrations land one at a time: #182 (generator support and file_formats), then #183, #184, #185, #186, #187.
- Constant names and
choiceslabels stay as they are. They can't be derived from ids (HTML5 = "zip",CC_BY = "CC BY",(MP4, "MP4 Video")). - Generated lists keep their current order:
RENDERABLE_PRESETS_ORDERderives bitmask positions that are already saved from the order ofPRESETLIST. - Each correction to a wrong value is listed in
CHANGELOG.md.
Testing Requirements
- #182 adds a test that pins the public Python API of the five modules as it is before migration.
- Every migration keeps that test passing; a correction updates the pinned value in the same PR.
Acceptance Criteria
-
file_formats,licenses,content_kinds,format_presetsandlanguagesare generated fromspec/, and nothing underle_utils/constants/readsle_utils/resources/. - Each of those modules is importable as
kolibri-constants/<Module>. - The pinned-API test passes, and
CHANGELOG.mdlists every value that changed. - The built
le-utilswheel contains noresources/JSON, andle_utils/resources/languagelookup.jsonremains in the repo as a symlink to its spec file.
AI usage
I chose the scope, the one-at-a-time order, the rule that only correctness fixes may break the API, and the JS conventions. Claude Code checked the earlier issue text against main and against Studio, Kolibri and ricecooker, then drafted the sections for my edits.
- Vorherrschende Sprache
- Python
- Sterne
- 7
- Forks
- 38
- Ø Merge
- 1 T. 3 Std.
- Gemergte PRs (30 T.)
- 7
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus learningequality/le-utils
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
learningequality/le-utils#261 ·
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 15/100
learningequality/le-utils#262 ·
-
Final cleanup after constants migrationEvtl. wieder frei @rtibblesbot hat das vor 40 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 20/100
learningequality/le-utils#187 · 1 Reaktion · 1 zugewiesene Person ·
-
Migrate languages.py to spec + code generationEvtl. wieder frei @rtibblesbot hat das vor 40 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 20/100
learningequality/le-utils#186 · 1 Reaktion · 1 zugewiesene Person ·
-
Migrate format_presets.py to spec + code generationEvtl. vergeben @rtibblesbot hat das vor 40 Tagen übernommen. Offen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
learningequality/le-utils#185 · 1 Kommentar · 1 Reaktion · 1 zugewiesene Person ·
Alle Issues in learningequality/le-utils
Ähnliche Issues
-
backend: claude chore dependencies
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
briandconnelly/amicus#606 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
semantica-agi/semantica#2320 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
vllm-project/vllm-omni#11465 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
jxxghp/MoviePilot#7699 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
vllm-project/vllm-ascend#24010 ·
Maintainer antworten meist innerhalb von 1 Tag