Skip to main content

Packaging of the Runestone components for publishing educational materials using Sphinx and restructuredText. Check out the Overview To see all of the extensions in action.

Runestone Version 8

Version 8 and beyond just support the components as they are used in PreTeXt.

If you need to build a book using the old RST markup language, you can use version 7.13.x of the runestone package. You can install that version using pip like this: .. code-block:: bash

pip install runestone==7.13.5

If you need to fix a bug in the old RST version you can clone the repository and checkout the legacy_support branch. That branch will be maintained with bug fixes for the RST version of the components, but no new features will be added to that branch. The master branch will be used for development of the components as they are used in PreTeXt.

Runestone Version 7

Important May 2023 moved RunestoneComponents repository to a new monorepo for the whole project.

To build a release of runestone including the javascript for the interactive components, use the build.py script in this folder.

python build.py

To build a release and publish that release to PyPI use the --publish option

python build.py --publish

The publish option assumes you have the credentials to publish on pyPI, as well as credentials for the runestone load balancer.

Documentation

Writing new books using the Runestone RST markup language is deprecated as of Summer 2022. It is strongly recommended that you use the PreTeXt markup language for writing new books.

  • Take a look at the Sample Book <https://pretextbook.org/examples/sample-book/annotated/sample-book.html> Especially Chapter 3, the section titled Interactive Exercises. The activecode, CodeLens and all the rest of the interactives that you see in that sample book are powered by the components in this repository. This repository will remain the home of those interctive components.

  • Take a look at the PreTeXt Guide It contains comprehensive documentation on writing in PreTeXt.

  • As an Author you will want to use the PreTeXt CLI for writing books. Experienced Runestone authors will find the pretext cli to be quite familiar, but better organized with fewer mysterious configuration files. See PreTeXt-CLI <https://pretextbook.org/doc/guide/html/guide-toc.html>

Quick Start

  • pip install pretext

  • Create a folder for your book project then run

  • pretext new to create a new book.

Old Documentation

I will keep this around for a while during the transition to PreTeXt.

To get started with Runestone restructuredText as the markup language:

  • pip install runestone

To start a project, create a new folder and then run the following command (installed by pip) in that new folder runestone init For example:

mkdir myproject
cd myproject
runestone init

The init command will ask you some questions and setup a default project for you. The default response is in square brackets, example [false].

To build the included default project run

runestone build

Note: If you come across version conflict with six library while building the project, pip install --ignore-installed six command might be useful.

You will now have a build folder with a file index.html in it, along with some default content. The contents of the build folder are suitable for hosting anywhere that you can serve static web content from! For a small class you could even serve the content using the provided Python webserver:

$ runestone serve

Now from your browser you can open up http://localhost:8000/index.html You should see the table of contents for a sample page like this:

images/runeCompo-index.png

If you edit _sources/index.html or _sources/overview.rst and then rebuild and serve again you will see your changes. The best documentation is probably the overview.rst file itself, as it demonstrates how to use all of the common components and shows most of their options.

Windows Users I have tested the installation, along with init, build, and serve on Windows 8.1. The biggest pain is probably setting your PATH environment variable so you can simply type the commands from the shell. Please note that I am not a regular user of windows, I only test things on my VMWare installation every so often. If you are new to using Python on windows I recommend you check out this link on Using Python with Windows

Developing and Hacking

So, you would like to help out with developing the Runestone Components. Great We welcome all the help we can get. There is plenty to do no matter what your experience level. There are a couple of prerequisites.

  1. You will need a version of Python, I currently develop on 3.9 or higher, but test on 3.8 and later.

  2. You will need nodejs and npm as well since there is a LOT of Javascript code in the components.

To get everything set up do the following

  1. Make a Fork of this repository. and git clone the repository to your development machine.

  2. Install Poetry

  3. From the top level RunestoneComponents folder run npm install this will install the packaging tools that are needed for Javascript development. npm run gives you a list of commands The key command is npm run build this will combine all of the Javascript and CSS files for all the components into a single runestone.js file. If you are doing some really deep development and want to avoid building a book, you can put your html in public/index.html and use the npm run start command. This will automatically rebuild runestone.js and refresh the webpage every time you save a change.

  4. When you have some changes to share, make a Pull Request.

