Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: collapse extraneous XBlock mixins #718

Merged
merged 3 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added so that we can reference the "Response" class in a new docstring.

]

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
Comment on lines -15 to -28
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're just removing the wrapper locations, which have been deprecated since 2014. XBlockMixin is still available at xblock.core.XBlockMixin.


__version__ = '2.0.0'
__version__ = '3.0.0'
Loading
Loading