Skip to main content

PyPI CI Codecov Documentation Supported Python versions License status-badge

Purpose

This repository consists of three main components to assist in the creation of new XBlocks:

  • a template-based generator for new XBlocks (found in the prototype directory)

  • sample XBlocks that can be the basis for new XBlock work (found in the sample_xblocks directory)

  • Workbench runtime, a simple runtime for viewing and testing XBlocks in a browser (found in the workbench directory)

Getting Started

Developing

This code runs on Python 3.12 or newer.

One Time Setup

# Clone the repository
git clone git@github.com:openedx/xblock-sdk.git
cd xblock-sdk

# Set up a virtualenv with the same name as the repo and activate it
# Here's how you might do that if you have virtualenvwrapper setup.
mkvirtualenv -p python3.12 xblock-sdk

# Install system requirements needed to run this on ubuntu.
# Note: Debian 10 needs libjpeg62-turbo-dev instead of libjpeg62-dev.
sudo apt-get install python-dev libxml2-dev libxslt-dev lib32z1-dev libjpeg62-dev

Every time you develop something in this repo

Locally
  1. Install the requirements and register the XBlock entry points:

    $ make install
  2. Run the Django development server:

    $ python manage.py runserver
  3. Open a web browser to: http://127.0.0.1:8000

Testing

Testing is done via tox to test all supported versions:

  1. Create and activate a virtualenv to work in.

  2. Run just unit tests via tox:

    $ tox

For each supported version of Django (currently 1.8 and 1.11) this will run:

  • Integration tests of XBlocks running within the workbench.

  • Individual tests written for the demo XBlocks

To run the unit tests in your virtualenv you can use:

$ make test

To run all tox unit tests and quality checks:

$ make test-all

To run just the quality checks:

$ make quality

You can test XBlocks through a browser using Selenium. We have included an example Selenium test for thumbs that uses Django’s LiveServerTestCase. It runs as part of the test suite as executed by the above command.

To update and view test coverage:

$ make coverage

See the coverage.py docs for more info and options.

Deploying

This repository is deployed to PyPI. To deploy a new version.

  1. Bump the version of the package in workbench/__init__.py

  2. Make a new release in github or push a new tag up to Github.

The pypi-publish github action should trigger. It will build and deploy the source and wheel package to PyPI.

Getting Help

Documentation

Start by going through the documentation. If you need more help see below.

More Help

If you’re having trouble, we have discussion forums at https://discuss.openedx.org where you can connect with others in the community.

Our real-time conversations are on Slack. You can request a Slack invitation, then join our community Slack workspace.

For anything non-trivial, the best path is to open an issue in this repository with as many details about the issue you are facing as you can provide.

https://github.com/openedx/xblock-sdk/issues

For more information about these options, see the Getting Help page.

License

The code in this repository is licensed under the APACHE 2.0 license unless otherwise noted.

Please see LICENSE.txt for details.

Contributing

Contributions are very welcome. Please read How To Contribute for details.

This project is currently accepting all types of contributions, bug fixes, security fixes, maintenance work, or new features. However, please make sure to have a discussion about your new feature idea with the maintainers prior to beginning development to maximize the chances of your change being accepted. You can start a conversation by creating a new issue on this repo summarizing your idea.

The Open edX Code of Conduct

All community members are expected to follow the Open edX Code of Conduct.

People

The assigned maintainers for this component and other project details may be found in Backstage. Backstage pulls this data from the catalog-info.yaml file in this repo.

Reporting Security Issues

Please do not report security issues in public. Please email security@openedx.org.

Other Documentation

Using the workbench

When you open the workbench, you’ll see a list of sample XBlock configurations (scenarios). Each will display a page showing the XBlocks composited together, along with internal information like the “database” contents.

The workbench database defaults to a sqlite3 database. If you’re using devstack, you may want to set WORKBENCH_DATABASES to point to your MySQL db.

If you want to experiment with different students, you can use a URL parameter to set the student ID, which defaults to 1:

http://127.0.0.1:8000/?student=17

Different students will see different student state, for example, while seeing the same content. The default student ID contains only digits but it is not necessary to limit student IDs to digits. Student IDs are represented as strings.

Making your own XBlock

Making an XBlock involves creating a Python class that conforms to the XBlock specification. See the sample_xblocks directory for examples and the XBlock tutorial for a full walk-through.

We provide a script to create a new XBlock project to help you get started. Run bin/workbench-make-xblock in a directory where you want to create your XBlock project. The script will prompt you for the name of the XBlock, and will create a minimal working XBlock, ready for you to begin development.

You can provide scenarios for the workbench to display: see the thumbs.py sample for an example, or the xblock/problem.py file. The scenarios are written in a simple XML language. Note this is not an XML format we are proposing as a standard.

Once you install your XBlock into your virtualenv, the workbench will automatically display its scenarios for you to experiment with.

If you are interested in making an XBlock to run for your course on edx.org, please get in touch with us as soon as possible – in the ideation and design phase is ideal. See our XBlock review guidelines for more information (note that this is not needed for XBlocks running on your own instance of Open edX, or released to the wider community).

Example XBlocks

Included in this repository are some example XBlocks that demonstrate how to use various aspects of the XBlock SDK. You can see a more detailed description of those examples in the README located in that repository:

There is a rich community of XBlock developers that have put together a large number of XBlocks that have been used in various contexts, mostly on the edx-platform. You can see examples of what that community has done in the edx-platform wiki.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xblock_sdk-0.15.1.tar.gz (320.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xblock_sdk-0.15.1-py3-none-any.whl (250.2 kB view details)

Uploaded Python 3

File details

Details for the file xblock_sdk-0.15.1.tar.gz.

File metadata

  • Download URL: xblock_sdk-0.15.1.tar.gz
  • Upload date:
  • Size: 320.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for xblock_sdk-0.15.1.tar.gz
Algorithm Hash digest
SHA256 9122e8ac9a439d6da7558bcbff07999ba629321e5261adc77a52f4cd5ecb622b
MD5 9344a678f9ebf7be059543af8319fe95
BLAKE2b-256 172fc3cfb8f722a94559be31c4752087e513859e54a8fe2a0cf52a75b1843e5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for xblock_sdk-0.15.1.tar.gz:

Publisher: release.yml on openedx/xblock-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xblock_sdk-0.15.1-py3-none-any.whl.

File metadata

  • Download URL: xblock_sdk-0.15.1-py3-none-any.whl
  • Upload date:
  • Size: 250.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for xblock_sdk-0.15.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aac8ff7c87f1b0b8914035bf6594020e26544a07f0584dd7c226c207e9cc5552
MD5 b832ee30912faa29b31a052422944864
BLAKE2b-256 75470edbf391ef196792c2bde408aa9fe0cd84c947a2d645ccdbb2f9ce0521a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for xblock_sdk-0.15.1-py3-none-any.whl:

Publisher: release.yml on openedx/xblock-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.15.2

2 files

This release

0.15.1 This release

2 files

0.14.0

2 files

0.13.0

2 files

0.12.0

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.4

2 files

0.5.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.9

2 files

0.1a0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page