Name | jupyter-instructortools JSON |
Version |
0.8.0
JSON |
| download |
home_page | None |
Summary | Tool to assist instructors in creating notebook templates for student Jupyter worksheets. |
upload_time | 2024-07-15 20:03:58 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | BSD 3-Clause License Copyright (c) 2024, Jonathan Gutow All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# jupyter-instructortools
[Introduction](#introduction) |
[Usage](#usage) |
[Current Menu Items](#current-menu-items) |
[Typical workflow](#typical-workflow) | [Install](#install) |
[Issues or Comments](#issues-or-comments) |
[License](#this-software-is-distributed-under-the-gnu-v3-licensehttpsgnuorglicenses)
## Introduction
This adds a menu to Jupyter that automates some useful tasks an
instructor might want to do while building a notebook template for an
assignment. This is part of the
[Jupyter Physical Science Lab project](https://jupyterphysscilab.github.io/Documentation/),
but can be used independently of the rest of the project.
## Usage:
The menu that provides access to most of the tools is activated using the
"Activate menu" item in the "JPSL Instructor Tools" section of the Jupyter
Lab command palette (figure 1). By default it is inactive at the beginning
of a session.
![Instructor Tool commands in Jupyter Lab command palette](https://raw.githubusercontent.com/JupyterPhysSciLab/jupyter-instructortools/master/JPSL_Instructor_Tools_palette_cmds.png)
__Figure 1:__ Instructor Tool commands available in the Jupyter lab
command
palette.
The "Disallow menu in Notebook" option prevents the use of the Instructor
Tools menu with the _currently focused notebook_. This should only be done to
the final form of the notebook that will be distributed to students, because
it is very difficult to reverse.
### Available menu items
* Create a data input table.
* Table column and row labels can be locked once set.
* Number of rows and columns must be chosen on initial creation.
* Table will survive deletion of all cell output data.
* The code cell that creates the table is protected.
* Table creation code will work in a plain vanilla Jupyter install, but the
contents of the table cannot be edited.
* See the [jupyter-datainputtable](https://github.com/JupyterPhysSciLab/jupyter-datainputtable)
extension for more details.
* Add some highlight bars to a selected markdown cell. These can be removed by
deleting the associated`<div>`:
* A vertical cyan bracket at the left of the cell.
* A vertical red bracket at the left of the cell.
* A horizontal green start bar (fading down to beige). Useful for indicating
the beginning of an instruction block.
* A horizontal brown stop bar (fading down from beige to brown). Useful
for indicating the end of an instruction block.
* Protect/unprotect selected cells. Protected cells cannot be
edited or deleted by the user. This is a good way to prevent instructions
and example code from being damaged by students.
* Set/un-set selected cells as allowed to be hidden. This can be used to mark
cells to hide before producing a pdf to turn in.
* Set/un-set selected cells to collapse code before printing.
* Set/un-set selected cells to collapse code in JPSL.
* Temporarily highlight each kind of cell marked for hiding or code collapse.
* Temporarily completely hide (not collapse) code (all or just selected cells).
* Insert boilerplate instructions on initializing a
notebook into a selected markdown cell.
* Insert boilerplate instructions on preparing a pdf version of the notebook
to turn in with instructor selected parts hidden.
<!-- Not part of menu or not working in current version.
* Insert code to automatically timestamp the notebook and
collect names from students. The code is inserted at the end of the
currently selected cell. The cell becomes protected
against editing and deletion. This is a good cell to include initialization
imports in.
-->
### Typical workflow
Work in a virtual environment that includes this tool plus all the tools
the students will have access to (see [Install](#install)).
1. Start the jupyter notebook server (from the command line use `jupyter
lab` or `jupyter notebook`).
1. Open a new notebook and activate the menu using the "Activate menu" item
in the "JPSL Instructor Tools" section of the Jupyter Lab command palette
(figure 1). By default it is inactive at the beginning of a session.
1. Build the exercise including instructions, examples, tables (use the menu)
and imports.
1. Collect all the necessary imports into a code cell that will be the
first code cell in the worksheet. You may want introductory material
before this cell.
1. Use the menu to protect any cells you do not want students to
accidentally alter.
1. Use the menu to tag cells so they can be hidden. This allows students to
print a compressed version of the notebook for grading. Consider hiding
most of the instructions.
1. Restart the kernel and clear all cell outputs. Delete or emtpy any cells
that have things you want the students to be filling in.
1. Save the notebook and make a duplicate of it. Continue working with the
duplicate.
1. Work through the notebook as if you were a student, make adjustments as
you go. Iterate restarting the kernel, clearing the cell outputs, saving,
duplicating and working though until satisfied.
1. Save the final version of the worksheet. Duplicate it.
1. Open the duplicate worksheet. Make sure all the appropriate cell data is
cleared. Then select "Disallow menu in Notebook" item in the "JPSL
Instructor Tools" section of the Jupyter Lab command palette (figure 1).
This will deactivate the menu and block students from easily
reinstalling it. Save the notebook and distribute this copy to students.
<!--
5. Use the menu to add to this initialization cell the command to get the
student names and timestamp the notebook. This will simultaneously
protect the cell.
-->
## Requirements
* JupyterLab >= 4.0.0
* notebook >= 7.0.0
* jupyter-datainputtable >=0.8.0
## Install
Installation using pip into a virtual environment is recommended. My
favorite way to manage virtual environments is using
[pipenv](https://pipenv.pypa.io/en/latest/). You should also consider
[venv](https://docs.python.org/3/library/venv.html) which is part of the
standard Python library and [hatch](https://hatch.pypa.io/latest/) for
development.
__Option 1__: Recommended, as this will install all of the Jupyter Physical
Science Lab packages an Instructor might need. Use the
[JPSLInstructor pseudo package](https://github.com/JupyterPhysSciLab/JPSLInstructor).
```bash
pip install JPSLInstructor
```
__Option 2__: Install just this package and its minimal requirements. You
may want to do this if you are just making worksheets, do not need live
data acquisition or want to use a very specific set of packages.
```bash
pip install jupyter_instructortools
```
## Contributing
### Development install
Note: You will need NodeJS to build the extension package.
The `jlpm` command is JupyterLab's pinned version of
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
`yarn` or `npm` in lieu of `jlpm` below.
```bash
# Clone the repo to your local environment
# Change directory to the jupyter_datainputtable directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm build
```
You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
```bash
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab
```
With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
```bash
jupyter lab build --minimize=False
```
### Development uninstall
```bash
pip uninstall jupyter_instructortools
```
In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
folder is located. Then you can remove the symlink named
`jupyter-instructortools` within that folder.
### Testing the extension (currently incomplete)
#### Frontend tests
This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.
To execute them, execute:
```sh
jlpm
jlpm test
```
#### Integration tests
This extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).
More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.
More information are provided within the [ui-tests](./ui-tests/README.md) README.
### Packaging the extension
See [RELEASE](RELEASE.md)
## Issues or comments
Issues or bugs should be reported via the project's [issues pages](https://github.com/JupyterPhysSciLab/jupyter-instructortools/issues).
Copyright - Jonathan Gutow, 2020 - 2024.
Raw data
{
"_id": null,
"home_page": null,
"name": "jupyter-instructortools",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Jonathan Gutow <gutow@uwosh.edu>",
"download_url": "https://files.pythonhosted.org/packages/6c/98/fb58dde499876cb4f59a47896799d0bf24afb89bd567a3bdf89b6f614a24/jupyter_instructortools-0.8.0.tar.gz",
"platform": null,
"description": "# jupyter-instructortools\n[Introduction](#introduction) |\n[Usage](#usage) | \n[Current Menu Items](#current-menu-items) | \n[Typical workflow](#typical-workflow) | [Install](#install) | \n[Issues or Comments](#issues-or-comments) | \n[License](#this-software-is-distributed-under-the-gnu-v3-licensehttpsgnuorglicenses)\n## Introduction\nThis adds a menu to Jupyter that automates some useful tasks an\ninstructor might want to do while building a notebook template for an \nassignment. This is part of the\n[Jupyter Physical Science Lab project](https://jupyterphysscilab.github.io/Documentation/),\nbut can be used independently of the rest of the project.\n\n## Usage:\nThe menu that provides access to most of the tools is activated using the \n\"Activate menu\" item in the \"JPSL Instructor Tools\" section of the Jupyter \nLab command palette (figure 1). By default it is inactive at the beginning \nof a session.\n\n![Instructor Tool commands in Jupyter Lab command palette](https://raw.githubusercontent.com/JupyterPhysSciLab/jupyter-instructortools/master/JPSL_Instructor_Tools_palette_cmds.png)\n\n__Figure 1:__ Instructor Tool commands available in the Jupyter lab \ncommand \npalette.\n\nThe \"Disallow menu in Notebook\" option prevents the use of the Instructor \nTools menu with the _currently focused notebook_. This should only be done to \nthe final form of the notebook that will be distributed to students, because \nit is very difficult to reverse.\n\n### Available menu items\n* Create a data input table.\n * Table column and row labels can be locked once set.\n * Number of rows and columns must be chosen on initial creation.\n * Table will survive deletion of all cell output data.\n * The code cell that creates the table is protected.\n * Table creation code will work in a plain vanilla Jupyter install, but the \n contents of the table cannot be edited.\n * See the [jupyter-datainputtable](https://github.com/JupyterPhysSciLab/jupyter-datainputtable)\n extension for more details.\n* Add some highlight bars to a selected markdown cell. These can be removed by \n deleting the associated`<div>`:\n * A vertical cyan bracket at the left of the cell.\n * A vertical red bracket at the left of the cell.\n * A horizontal green start bar (fading down to beige). Useful for indicating\n the beginning of an instruction block.\n * A horizontal brown stop bar (fading down from beige to brown). Useful \n for indicating the end of an instruction block.\n* Protect/unprotect selected cells. Protected cells cannot be \n edited or deleted by the user. This is a good way to prevent instructions\n and example code from being damaged by students.\n* Set/un-set selected cells as allowed to be hidden. This can be used to mark\n cells to hide before producing a pdf to turn in.\n* Set/un-set selected cells to collapse code before printing.\n* Set/un-set selected cells to collapse code in JPSL.\n* Temporarily highlight each kind of cell marked for hiding or code collapse.\n* Temporarily completely hide (not collapse) code (all or just selected cells).\n* Insert boilerplate instructions on initializing a\n notebook into a selected markdown cell.\n* Insert boilerplate instructions on preparing a pdf version of the notebook \n to turn in with instructor selected parts hidden.\n\n<!-- Not part of menu or not working in current version.\n* Insert code to automatically timestamp the notebook and \n collect names from students. The code is inserted at the end of the \n currently selected cell. The cell becomes protected\n against editing and deletion. This is a good cell to include initialization\n imports in.\n-->\n \n### Typical workflow\nWork in a virtual environment that includes this tool plus all the tools\nthe students will have access to (see [Install](#install)).\n\n1. Start the jupyter notebook server (from the command line use `jupyter \n lab` or `jupyter notebook`).\n1. Open a new notebook and activate the menu using the \"Activate menu\" item \n in the \"JPSL Instructor Tools\" section of the Jupyter Lab command palette \n (figure 1). By default it is inactive at the beginning of a session.\n1. Build the exercise including instructions, examples, tables (use the menu) \n and imports.\n1. Collect all the necessary imports into a code cell that will be the \n first code cell in the worksheet. You may want introductory material \n before this cell.\n1. Use the menu to protect any cells you do not want students to \n accidentally alter.\n1. Use the menu to tag cells so they can be hidden. This allows students to \n print a compressed version of the notebook for grading. Consider hiding \n most of the instructions.\n1. Restart the kernel and clear all cell outputs. Delete or emtpy any cells \n that have things you want the students to be filling in.\n1. Save the notebook and make a duplicate of it. Continue working with the \n duplicate.\n1. Work through the notebook as if you were a student, make adjustments as \n you go. Iterate restarting the kernel, clearing the cell outputs, saving,\n duplicating and working though until satisfied.\n1. Save the final version of the worksheet. Duplicate it.\n1. Open the duplicate worksheet. Make sure all the appropriate cell data is \n cleared. Then select \"Disallow menu in Notebook\" item in the \"JPSL \n Instructor Tools\" section of the Jupyter Lab command palette (figure 1). \n This will deactivate the menu and block students from easily \n reinstalling it. Save the notebook and distribute this copy to students.\n<!--\n5. Use the menu to add to this initialization cell the command to get the \n student names and timestamp the notebook. This will simultaneously \n protect the cell.\n-->\n## Requirements\n* JupyterLab >= 4.0.0\n* notebook >= 7.0.0\n* jupyter-datainputtable >=0.8.0\n\n## Install\n\nInstallation using pip into a virtual environment is recommended. My \nfavorite way to manage virtual environments is using\n[pipenv](https://pipenv.pypa.io/en/latest/). You should also consider\n[venv](https://docs.python.org/3/library/venv.html) which is part of the \nstandard Python library and [hatch](https://hatch.pypa.io/latest/) for \ndevelopment.\n\n__Option 1__: Recommended, as this will install all of the Jupyter Physical \nScience Lab packages an Instructor might need. Use the\n[JPSLInstructor pseudo package](https://github.com/JupyterPhysSciLab/JPSLInstructor).\n\n```bash\npip install JPSLInstructor\n```\n\n__Option 2__: Install just this package and its minimal requirements. You \nmay want to do this if you are just making worksheets, do not need live \ndata acquisition or want to use a very specific set of packages.\n\n```bash\npip install jupyter_instructortools\n```\n\n## Contributing \n\n### Development install\nNote: You will need NodeJS to build the extension package.\n\nThe `jlpm` command is JupyterLab's pinned version of\n[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use\n`yarn` or `npm` in lieu of `jlpm` below.\n\n```bash\n# Clone the repo to your local environment\n# Change directory to the jupyter_datainputtable directory\n# Install package in development mode\npip install -e \".\"\n# Link your development version of the extension with JupyterLab\njupyter labextension develop . --overwrite\n# Rebuild extension Typescript source after making changes\njlpm build\n```\n\nYou can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.\n\n```bash\n# Watch the source directory in one terminal, automatically rebuilding when needed\njlpm watch\n# Run JupyterLab in another terminal\njupyter lab\n```\n\nWith the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).\n\nBy default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:\n\n```bash\njupyter lab build --minimize=False\n```\n\n### Development uninstall\n\n```bash\npip uninstall jupyter_instructortools\n```\n\nIn development mode, you will also need to remove the symlink created by `jupyter labextension develop`\ncommand. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`\nfolder is located. Then you can remove the symlink named \n`jupyter-instructortools` within that folder.\n\n### Testing the extension (currently incomplete)\n\n#### Frontend tests\n\nThis extension is using [Jest](https://jestjs.io/) for JavaScript code testing.\n\nTo execute them, execute:\n\n```sh\njlpm\njlpm test\n```\n\n#### Integration tests\n\nThis extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).\nMore precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.\n\nMore information are provided within the [ui-tests](./ui-tests/README.md) README.\n\n### Packaging the extension\n\nSee [RELEASE](RELEASE.md)\n## Issues or comments\n\nIssues or bugs should be reported via the project's [issues pages](https://github.com/JupyterPhysSciLab/jupyter-instructortools/issues).\n\nCopyright - Jonathan Gutow, 2020 - 2024.",
"bugtrack_url": null,
"license": "BSD 3-Clause License Copyright (c) 2024, Jonathan Gutow All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
"summary": "Tool to assist instructors in creating notebook templates for student Jupyter worksheets.",
"version": "0.8.0",
"project_urls": {
"Bug Tracker": "https://github.com/JupyterPhysSciLab/jupyter-instructortools/issues",
"Homepage": "https://github.com/JupyterPhysSciLab/jupyter-instructortools",
"Repository": "https://github.com/JupyterPhysSciLab/jupyter-instructortools.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4c7d21a2f0c43fcb2ecc3fc3f2b6734d9123e6eba19b76c2128617512a79795d",
"md5": "5998818401417d3e6091e63f3e450774",
"sha256": "ec50e9b2243460f7b4d8e05b643d3a6df717e4dd4d729fc1b3d2f271e50f4d93"
},
"downloads": -1,
"filename": "jupyter_instructortools-0.8.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5998818401417d3e6091e63f3e450774",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 22663,
"upload_time": "2024-07-15T20:03:56",
"upload_time_iso_8601": "2024-07-15T20:03:56.336832Z",
"url": "https://files.pythonhosted.org/packages/4c/7d/21a2f0c43fcb2ecc3fc3f2b6734d9123e6eba19b76c2128617512a79795d/jupyter_instructortools-0.8.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6c98fb58dde499876cb4f59a47896799d0bf24afb89bd567a3bdf89b6f614a24",
"md5": "aa7584f7c121b054534e52733cd23962",
"sha256": "a588ce1acbf5fdd9018dcac303dd752bb2fcd7082026d76e10c6f152e80b7b1f"
},
"downloads": -1,
"filename": "jupyter_instructortools-0.8.0.tar.gz",
"has_sig": false,
"md5_digest": "aa7584f7c121b054534e52733cd23962",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 542183,
"upload_time": "2024-07-15T20:03:58",
"upload_time_iso_8601": "2024-07-15T20:03:58.119523Z",
"url": "https://files.pythonhosted.org/packages/6c/98/fb58dde499876cb4f59a47896799d0bf24afb89bd567a3bdf89b6f614a24/jupyter_instructortools-0.8.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-15 20:03:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "JupyterPhysSciLab",
"github_project": "jupyter-instructortools",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "jupyter-instructortools"
}