Skip to main content

Module to display dynamic quizzes in Jupyter notebooks and Jupyter Books. Uses JavaScript to provide

Project description

JupyterCards

JupyterCards is a tool for displaying interactive flash cards in Jupyter notebooks and Jupyter Book.

JupyterCards is part of my effort to make open source tools for developing modern, interactive textbooks.

Here is an animated GIF showing JupyterCards in action:

Animated GIF showing the output of JupyterCards for a sample set of 3 cards

Flash card content can be loaded from:

  • a Python list of dict,
  • a JSON local file,
  • via a URL to a JSON file.

As of version 1.7, JupyterCards supports switching cards by swiping left on touch devices.

Note: JupyterCards always requires MathJax to be loaded. If you are using JupyterBook, it may not always load MathJax if you do not have any LaTeX on your page. To resolve this, you can include the invisible math command $,!$ in any Markdown cell. I hope to remove this requirement in the future.

Installation

JupyterCards is available via pip:

pip install jupytercards

Notes on JSON File Format

The JSON file should contain a single JSON array of JSON objects. Each JSON object should have a "front" key and a "back" key, and each value should be the string to display on the corresponding side of the flashcard.

Although using JSON objects for each flashcard is overkill, this model was chosen to support future extensions to this library.

Example of generating flashcard files from JupyterBook notebooks

In my Jupyter notebooks that are used as input to JupyterBook, I use panels with the heading "DEFINITION" to call out definitions in the text. I have provided a helper program extractdefinitions.py that I use to scan files for the DEFINITION header and extract the appropriate lines that follow. The resulting terms and definitions are dumped to corresponding JSON files in a "flashcards" directory. An additional JSON file is generated for the whole chapter. extractdefinitions.py takes 2 arguments: the directory to parse and the chapter number to use to label the overall JSON definitions file. This program is very specific to my workflow and I am offering it only as reference in case it can help someone else with a similar situation.

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

jupytercards-1.9.0.tar.gz (876.0 kB view hashes)

Uploaded Source

Built Distribution

jupytercards-1.9.0-py2.py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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