Tools for making JupyterPhysSciLab notebook templates for student handouts
BSD-3-CLAUSE License
Introduction | Usage | Current Menu Items | Typical workflow | Install | Issues or Comments | License
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, but can be used independently of the rest of the project.
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.
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.
<div>
:
Work in a virtual environment that includes this tool plus all the tools the students will have access to (see Install).
jupyter lab
or jupyter notebook
).Installation using pip into a virtual environment is recommended. My favorite way to manage virtual environments is using pipenv. You should also consider venv which is part of the standard Python library and hatch 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.
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.
pip install jupyter_instructortools
Note: You will need NodeJS to build the extension package.
The jlpm
command is JupyterLab's pinned version of
yarn that is installed with JupyterLab. You may use
yarn
or npm
in lieu of jlpm
below.
# 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.
# 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:
jupyter lab build --minimize=False
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.
This extension is using Jest for JavaScript code testing.
To execute them, execute:
jlpm
jlpm test
This extension uses Playwright for the integration tests (aka user level tests). More precisely, the JupyterLab helper Galata is used to handle testing the extension in JupyterLab.
More information are provided within the ui-tests README.
See RELEASE
Issues or bugs should be reported via the project's issues pages.
Copyright - Jonathan Gutow, 2020 - 2024.