Migrate legacy constants from JSON-as-data to spec + code generation
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, json, python
- Lĩnh vực
- build-system, tooling
Hướng nghiên cứu
Bắt đầu bằng cách đọc generate_from_specs.py và phần triển khai hiện tại của file_formats.py, vì file_formats là nền tảng cho các đợt migration khác. Xem lại các test hiện có và các module được generate hiện đại để hiểu các pattern spec và output được mong đợi. Công việc được xem là hoàn tất khi cả năm module đều sử dụng specs và các file Python/JavaScript được generate, đồng thời hoàn tất việc dọn dẹp các tài nguyên legacy cùng phần setup và documentation liên quan.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 7
- Fork
- 38
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của learningequality/le-utils
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
learningequality/le-utils#261 ·
-
Add a qti_v2 format presetĐang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 15/100
learningequality/le-utils#262 ·
-
Final cleanup after constants migrationCó thể làm lại được @rtibblesbot đã nhận 40 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
learningequality/le-utils#187 · 1 reaction · 1 người được giao ·
-
Migrate languages.py to spec + code generationCó thể làm lại được @rtibblesbot đã nhận 40 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
learningequality/le-utils#186 · 1 reaction · 1 người được giao ·
-
Migrate format_presets.py to spec + code generationCó thể đã có người làm @rtibblesbot đã nhận 40 ngày trước. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
learningequality/le-utils#185 · 1 bình luận · 1 reaction · 1 người được giao ·
Tất cả issue của learningequality/le-utils
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
jxxghp/MoviePilot#7699 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
test_real_pandoc_failure_is_one_path_free_line fails on macOS CI with current Homebrew pandocĐang mởbug TAG: unit tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
learningequality/ricecooker#898 ·
-
next
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
j3ko/agent-plugins#80 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug:unconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Heroic-Games-Launcher/HeroicGamesLauncher#6187 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
BCStudentSoftwareDevTeam/cas#491 ·
Maintainer thường phản hồi trong vòng 8 ngày