Lint against imports of openedx_catalog internals in openedx-core
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
Description
Add an import-linter contract to openedx-core that only lets other apps import openedx_catalog's public modules (api, models_api, data, tests), matching the rule openedx-platform already enforces. That way an import of openedx_catalog's internals fails CI in openedx-core instead of surfacing later, when openedx-platform installs a new openedx-core release.
Context
- openedx/openedx-core#853 fixed an import of
openedx_catalog.modelsin CBE code. openedx-platform's import linter caught it during openedx/openedx-platform#39199, the PR bumping openedx-core's version there; openedx-core's own linter had no rule against it. - @ormsbee asked for this contract in his review of #853 and agreed it should be a separate follow-up PR so the version bump wasn't held up.
- Only
openedx_catalogis in scope. Other apps, such asopenedx_tagging, have nomodels_api.pyyet, so adding them would need a separate design decision.
Acceptance Criteria
-
.importlinterhas a contract that treatsopenedx_catalogas an isolated app: code outsideopenedx_catalogmay import only itsapi,models_api,data, andtestsmodules. -
lint-importspasses onmainwith the new contract. Today the only import ofopenedx_catalogfrom another app isfrom openedx_catalog.models_api import CourseRunincriteria.py, which is allowed. - The PR description shows that the contract catches a real violation: temporarily changing that
criteria.pyline back tofrom openedx_catalog.models import CourseRunmakeslint-importsfail and name that line. -
openedx_taggingand the other apps are not added to the contract.
Technical Details
This is a suggested approach, not the source of truth. The User Story, Description, and Acceptance Criteria define what must be true when the work is done.
Approach
- Copy openedx-platform's
IsolatedAppsContract(openedx/testing/importlinter/isolated_apps_contract.py, about 60 lines) into openedx-core. It has to be a copy because openedx-core must never import from openedx-platform. Put it in the root-leveltest_utilspackage (for exampletest_utils/importlinter.py) rather than undersrc/, so the published package doesn't ship lint tooling. - Register it in
.importlinterwithcontract_types = isolated_apps: test_utils.importlinter.IsolatedAppsContractin the[importlinter]section, then add a contract withisolated_apps = openedx_catalogandallowed_modules = api, models_api, data, tests, matching openedx-platform's contract so the two repos enforce the same rule. - Add a short comment above the new contract explaining why it exists: openedx-platform enforces the same rule, so a violation here would otherwise only surface when openedx-platform installs a new openedx-core release.
lint-imports already runs in CI through tox -e quality, so no workflow change is needed.
Additional context
- openedx-platform's contract definition: the
isolated_appsblock in openedx-platform'spyproject.toml.
- 主要语言
- Python
- 星标
- 10
- 派生
- 33
- 平均合并
- 2 天 19 小时
- 30 天内合并 PR
- 24
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
openedx/openedx-core 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
openedx/openedx-core#831 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
openedx/openedx-core#827 ·
维护者通常 1 天内回复
-
[Follow-up BE] Hide archived tagging records in edx-platform's content_tagging app可能已有人在做 @tbain 于 1 天前认领。 未关闭
openedx/openedx-core#903 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 15/100
openedx/openedx-core#902 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 15/100
openedx/openedx-core#901 ·
维护者通常 1 天内回复
查看 openedx/openedx-core 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
google-agentic-commerce/AP2#388 ·
-
area:codegen backend:cuda backend:hip bug direction:input
难度 2/5 1-3 小时 新手友好度 78/100
CrossGL/crosstl#3061 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
rlaope/oh-my-hermes#2304 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
mochan-tk/agentic-dev-kit-for-codex#64 ·
维护者通常 1 天内回复
-
bug docs performance
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 3 天内回复