Recommender XBlock

raw JSON →
5.0.0 verified Fri May 01 auth: no python

An Open edX XBlock that provides course content recommendations to learners. Current version 5.0.0, aimed at the edx-platform Lilac release or later.

pip install recommender-xblock
error ModuleNotFoundError: No module named 'recommender_xblock'
cause In version 5.0.0, the import path changed from recommender_xblock to recommender.
fix
Use 'from recommender import RecommenderXBlock' instead.
error AttributeError: 'NoneType' object has no attribute 'render'
cause The student_view method returns a Fragment; attempting to call .render on None happens when the XBlock is not properly initialized.
fix
Ensure you have called super().__init__() in any subclass and that the XBlock is correctly registered in your application.
breaking In version 5.0.0, the module name changed from recommender_xblock to recommender. Existing imports must be updated.
fix Change 'from recommender_xblock import RecommenderXBlock' to 'from recommender import RecommenderXBlock'
gotcha Always call super() when subclassing; missing this can cause runtime errors.
fix In your custom XBlock, ensure __init__ calls super().__init__(**kwargs)

Basic import and instantiation of RecommenderXBlock

from recommender import RecommenderXBlock
# The XBlock is typically used within edx-platform. For local testing:
from xblock.core import XBlock
block = RecommenderXBlock()
print(block.student_view({}))