jupyterlab-exam-submission: Automatically hide code and/or output cells after running them
I wanted to allow students to use jupyter-lite to write computational exams. For this I made some logic that allows students to upload their notebooks to an endpoint with a unique token. However, I did not want students to see the logic behind this so this extension automatically runs all code cells once and hides the ones tagged with hide_code. If the tag hide_output is used, the output of the cell is also hidden.
Requirements
- JupyterLab >= 4.0.0
Install
To install the extension, use Development install
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 jupyterlab_exam_submission 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
Testing the extension
Frontend tests
This extension is using Jest for JavaScript code testing.
To execute them, execute:
jlpm
jlpm test
Acknowledgements
Built on top of the excellent work by OSSCAR Team for their jupyterlab-exam-submission extension.
Metadata
Release files for jupyterlab-exam-submission 4.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jupyterlab_exam_submission-4.0.0.tar.gz | 153.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jupyterlab_exam_submission-4.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 158.0 kB
Release files / jupyterlab_exam_submission-4.0.0.tar.gz
| Download URL | jupyterlab_exam_submission-4.0.0.tar.gz |
|---|---|
| Size | 153.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
940cf23751d7398f658b577704e79b84b86c10e11e6f3c6aed0dd96782e21f39
|
|
BLAKE2b-256 checksum How to use checksums |
61a74442e0e1fcc0bc088f8cc32af6a82ace6fd34ec7ed8d96bd4c1be3f12b93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / jupyterlab_exam_submission-4.0.0-py3-none-any.whl
| Download URL | jupyterlab_exam_submission-4.0.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d956efb475646a8c539f060802ad198ecb2c65d35c8e79a069cded2fb85b480a
|
|
BLAKE2b-256 checksum How to use checksums |
b371a9b460a569a4f57988e7a2aa1f3c46a114eece95d364aba6eca337690795
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|