(See the RunestoneServer repository and http://runestoneinteractive.org for more complete documentation on how this project works.)

Code Style

We use black to automatically style Python. You can set up your editor to automatically run black whenever you save, or you can run it manually.

We use prettier to automatically style Javascript.

Run jshint on your code we have some options configured for this project.

Writing Tests

A great way to contribute to the Runestone Components repository is to add to our test suite.

Our goal is to have unit tests which rely on Selenium (a library that helps simulate interactions in a web browser) for each directive, to see if the JavaScript that powers the directives is working correctly.

In order to get started with writing a test/writing additional tests, you will need the following:

  • Download the latest ChromeDriver., which is a driver that simulates Google Chrome.

  • On linux you will need to install Xvfb apt-get install xvfb

  • You’ll also need to have done the above installation.

  • We have converted to using poetry for our dependency management. To run runestone while in development mode poetry run runestone … OR you can run poetry shell to start up a shell with a virtual environment activated.

To run tests:

  • Make sure the directory containing the ChromeDriver executable is in your PATH environment variable. e.g. PATH=$PATH:path/to/chromedriver at your command line (or edit your .bash_profile).

  • Check out the existing tests, e.g. the test_question.py file that tests the Question directive, which you can find at the path /runestone/question/test/test_question.py, for an example.

  • Each directive’s individual set of tests requires a mini book. You’ll see a _sources folder for each existing test containing an index.rst file. That file contains a title, as required by .rst, and whatever directive examples you want to test.

  • Finally, to run a test, ensuring that you have accessed a directive folder, type the following at the command prompt:

    • poetry run pytest

Running pytest from the main directory will run all the tests. To run a single test you can navigate to the directory of the test, or you can run poetry run pytest -k XXX where XXX is a substring that matches some part of the test functions name.

You should then see some test output, showing a pass (ok), FAIL, or error(s).

If you have an error relating to PhantomJS/a driver in the output, you probably have a PATH or driver installation problem.

To write a new test:

  • Create a test directory inside a directive’s folder

  • Create a Python file to hold the test suite inside that directory, e.g. test_directivename.py

  • Run runestone init inside that folder and answer the following prompts

  • Write the appropriate directive example(s) inside the index.rst file (which will be created as a result of runestone init)

  • Edit the Python file you created as appropriate (see documentation for the Python unittest module In the Python docs.)

Notes for more Advanced Users

If you already have an existing Sphinx project and you want to incorporate the runestone components into your project you can just make a couple of simple edits to your existing conf.py file.

  • First add the following import line from runestone import runestone_static_dirs, runestone_extensions

  • Then modify your extensions. You may have a different set of extensions already enabled, but it doesn’t matter just do this: extensions = ['sphinx.ext.mathjax'] + runestone_extensions()

  • Then modify your html_static_path: html_static_path = ['_static'] + runestone_static_dirs() Again you may have your own set of static paths in the initial list.

See https://github.com/bnmnetp/runestone/wiki/DevelopmentRoadmap to get a sense for how this is all going to come together.

Researchers

If you use Runestone in your Research or write about it, please reference https://runestone.academy and cite this paper:

@inproceedings{Miller:2012:BPE:2325296.2325335,
 author = {Miller, Bradley N. and Ranum, David L.},
 title = {Beyond PDF and ePub: Toward an Interactive Textbook},
 booktitle = {Proceedings of the 17th ACM Annual Conference on Innovation and Technology in Computer Science Education},
 series = {ITiCSE '12},
 year = {2012},
 isbn = {978-1-4503-1246-2},
 location = {Haifa, Israel},
 pages = {150--155},
 numpages = {6},
 url = {http://doi.acm.org/10.1145/2325296.2325335},
 doi = {10.1145/2325296.2325335},
 acmid = {2325335},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {cs1, ebook, sphinx},
}

Metadata

Release files for runestone 7.13.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for runestone 7.13.9
File Size Uploaded
runestone-7.13.9.tar.gz 15.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for runestone 7.13.9
File Interpreter ABI Platform
runestone-7.13.9-py3-none-any.whl Python 3 none any Details

Total release size: 31.7 MB

Release files / runestone-7.13.9.tar.gz

Download URL runestone-7.13.9.tar.gz
Size 15.8 MB
Tags Source
SHA-256 checksum
How to use checksums
133b4c3f39fd112370d66850e0ff320f9afe12597d381fc5e0dff4a6b6d8fdd4
BLAKE2b-256 checksum
How to use checksums
173e898ee69e423aa806b7838296560f1e82fbdbe5c32e56efbcbdea196c0f98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.13.14 Darwin/27.0.0

Release files / runestone-7.13.9-py3-none-any.whl

Download URL runestone-7.13.9-py3-none-any.whl
Size 15.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
25f43927c0c1c2574d56aa47f2f0da47b8d6a2c4d1062cf6aeaa51708342c783
BLAKE2b-256 checksum
How to use checksums
0aa0d494f1ced56238a93d5583f3287470f220241ffd36e7122c4db8c99d5b04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.13.14 Darwin/27.0.0

Release history Release notifications | RSS feed

This release

7.13.9 This release

2 release files

7.13.7

2 release files

7.13.5

2 release files

7.13.4

2 release files

7.12.2

2 release files

7.12.1

2 release files

7.12.0

2 release files

7.11.9

2 release files

7.11.5

2 release files

7.11.4

2 release files

7.11.3

2 release files

7.11.2

2 release files

7.11.1

2 release files

7.10.0

2 release files

7.9.19

2 release files

7.9.15

2 release files

7.9.14

2 release files

7.9.13

2 release files

7.9.11

2 release files

7.9.9

2 release files

7.9.8

2 release files

7.9.6

2 release files

7.9.5

2 release files

7.9.4

2 release files

7.9.3

2 release files

7.9.2

2 release files

7.9.1

2 release files

7.9.0

2 release files

7.8.5

2 release files

7.8.4

2 release files

7.8.3

2 release files

7.8.2

2 release files

7.8.1

2 release files

7.8.0

2 release files

7.7.7

2 release files

7.7.6

2 release files

7.7.5

2 release files

7.7.4

2 release files

7.7.3

2 release files

7.7.2

2 release files

7.7.1

2 release files

7.7.0

2 release files

7.6.5

2 release files

7.6.4

2 release files

7.6.3

2 release files

7.6.2

2 release files

7.6.1

2 release files

7.6.0

2 release files

7.5.17

2 release files

7.5.12

2 release files

7.5.11

2 release files

7.5.9

2 release files

7.5.8

2 release files

7.5.7

2 release files

7.5.6

2 release files

7.5.5

2 release files

7.5.4

2 release files

7.5.3

2 release files

7.5.2

2 release files

7.5.1

2 release files

7.5.0

2 release files

7.4.7

2 release files

7.4.6

2 release files

7.4.5

2 release files

7.4.4

2 release files

7.4.3

2 release files

7.4.2

2 release files

7.4.1

2 release files

7.4.0

2 release files

7.3.7

2 release files

7.3.6

2 release files

7.3.5

2 release files

7.3.4

2 release files

7.3.3

2 release files

7.3.2

2 release files

7.3.1

2 release files

7.3.0

2 release files

7.2.16

2 release files

7.2.15

2 release files

7.2.12

2 release files

7.2.10

2 release files

7.2.9

2 release files

7.2.8

2 release files

7.2.7

2 release files

7.2.6

2 release files

7.2.5

2 release files

7.2.4

2 release files

7.2.3

2 release files

7.2.2

2 release files

7.2.1

2 release files

7.2.0

2 release files

7.1.9

2 release files

7.1.8

2 release files

7.1.7

2 release files

7.1.6

1 release file

7.1.5

2 release files

7.1.4

2 release files

7.1.3

2 release files

7.1.2

2 release files

7.1.1

2 release files

7.1.0

2 release files

7.0.8

2 release files

7.0.7

2 release files

7.0.6

2 release files

7.0.5

2 release files

7.0.4

2 release files

7.0.3

2 release files

7.0.2

2 release files

7.0.1

2 release files

6.6.2

2 release files

6.6.1

2 release files

6.6.0

2 release files

6.5.5

2 release files

6.5.4

2 release files

6.5.3

2 release files

6.5.2

2 release files

6.5.1

2 release files

6.5.0

2 release files

6.4.5

2 release files

6.4.4

2 release files

6.4.3

2 release files

6.4.2

2 release files

6.4.1

2 release files

6.4.0

2 release files

6.3.24

2 release files

6.3.23

2 release files

6.3.20

2 release files

6.3.19

2 release files

6.3.18

2 release files

6.3.17

2 release files

6.3.15

2 release files

6.3.14

2 release files

6.3.13

2 release files

6.3.12

2 release files

6.3.9

2 release files

6.3.8

2 release files

6.3.7

2 release files

6.3.6

2 release files

6.3.5

2 release files

6.3.4

2 release files

6.3.3

2 release files

6.3.2

2 release files

6.3.1

2 release files

6.3.0

2 release files

6.2.2

2 release files

6.2.1

2 release files

6.2.0

2 release files

6.1.2

2 release files

6.1.1

2 release files

6.1.0

2 release files

6.0.13

2 release files

6.0.12

2 release files

6.0.11

2 release files

6.0.9

2 release files

6.0.8

2 release files

6.0.7

2 release files

6.0.6

2 release files

6.0.5

2 release files

6.0.4

2 release files

6.0.3

2 release files

6.0.2

2 release files

6.0.1

2 release files

6.0.0

2 release files

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