Skip to content

Switch to top-level Python packages #237

Open

Description

@kdmccormick

Instead of:

  • xblock_pdf/
  • xblocks_contrib/
    • html/
    • problem/
    • etc.

We should move to:

  • src/
    • xblock_pdf/
    • xblock_html/
    • xblock_problem/
    • etc.

And the import roots will change:

  • Before: from xblock_contrib.problem import ProblemBlock
  • After: from xblock_problem import ProblemBlock

Why?

  • It matches the structure of xblocks-extra
  • It allows us to move xblocks into and out of xblocks-extra, xblocks-core, and other repositories without changing their import paths. It decouples their public API from our specific way of structuring the blocks, allowing us to keep the API stable as maintenance needs change and architectural decisions are made.

Activity

  1. self-assigned this
    on May 4, 2026
  2. kdmccormick commented on May 4, 2026

    @kdmccormick
    MemberAuthor

    WIP: #244

  3. farhan commented on May 5, 2026

    @farhan
    Contributor

    @kdmccormick Thanks for creating the story,

    Should we also rename the xblock module names for xblocks-extra as well

    Question is important as I am working on the translations work for these repositories and with this implementation it will create the relevant module names inside openedx-translations/translations

    translation path will be on the following pattern

    openedx-translations/translations/xblocks-contrib/MODULE_NAME/conf/locale/en/LC_MESSAGES/django.po
    For e.g.
    openedx-translations/translations/xblocks-contrib/xblock_pdf/conf/locale/en/LC_MESSAGES/django.po

    Relevant PR:
    https://github.com/openedx/xblocks-extra/pull/35/changes#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52R63

  4. kdmccormick commented on May 5, 2026

    @kdmccormick
    MemberAuthor

    Should we also rename the xblock module names for xblocks-extra as well

    No, I think we should keep the import paths unchanged, since those are existing blocks which external sites have references to and we don't want to break them unnecessarily. On the other hand, we can safely change the core xblock paths this one time because (currently) control all of the references to them through openedx-platform.

    Question is important as I am working on the translations work for these repositories and with this implementation it will create the relevant module names inside openedx-translations/translations

    @farhan is it possible to drop xblocks-contrib from those translation resources name, so that we have:

    • openedx-translations/translations/xblock_problem/conf/locale/en/LC_MESSAGES/django.po
    • openedx-translations/translations/xblock_pdf/conf/locale/en/LC_MESSAGES/django.po
    • and so on

    ?

  5. farhan commented on May 6, 2026

    @farhan
    Contributor

    @kdmccormick

    No, I think we should keep the import paths unchanged, since those are existing blocks which external sites have references to and we don't want to break them unnecessarily. On the other hand, we can safely change the core xblock paths this one time because (currently) control all of the references to them through openedx-platform.

    Alright, make sense

    @farhan is it possible to drop xblocks-contrib from those translation resources name, so that we have:

    openedx-translations/translations/xblock_problem/conf/locale/en/LC_MESSAGES/django.po
    openedx-translations/translations/xblock_pdf/conf/locale/en/LC_MESSAGES/django.po
    and so on
    ?

    I think it's not possible as per openedx-platform current implementation, repository-name directory is required to match the lookup

    References:

    https://github.com/openedx/openedx-platform/blob/farhan/remove-legacy-video-editor/common/djangoapps/xblock_django/translation.py#L129

    https://github.com/openedx/openedx-platform/blob/2fd58576af9f3e51868c1c242d5fa7192d13fd82/openedx/core/djangoapps/plugins/i18n_api.py#L125

    https://github.com/openedx/openedx-atlas/blob/1eb61a69e8a0f9c0911fc5d334066d3a06b3d425/docs/decisions/0001-support-glob-pattern.rst#L70

    Image
    Image

    Here is in-review PR for xblocks-extra
    openedx/xblocks-extra#35

  6. 18 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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