Skip to content

Commit f79bfc5

Browse files
authored
feat!: collapse extraneous XBlock mixins (#718)
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
1 parent 22f6958 commit f79bfc5

14 files changed

+929
-988
lines changed

CHANGELOG.rst

+53-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,62 @@
22
Change history for XBlock
33
=========================
44

5-
These are notable changes in XBlock.
6-
75
Unreleased
86
----------
97

8+
9+
3.0.0 - 2024-03-18
10+
------------------
11+
12+
Various extraneous classes have been removed from the XBlock API, simplifying its implementation
13+
and making debugging of XBlock instances easier. We believe that most, if not all, XBlock API users
14+
will be unaffected by this change. Some improvements have also been made to the reference documentation.
15+
16+
Specific changes:
17+
18+
* **Removed:**
19+
20+
* ``xblock.XBlockMixin`` (still available as ``xblock.core.XBlockMixin``)
21+
* ``xblock.core.SharedBlockBase`` (replaced with ``xblock.core.Blocklike``)
22+
* ``xblock.internal.Nameable``
23+
* ``xblock.internal.NamedAttributesMetaclass``
24+
* ``xblock.django.request.HeadersDict``
25+
* ``xblock.fields.XBlockMixin`` (still available as ``xblock.core.XBlockMixin``)
26+
* ``xblock.mixins.RuntimeServicesMixin``
27+
* ``xblock.mixins.ScopedStorageMixin``
28+
* ``xblock.mixins.IndexInfoMixin``
29+
* ``xblock.mixins.XmlSerializationMixin``
30+
* ``xblock.mixins.HandlersMixin``
31+
* ``xblock.mixins.ChildrenModelMetaclass``
32+
* ``xblock.mixins.HierarchyMixin``
33+
* ``xblock.mixins.ViewsMixin``
34+
35+
* **Added:**
36+
37+
* ``xblock.core.Blocklike``, the new common ancestor of ``XBlock`` and ``XBlockAside``, and ``XBlockMixin``,
38+
replacing ``xblock.core.SharedBlockBase``.
39+
40+
* New attributes on ``xblock.core.XBlockAside``, each behaving the same as their ``XBlock`` counterpart:
41+
42+
* ``usage_key``
43+
* ``context_key``
44+
* ``index_dictionary``
45+
46+
* Various new attributes on ``xblock.core.XBlockMixin``, encompassing the functionality of these former classes:
47+
48+
* ``xblock.mixins.IndexInfoMixin``
49+
* ``xblock.mixins.XmlSerializationMixin``
50+
* ``xblock.mixins.HandlersMixin``
51+
52+
* **Docs**
53+
54+
* Various docstrings have been improved, some of which are published in the docs.
55+
* XBlockAside will now be represented in the API docs, right below XBlock on the "XBlock API" page.
56+
* XBlockMixin has been removed from the docs.
57+
It was only ever documented under the "Fields API" page (which didn't make any sense),
58+
and it was barely even documented there. We considered adding it back to the "XBlock API" page,
59+
but as noted in the class's new docstring, we do not want to encourage any new use of XBlockMixin.
60+
1061
2.0.0 - 2024-02-26
1162
------------------
1263

docs/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
('py:class', 'aside'),
129129
('py:class', 'aside_fn'),
130130
('py:class', 'webob.Request'),
131+
('py:class', 'webob.Response'),
131132
]
132133

133134
suppress_warnings = [

xblock/__init__.py

+1-26
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,4 @@
22
XBlock Courseware Components
33
"""
44

5-
# For backwards compatibility, provide the XBlockMixin in xblock.fields
6-
# without causing a circular import
7-
import codecs
8-
import os
9-
import warnings
10-
11-
import xblock.core
12-
import xblock.fields
13-
14-
15-
class XBlockMixin(xblock.core.XBlockMixin):
16-
"""
17-
A wrapper around xblock.core.XBlockMixin that provides backwards compatibility for the old location.
18-
19-
Deprecated.
20-
"""
21-
def __init__(self, *args, **kwargs):
22-
warnings.warn("Please use xblock.core.XBlockMixin", DeprecationWarning, stacklevel=2)
23-
super().__init__(*args, **kwargs)
24-
25-
26-
# For backwards compatibility, provide the XBlockMixin in xblock.fields
27-
# without causing a circular import
28-
xblock.fields.XBlockMixin = XBlockMixin
29-
30-
__version__ = '2.0.0'
5+
__version__ = '3.0.0'

0 commit comments

Comments
 (0)