{ "cells": [ { "cell_type": "markdown", "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "hidden": true }, "report_default": {} } } } }, "source": [ "# ordo\n", "A lightweight feedback tool for Jupyter.\n", "\n", "### Installation\n", "Install and enable ordo on your Jupyter server\n", "\n", "```pip install ordo\n", "jupyter nbextension install --py ordo\n", "jupyter nbextension enable ordo --py```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Configuration\n", "You can configure ordo to have a system wide default feedback messages. \n", "Just set the **ordo_default_success** or **ordo_default_failure** configuration options in your ```~/.jupyter/nbconfig/
.json```\n", "\n", "```json\n", "\"ordo_default_success\": \"You've done well to get the correct answer\",\n", "\"ordo_default_failure\": \"That answer is not correct, please try again\"\n", "```" ] }, { "cell_type": "markdown", "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "col": 0, "height": 4, "hidden": false, "row": 0, "width": 4 }, "report_default": {} } } } }, "source": [ "The ordo grading tool allows authors to provide in line feedback to users of their notebook. The examples below illustrate key features of the notebook." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Guide\n", "\n", "#### Toggle Modes\n", " - Enter **Feedback Mode** to run the cells and evauluate your input\n", " - Enter **Edit Mode** to create/edit your feedback messages\n", "#### In Feedback Mode\n", " - Show solution for the current cell \n", "#### In Edit Mode\n", " - Add new solution\n", " - Add success message for feedback\n", " - Add failure message for feedback\n", " - Make what's in this cell the current solution\n", " - Set the currently executed cells output to it's solution\n" ] }, { "cell_type": "markdown", "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "col": 4, "height": 4, "hidden": false, "row": 0, "width": 4 }, "report_default": {} } } } }, "source": [ "Once installed, the extension runs in any language within any Jupyter notebook. Beware, it will only grade **returned** values. `print` values in Python, for example, return `None` and are ignored." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "hidden": true }, "report_default": {} } } }, "ordo_solution": { "text/plain": "9.0" }, "scrolled": true }, "outputs": [], "source": [ "5+4.0" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "col": 8, "height": 4, "hidden": false, "row": 0, "width": 4 }, "report_default": {} } } }, "ordo_solution": { "text/plain": "'Hello, World! This is an Ordo Test'" } }, "outputs": [], "source": [ "'Hello, World! This is an Ordo Test'" ] }, { "cell_type": "markdown", "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "col": 0, "height": 4, "hidden": false, "row": 4, "width": 4 }, "report_default": {} } } } }, "source": [ "Only cells which have solution in the cell metadata are evaluated for grading." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "hidden": true }, "report_default": {} } } } }, "outputs": [], "source": [ "# this cell has no associated solution\n", "def addOne(n):\n", " return n + 1" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "hidden": true }, "report_default": { "hidden": true } } } }, "ordo_solution": { "text/plain": "7" } }, "outputs": [], "source": [ "# this cell is configured with a solution of 7\n", "addOne(6)" ] }, { "cell_type": "markdown", "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "col": 4, "height": 4, "hidden": false, "row": 4, "width": 4 }, "report_default": {} } } } }, "source": [ "When an answer is incorrect, student's will receive a different response." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "hidden": true }, "report_default": { "hidden": true } } } }, "ordo_solution": { "text/plain": "11" } }, "outputs": [], "source": [ "# this cell is configured with a solution of 7\n", "addOne(10)" ] }, { "cell_type": "markdown", "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "col": 8, "height": 4, "hidden": false, "row": 4, "width": 4 }, "report_default": {} } } } }, "source": [ "Notebook authors can either use the default ordo messages above or, they can define specific ones they would like within the cell metadata with either the `ordo_success or ordo_failure` MIME types." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "col": 0, "height": 4, "hidden": false, "row": 8, "width": 4 }, "report_default": {} } } }, "ordo_failure": "Try that one again!", "ordo_solution": { "text/plain": "8" }, "ordo_success": "Righto Chap!" }, "outputs": [], "source": [ "# this cell is configured with a solution of 7\n", "addOne(6)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "extensions": { "jupyter_dashboards": { "version": 1, "views": { "grid_default": { "col": 4, "height": 4, "hidden": false, "row": 8, "width": 4 }, "report_default": {} } } }, "ordo_failure": "Try that one again!", "ordo_solution": { "text/plain": "21" }, "ordo_success": "Righto Chap!" }, "outputs": [], "source": [ "# this cell is configured with a solution of 7\n", "addOne(20)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "An example of a cell with a pandas dataframe as a solution" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ordo_solution": { "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
abc
0012
\n
", "text/plain": " a b c\n0 0 1 2" } }, "outputs": [], "source": [ "import pandas as pd\n", "d = [{'b' : 1, 'a' : 0, 'c' : 2}]\n", "pd.DataFrame(d)" ] } ], "metadata": { "extensions": { "jupyter_dashboards": { "activeView": "grid_default", "version": 1, "views": { "grid_default": { "cellMargin": 10, "defaultCellHeight": 20, "maxColumns": 12, "name": "grid", "type": "grid" }, "report_default": { "name": "report", "type": "report" } } } }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.4" } }, "nbformat": 4, "nbformat_minor": 2 }