Skip to main content

XBlock Core Library

Project description

PyPI CI Codecov Documentation Supported Python versions License Repo is maintained.

Purpose

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.

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.

Getting Started

Developing

One Time Setup

First, clone the repository:

git clone git@github.com:openedx/XBlock.git

Go to the XBlock directory, set up a virtual environment using virtualenvwrapper with the same name as the repo and activate it:

cd XBlock
mkvirtualenv -p python3.12 XBlock

Every time you develop something in this repo

# Activate the virtualenv
workon XBlock

# Grab the latest code
git checkout master
git pull

# Install/update the dev requirements
make requirements

# Run the tests and quality checks (to verify the status before you make any changes)
make validate

# Make a new branch for your changes
git checkout -b <your_github_username>/<short_description>

# Using your favorite editor, edit the code to make your change.
vim ...

# Run your new tests
pytest ./path/to/new/tests

# Run all the tests and quality checks
make validate

# Commit all your changes
git commit ...
git push

# Open a PR and ask for review.

Deploying

To package a new release:

  1. Describe the release in CHANGELOG.rst

  2. Update the __version__ number in xblock/__init__.py

  3. Use the github release mechanism to release a new version. This will tag and publish the package.

Using the XBlock-SDK

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/openedx/xblock-sdk

Getting Help

Documentation

The docs for the XBlock API is on Read The Docs: https://docs.openedx.org/projects/xblock/en/latest/xblock-tutorial/index.html .

Reading the code

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:

  1. 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.

  2. 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 your own XBlock

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.

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/issues

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

License

The code in this repository is licensed 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

Project details


Download files

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

Source Distribution

xblock-6.2.0.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

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

xblock-6.2.0-py3-none-any.whl (160.2 kB view details)

Uploaded Python 3

File details

Details for the file xblock-6.2.0.tar.gz.

File metadata

  • Download URL: xblock-6.2.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for xblock-6.2.0.tar.gz
Algorithm Hash digest
SHA256 87e5b569f082f6f1976dc39ec9adac1cc2067374295dad3320dc60e771bf3529
MD5 13d018c9222b7c6085650c332c7a8f50
BLAKE2b-256 5a1b54ffb74861265b32210c1f8ad0990498c48b693feef8a7cec21df300425f

See more details on using hashes here.

File details

Details for the file xblock-6.2.0-py3-none-any.whl.

File metadata

  • Download URL: xblock-6.2.0-py3-none-any.whl
  • Upload date:
  • Size: 160.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for xblock-6.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c5742c9ef18e1e5d2455122581ab5e781b2f5bf780e5e4bb2056bd10cd3d86a
MD5 a079e84b1c12a2a8f1ca4fbe790d839f
BLAKE2b-256 5e5a95a4e8ca1ff2f34891c98c23d6812df8d6a2d938864f320a37d2206fcf1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page