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.
Then create the virtual environment in your
At the command prompt in
xblock_development, run the following
command to create the virtual environment.
$ virtualenv venv
Run the following command to activate the virtual environment.
$ source venv/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:
xblock_development directory, run the following command to clone
the XBlock SDK repository from GitHub.
(venv) $ git clone https://github.com/edx/xblock-sdk.git
Run the following command to change to the
(venv) $ cd xblock-sdk
Run the following command to install the XBlock SDK requirements.
(venv) $ pip install -r requirements/base.txt
Run the following command to return to the
where you will perform the rest of your work.
(venv) $ cd ..
When the requirements are installed, you are in the
xblock_development directory, which contains the
xblock-sdk subdirectories. You can now create your first XBlock.