Skip to content

Commit

Permalink
feat!: collapse extraneous XBlock mixins (#718)
Browse files Browse the repository at this point in the history
Various extraneous classes have been removed from the XBlock API, simplifying its implementation
and making debugging of XBlock instances easier. We believe that most, if not all, XBlock API users
will be unaffected by this change. Some improvements have also been made to the reference documentation.

See CHANGELOG.rst for details.

Closes: #714
  • Loading branch information
kdmccormick authored Mar 19, 2024
1 parent 22f6958 commit f79bfc5
Show file tree
Hide file tree
Showing 14 changed files with 929 additions and 988 deletions.
55 changes: 53 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,62 @@
Change history for XBlock
=========================

These are notable changes in XBlock.

Unreleased
----------


3.0.0 - 2024-03-18
------------------

Various extraneous classes have been removed from the XBlock API, simplifying its implementation
and making debugging of XBlock instances easier. We believe that most, if not all, XBlock API users
will be unaffected by this change. Some improvements have also been made to the reference documentation.

Specific changes:

* **Removed:**

* ``xblock.XBlockMixin`` (still available as ``xblock.core.XBlockMixin``)
* ``xblock.core.SharedBlockBase`` (replaced with ``xblock.core.Blocklike``)
* ``xblock.internal.Nameable``
* ``xblock.internal.NamedAttributesMetaclass``
* ``xblock.django.request.HeadersDict``
* ``xblock.fields.XBlockMixin`` (still available as ``xblock.core.XBlockMixin``)
* ``xblock.mixins.RuntimeServicesMixin``
* ``xblock.mixins.ScopedStorageMixin``
* ``xblock.mixins.IndexInfoMixin``
* ``xblock.mixins.XmlSerializationMixin``
* ``xblock.mixins.HandlersMixin``
* ``xblock.mixins.ChildrenModelMetaclass``
* ``xblock.mixins.HierarchyMixin``
* ``xblock.mixins.ViewsMixin``

* **Added:**

* ``xblock.core.Blocklike``, the new common ancestor of ``XBlock`` and ``XBlockAside``, and ``XBlockMixin``,
replacing ``xblock.core.SharedBlockBase``.

* New attributes on ``xblock.core.XBlockAside``, each behaving the same as their ``XBlock`` counterpart:

* ``usage_key``
* ``context_key``
* ``index_dictionary``

* Various new attributes on ``xblock.core.XBlockMixin``, encompassing the functionality of these former classes:

* ``xblock.mixins.IndexInfoMixin``
* ``xblock.mixins.XmlSerializationMixin``
* ``xblock.mixins.HandlersMixin``

* **Docs**

* Various docstrings have been improved, some of which are published in the docs.
* XBlockAside will now be represented in the API docs, right below XBlock on the "XBlock API" page.
* XBlockMixin has been removed from the docs.
It was only ever documented under the "Fields API" page (which didn't make any sense),
and it was barely even documented there. We considered adding it back to the "XBlock API" page,
but as noted in the class's new docstring, we do not want to encourage any new use of XBlockMixin.

2.0.0 - 2024-02-26
------------------

Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
('py:class', 'aside'),
('py:class', 'aside_fn'),
('py:class', 'webob.Request'),
('py:class', 'webob.Response'),
]

suppress_warnings = [
Expand Down
27 changes: 1 addition & 26 deletions xblock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,4 @@
XBlock Courseware Components
"""

# For backwards compatibility, provide the XBlockMixin in xblock.fields
# without causing a circular import
import codecs
import os
import warnings

import xblock.core
import xblock.fields


class XBlockMixin(xblock.core.XBlockMixin):
"""
A wrapper around xblock.core.XBlockMixin that provides backwards compatibility for the old location.
Deprecated.
"""
def __init__(self, *args, **kwargs):
warnings.warn("Please use xblock.core.XBlockMixin", DeprecationWarning, stacklevel=2)
super().__init__(*args, **kwargs)


# For backwards compatibility, provide the XBlockMixin in xblock.fields
# without causing a circular import
xblock.fields.XBlockMixin = XBlockMixin

__version__ = '2.0.0'
__version__ = '3.0.0'
Loading

0 comments on commit f79bfc5

Please sign in to comment.