Skip to content

[DEPR]: Extraneous XBlock Mixins #714

Closed

Description

@kdmccormick

Proposal Date

2024-01-31

Target Ticket Acceptance Date

2024-02-09

Earliest Open edX Named Release Without This Functionality

Redwood - 2024-04

Rationale

The implementations of the XBlock and XBlockAside classes are chopped into about a dozen tiny mixins. This was done many years ago, probably for some mix of reasons including code organization and theoretical reusability. Now, in 2024 in the openedx GitHub org, there are uses of the XBlock, XBlockAside, and XBlockMixin classes, but we do not see uses of any of the other classes or mixins (other than one extraneous reference to HandlersMixin in edx-platform, which can be removed).

Unfortunately, these mixins make it harder/impossible to write robust type constraints for XBlock and XBlockAside. They also make it harder to find code in the XBlock package. See discussion.

Removal

In an upcoming XBlock 2.0.0 release...

  • Removed: class xblock.core.SharedBlockBase.
  • Removed: module xblock.mixins, including...
    • these classes, collapsed into xblock.core.Blocklike:
      • xblock.mixins.RuntimeServicesMixin
      • xblock.mixins.ScopedStorageMixin
      • xblock.mixins.IndexInfoMixin
      • xblock.mixins.XmlSerializationMixin
      • xblock.mixins.HandlersMixin
    • these classes, collapsed into xblock.core.XBlock:
      • xblock.mixins.ChildrenModelMetaclass
      • xblock.mixins.HierarchyMixin
      • xblock.mixins.ViewsMixin
  • New: class xblock.core.Blocklike, serving as a shared base for xblock.core.XBlockMixin, xblock.core.XBlock, and xblock.core.XBlockAsidse.
  • No functional changes to xblock.plugin.Plugin, xblock.core.XBlock and xblock.core.XBlockAside.
  • Backwards-compatible enhancements to xblock.core.XBlockMixin include the functionality of these former classes:
    • xblock.mixins.IndexInfoMixin
    • xblock.mixins.XmlSerializationMixin
    • xblock.mixins.HandlersMixin

The resulting class hierarchy will look like this:

# xblock/plugin.py:
class Plugin:
   ... # No changes.

# xblock/core.py:
class Blocklike:
   ... # Collapse in: RuntimeServicesMixin, ScopedStorageMixin, XmlSerializationMixin, HandlersMixin, IndexInfoMixin
class XBlockMixin(Blocklike):
   ... # No changes (but XmlSerializationMixin, HandlersMixin, and IndexInfoMixin have been added via Blocklike).
class XBlockAside(Blocklike, Plugin):
   ... # No changes.
class XBlock(Blocklike, Plugin):
   ... # Collapse in: HierarchyMixin, ViewMixin

Replacement

See "Removal"

Deprecation

No plan.

Migration

See "Removal"

Additional Info

No response

Task List

No response

Activity

  1. added
    deprProposal for deprecation & removal per OEP-21
    on Jan 31, 2024
  2. self-assigned this
    on Jan 31, 2024
  3. moved this from Proposed to Communicated in DEPR: Deprecation & Removalon Jan 31, 2024
  4. kdmccormick commented on Jan 31, 2024

    @kdmccormick
    MemberAuthor
  5. moved this from Communicated to Accepted in DEPR: Deprecation & Removalon Feb 12, 2024
  6. moved this from Accepted to Removing in DEPR: Deprecation & Removalon Feb 12, 2024
  7. kdmccormick commented on Feb 12, 2024

    @kdmccormick
    MemberAuthor

    This has been accepted. Removal is in progress:

  8. 7 remaining items

  9. kdmccormick commented on Mar 19, 2024

    @kdmccormick
    MemberAuthor

    The XBlock PR has landed, but we are still working to apply the new XBlock version to edx-platform:

  10. moved this from Proposed to Removing in DEPR: Deprecation & Removalon Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

deprProposal for deprecation & removal per OEP-21

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions