{"id":23187,"library":"xblock-utils","title":"xblock-utils","description":"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.","status":"active","version":"4.0.0","language":"python","source_language":"en","source_url":"https://github.com/openedx/xblock-utils","tags":["xblock","openedx","utilities","education"],"install":[{"cmd":"pip install xblock-utils","lang":"bash","label":"Install xblock-utils"}],"dependencies":[{"reason":"Core XBlock package required for development","package":"xblock","optional":false},{"reason":"Required for Django integration since v3.4.0","package":"xblock[django]","optional":false}],"imports":[{"note":"StudioContainerXBlockMixin is in the studio_editable submodule, not top-level","wrong":"from xblockutils import StudioContainerXBlockMixin","symbol":"StudioContainerXBlockMixin","correct":"from xblockutils.studio_editable import StudioContainerXBlockMixin"},{"note":"Old import path was in base module; moved to studio_editable","wrong":"from xblockutils.base import StudioEditableXBlockMixin","symbol":"StudioEditableXBlockMixin","correct":"from xblockutils.studio_editable import StudioEditableXBlockMixin"}],"quickstart":{"code":"from xblock.core import XBlock\nfrom xblockutils.studio_editable import StudioEditableXBlockMixin\n\nclass MyXBlock(StudioEditableXBlockMixin, XBlock):\n    display_name = 'My Editable Block'\n    editable_fields = ['display_name']","lang":"python","description":"Define an XBlock with studio-editable fields using StudioEditableXBlockMixin."},"warnings":[{"fix":"Update your XBlock to be Python 3 compatible.","message":"Version 3.0.0 dropped Python 2.7 support and switched to GitHub Actions CI. Ensure your XBlock code is Python 3 only.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Upgrade your Open edX instance to Nutmeg or later.","message":"Version 3.1.0 requires edx-platform 'Nutmeg' or newer because it uses the mako service. Older platforms will break.","severity":"breaking","affected_versions":">=3.1.0"},{"fix":"Inherit from the specific mixin classes directly.","message":"The 'XBlockWithMixins' class is deprecated and will be removed in a future release. Use standard Python inheritance instead.","severity":"deprecated","affected_versions":"<4.0.0"},{"fix":"Always include super().workbench_scenarios() and other overridden methods.","message":"When using StudioContainerXBlockMixin, you must also inherit from XBlock and call the parent class' methods correctly. Omitting super() calls can lead to broken runtime behavior.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: from xblockutils.studio_editable import StudioEditableXBlockMixin","cause":"The import path changed from top-level to submodule in an older version.","error":"ImportError: cannot import name 'StudioEditableXBlockMixin' from 'xblockutils'"},{"fix":"Run: pip install xblock-utils","cause":"xblock-utils is not installed.","error":"ModuleNotFoundError: No module named 'xblockutils'"},{"fix":"Add editable_fields = ['field1', 'field2'] to your XBlock class.","cause":"You must set editable_fields on the class when using StudioEditableXBlockMixin.","error":"AttributeError: 'MyXBlock' object has no attribute 'editable_fields'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}