XBlock courseware component architecture
XBlock is the Open edX component architecture for building courseware.
This repo contains the core code for implementing XBlocks.
Open edX courseware is built out of components that are combined hierarchically. These include components like the video player,
LON-CAPA_ problems, as well as compound components like learning sequences. The API for these components is called XBlocks.
.. _LON-CAPA: http://www.lon-capa.org/
How does this differ from existing industry standards like
Learning Tools Interoperability_ (LTI) and
SCORM_? On a high level, XBlocks is a Python language-level API, and it provides sensible defaults for things like storing data. XBlocks could be wrapped up in LTI, and one could make an LTI XBlock. The core reason to write an XBlock is that it is deployable. You can give us the code to an XBlock, and we can embed it in our courseware. LTI would require you to give us a virtual machine image which ran it.
.. _Learning Tools Interoperability: http://www.imsglobal.org/toolsinteroperability2.cfm .. _SCORM: http://scorm.com/scorm-explained/
This code runs and is tested on Python 2.7 and 3.5.
Get a local copy of this repo.
(Optional) Create and activate a virtualenv to work in.
Install the requirements and register the XBlock entry points with (you may need to sudo this if you don't use virtualenv):
$ make requirements
To run the test suite:
This will run the XBlock core and runtime unit tests, and print coverage reports.
We use two tools -
pep8- to manage the code quality and style of all Python files in this repo. Our goal is to maintain zero reported pylint and pep8 violations at all times.
To run these tools on a single file:
$ pylint path/to/file.py
$ pep8 path/to/file.py
To run these tools on the whole project:
$ pylint .
$ pep8 .
We do not abide by all pylint and pep8 violations. You can check out which violations we ignore by viewing the contents of
setup.cfg_. Before making a pull request, you should ensure that your branch does not add any new quality violations by checking your code with these tools.
.. _pylintrc: https://github.com/edx/XBlock/blob/master/pylintrc .. _setup.cfg: https://github.com/edx/XBlock/blob/master/setup.cfg
You can run these tests automatically before pushing code to github (and running the validation in Travis) by activating the
cd .git/hooks ln -s ../../script/pre-push cd -
The XBlock-SDK exists in a separate repository. The SDK contains useful tools for developing your own XBlocks, such as a template XBlock generator, sample XBlocks that demonstrate XBlock functionality.
You can find it in its own repository: https://github.com/edx/xblock-sdk
The docs for the XBlock API is on Read The Docs: https://xblock.readthedocs.org .
There are distinct layers to this code. In the docstrings, we've tried to make clear which layer the code lives in, though sometimes the lines are blurred:
XBlock The sample XBlock code. This is the most important, it is the code that most third parties will be writing, and demonstrates the XBlock interfaces.
Runtime The runtime code that we think will be common to all runtimes. This is the behind-the-scenes code edX will write to make XBlocks work. This layer may not be real code here, but we'll need to write real code to perform these functions.
Making an XBlock can be as simple as creating a Python class with a few specific methods.
Instructions for constructing a new XBlock along with examples can be found in the XBlock SDK: https://github.com/edx/xblock-sdk
The code in this repository is licensed the Apache 2.0 license unless otherwise noted.
Contributions are very welcome. The easiest way is to fork this repo, and then make a pull request from your fork. The first time you make a pull request, you may be asked to sign a Contributor Agreement.
Please refer to our
contributor guidelines_ in the main edx-platform repo for important additional information.
Please do not report security issues in public. Please email [email protected]
To package a new release:
git tag v1.2.17
git push --tags
If you need help, you can find online resources, including discussions, at the
Open edX Getting Help_ page.
.. _Open edX Getting Help: https://openedx.org/getting-help
.. |build-status| image:: https://travis-ci.org/edx/XBlock.svg?branch=master :target: https://travis-ci.org/edx/XBlock .. |coverage-status| image:: http://codecov.io/github/edx/XBlock/coverage.svg?branch=master :target: https://codecov.io/github/edx/XBlock?branch=master