Giter Site home page Giter Site logo

rdkamali / xblock-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openedx/xblock-sdk

0.0 1.0 0.0 1.21 MB

Workbench and example xblocks

License: GNU Affero General Public License v3.0

Makefile 1.61% Python 33.10% CSS 3.78% JavaScript 61.11% Shell 0.40%

xblock-sdk's Introduction

XBlock SDK build-status coverage-status

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

  • a template-based generator for new XBlocks (found in prototype)
  • sample XBlocks that can be the basis for new XBlock work (found in sample_xblocks)
  • Workbench runtime, a simple runtime for viewing and testing XBlocks in a browser (found in workbench)

Installation

This code runs on Python 2.7. If you prefer to use Python 3, there is a fork of xblock-sdk that provides Python 3 support, but this fork is not yet supported by edX.

  1. Get a local copy of this repo.

  2. (Optional) Create and activate a virtualenv to work in.

  3. Install the requirements and register the XBlock entry points with (you may need to sudo this if you don't use virtualenv):

    $ make install

  4. Run the Django development server:

    $ python manage.py runserver

  5. Open a web browser to: http://127.0.0.1:8000

Testing

To install all requirements and run the test suite:

$ make

This will run:

  • Integration tests of XBlocks running within the workbench.
  • Individual tests written for the demo XBlocks

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. You need to have Firefox installed for this test case to run successfully.

To update and view test coverage:

$ make cover

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

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. Student ids are strings, even if they contain only digits as the default does.

Making your own XBlock

Making an XBlock can be as simple as creating a Python class with a few specific methods. The thumbs XBlock demonstrates an XBlock with state, views, and input handling.

We provide a script to create a new XBlock project to help you get started. Run script/startnew.py in a directory where you want to create your XBlock project. startnew.py 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.

External XBlocks

We have been moving towards hosting XBlocks in external repositories, some of which have been installed and will appear in the workbench:

ACID XBlock: https://github.com/edx/acid-block

License

The code in this repository is licensed under version 3 of the AGPL unless otherwise noted.

Please see LICENSE.txt for details.

How to Contribute

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.

Reporting Security Issues

Please do not report security issues in public. Please email [email protected]

Mailing List and IRC Channel

You can discuss this code on the edx-code Google Group or in the #edx-code IRC channel on Freenode.

xblock-sdk's People

Contributors

nedbat avatar cpennington avatar jorr-at-google avatar sarina avatar dianakhuang avatar singingwolfboy avatar brianhw avatar lapentab avatar jtauber avatar stvstnfrd avatar dmitchell avatar pdehaye avatar usernamenumber avatar dragonfi avatar talbs avatar flowerhack avatar sefk avatar straz avatar

Watchers

Kamali avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.