xblocks-contrib
raw JSON → 0.16.1 verified Fri May 01 auth: no python
A collection of XBlocks for the Open edX platform, including video, discussion, poll, HTML, problem, PDF, and other contributed blocks. Version 0.16.1 requires Python >=3.12. Active development with frequent releases, used inside Open edX installations.
pip install xblocks-contrib Common errors
error ModuleNotFoundError: No module named 'xblocks_contrib.video_block' ↓
cause Wrong module name; correct module is 'video'.
fix
Use 'from xblocks_contrib.video import VideoBlock'.
error ImportError: cannot import name 'VideoBlock' from 'xblocks_contrib' ↓
cause Attempted to import directly from the package root instead of the submodule.
fix
Import from the specific submodule, e.g., 'from xblocks_contrib.video import VideoBlock'.
error AttributeError: 'VideoBlock' object has no attribute 'xmodule_runtime' ↓
cause Using legacy XModuleMixin attributes removed in version 0.15.3.
fix
Update your code to use the XBlock runtime API (e.g., self.runtime instead of self.xmodule_runtime).
Warnings
breaking Version 0.14.0 dropped Python 3.11 support; Python >=3.12 is required. ↓
fix Use Python 3.12 or newer.
deprecated Legacy XModuleMixin attributes were removed in 0.15.3 from Poll, Discussion, Annotatable, HTML, and Problem blocks. ↓
fix Replace any usage of legacy XModuleMixin attributes with the new XBlock API.
gotcha The package name uses underscores (xblocks_contrib) for Python imports, but the PyPI package uses a hyphen (xblocks-contrib). ↓
fix Install with 'pip install xblocks-contrib' but import with 'import xblocks_contrib'.
Imports
- VideoBlock wrong
from xblocks_contrib.video_block import VideoBlockcorrectfrom xblocks_contrib.video import VideoBlock - DiscussionBlock
from xblocks_contrib.discussion import DiscussionBlock - PollBlock
from xblocks_contrib.poll import PollBlock
Quickstart
from xblocks_contrib.video import VideoBlock
block = VideoBlock()
print(block.display_name)