Skip to content

Proposal: New Directory Structure & Public Python APIs #37946

@kdmccormick

Description

@kdmccormick

Supporting principles

  • The LMS/CMS distinction is not great. Either most code ends up being "shared", or each app end up being split into 2-3 parts (discussions, discussions, discussions 🤯 ). A better model is layered apps, using importlinter to enforce that low-level apps don't depend on high-level ones. For example, Learning Core successfully uses importlinter to layer its libs and apps.
  • Plugin developers are going to import openedx-platform code whether we want them to or not. What's within our power is steering them towards allowlisted Python APIs that we think we can best support long-term. This can be established now, and the current+future openedx-platform directory structures can be just implementation details. For example, Learning Core organizes its stable APIs into openedx_learning.api, even though the internal directory structure is more complicated.

Proposal

  • Create a new top-level directory: ./openedx_platform/.
    • This is the directory that we publish to PyPI.
    • ./openedx_platform/api/-- All public APIs. Watched with CODEOWNERS. Breaking changes get DEPRs and a PyPI major version bump. Each module is built by importing stable functions from internal ../apps/ and re-exporting them. For example:
      • ./openedx_platform/api/content_libraries.py
      • ./openedx_platform/api/xblock.py
      • ./openedx_platform/api/rbac.py
      • Certain "public DB models" are allowlisted on a case-by-case basis, e.g.:
        • ./openedx_platform/api/content_libraries_models.py
        • ./openedx_platform/api/xblock_models.py
        • ./openedx_platform/api/rbac_models.py
    • ./openedx_platform/apps/ -- Future home for all djangoapp implementations, layered using importlinter.
    • ./openedx_platform/lib/ -- Future home for internal libraries (no models).
    • ./openedx_platform/settings/ -- Future home for settings.
  • Deprecate external imports to all other paths (lms, cms, openedx, common, and xmodule).
    • Long-term, actually move the code from these dirs into openedx_platform. But, no big rush to do this.

Open questions

  • We will still want to support running the platform in "LMS mode" and "CMS mode". What's the right way to support this? What benefits from the LMS/CMS split do we want to retain (e.g. different scaling needs for Studio vs LMS)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions