kmccormick
(Kyle McCormick)
January 31, 2024, 9:49pm
1
In version 2.0.0 of the XBlock package, I plan to remove several mixins from the package’s public Python API. This will allow us to simplify XBlock and add static types to it. Please let me know before Fri 2024-02-09 if you have any concerns.
opened 09:41PM - 31 Jan 24 UTC
depr
### 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](https://github.com/openedx/XBlock/blob/master/xblock/core.py#L126) are chopped into [about a dozen tiny mixins](https://github.com/openedx/XBlock/blob/master/xblock/mixins.py). 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](https://github.com/openedx/XBlock/issues/707#issuecomment-1919915301).
### 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`
### Replacement
See "Removal"
### Deprecation
No plan.
### Migration
See "Removal"
### Additional Info
_No response_
### Task List
_No response_