Set Up the XBlock Software Development Kit#
Before you continue, make sure that you are familiar with the subjects in the Install XBlock Prerequisites section.
When you have installed all prerequisites, you are ready to set up the XBlock SDK in a virtual environment. To do this, complete the following steps.
It is recommended that you create a directory in which to store all your XBlock work, including a virtual environment, the XBlock SDK, and the XBlocks you develop.
At the command prompt, run the following command to create the directory.
$ mkdir xblock_development
Change directories to the
$ cd xblock_development
The rest of your work will be from this directory.
You must have a virtual environment tool installed on your computer. For more information, see Install XBlock Prerequisites. If you have multiple Python versions on your machine, see managing different Python versions with virtualenv.
Then create the virtual environment in your
At the command prompt in
xblock_development, run the following command to create the virtual environment.
$ virtualenv xblock-env
Run the following command to activate the virtual environment.
$ source xblock-env/bin/activate
When the virtual environment is activated, the command prompt shows the name of the virtual directory in parentheses.
The XBlock SDK is a Python application you use to help you build new XBlocks. The XBlock SDK contains three main components:
An XBlock creation tool that builds the skeleton of a new XBlock.
An XBlock runtime for viewing and testing your XBlocks during development.
Sample XBlocks that you can use as the starting point for new XBlocks, and for your own learning.
xblock_developmentdirectory, run the following command to clone the XBlock SDK repository from GitHub.
(xblock-env) $ git clone https://github.com/openedx/xblock-sdk.git
In the same directory, create an empty directory called var.
(xblock-env) $ mkdir var
Run the following command to change to the
(xblock-env) $ cd xblock-sdk
Run the following commands to install the XBlock SDK requirements.
(xblock-env) $ make install
Run the following command to return to the
xblock_developmentdirectory, where you will perform the rest of your work.
(xblock-env) $ cd ..
When the requirements are installed, you are in the
directory, which contains the
subdirectories. You can now create your first XBlock.