Registry / web-framework / xblock-utils

xblock-utils

JSON →
library4.0.0pypypi✓ verified 84d ago

Various utilities for developing XBlocks for the Open edX platform. Version 4.0.0 is the latest. Release cadence is irregular, with minor updates every few months.

pip install xblock-utils
INSTALL
IMPORT
SIG · XBLOCK-UTILS
X
xblock-utils
web-frameworkpythonv4.0.0
Install
8.6s avg
Import
809ms
Disk
132MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.828s · 122.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 8.6s · import 0.790s · 124MB
132MB installed
● package 132MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

StudioContainerXBlockMixin
from xblockutils.studio_editable import StudioContainerXBlockMixin
from xblockutils import StudioContainerXBlockMixin
StudioContainerXBlockMixin is in the studio_editable submodule, not top-level
StudioEditableXBlockMixin
from xblockutils.studio_editable import StudioEditableXBlockMixin
from xblockutils.base import StudioEditableXBlockMixin
Old import path was in base module; moved to studio_editable

Define an XBlock with studio-editable fields using StudioEditableXBlockMixin.

from xblock.core import XBlock from xblockutils.studio_editable import StudioEditableXBlockMixin class MyXBlock(StudioEditableXBlockMixin, XBlock): display_name = 'My Editable Block' editable_fields = ['display_name']
Debug
Known issues
breakingVersion 3.0.0 dropped Python 2.7 support and switched to GitHub Actions CI. Ensure your XBlock code is Python 3 only.
fix
Update your XBlock to be Python 3 compatible.
affects: >=3.0.0
breakingVersion 3.1.0 requires edx-platform 'Nutmeg' or newer because it uses the mako service. Older platforms will break.
fix
Upgrade your Open edX instance to Nutmeg or later.
affects: >=3.1.0
deprecatedThe 'XBlockWithMixins' class is deprecated and will be removed in a future release. Use standard Python inheritance instead.
fix
Inherit from the specific mixin classes directly.
affects: <4.0.0
gotchaWhen using StudioContainerXBlockMixin, you must also inherit from XBlock and call the parent class' methods correctly. Omitting super() calls can lead to broken runtime behavior.
fix
Always include super().workbench_scenarios() and other overridden methods.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'StudioEditableXBlockMixin' from 'xblockutils'
The import path changed from top-level to submodule in an older version.
fix
Use: from xblockutils.studio_editable import StudioEditableXBlockMixin
ModuleNotFoundError: No module named 'xblockutils'
xblock-utils is not installed.
fix
Run: pip install xblock-utils
AttributeError: 'MyXBlock' object has no attribute 'editable_fields'
You must set editable_fields on the class when using StudioEditableXBlockMixin.
fix
Add editable_fields = ['field1', 'field2'] to your XBlock class.
Upgrade
Version history
4.0.0latest on PyPI · released Oct 4, 2023
Audit
Dependencies
xblockrequiredCore XBlock package required for development
xblock[django]requiredRequired for Django integration since v3.4.0
Agent activity
37 hits · last 30 days
node
34
OpenAI (training)
1
Resources
xblock-utils — pip install xblock-utils · libregistry