A button in JupyterLab to run the code cells and then to hide the code cells.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jupyterlab_exam_submission-4.0.0.tar.gz.
File metadata
- Download URL: jupyterlab_exam_submission-4.0.0.tar.gz
- Upload date:
- Size: 153.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
940cf23751d7398f658b577704e79b84b86c10e11e6f3c6aed0dd96782e21f39
|
|
| MD5 |
b8914bf9443af09f91adbc5869599e58
|
|
| BLAKE2b-256 |
61a74442e0e1fcc0bc088f8cc32af6a82ace6fd34ec7ed8d96bd4c1be3f12b93
|
File details
Details for the file jupyterlab_exam_submission-4.0.0-py3-none-any.whl.
File metadata
- Download URL: jupyterlab_exam_submission-4.0.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d956efb475646a8c539f060802ad198ecb2c65d35c8e79a069cded2fb85b480a
|
|
| MD5 |
aa81c89aab2079f098033cd315603f9a
|
|
| BLAKE2b-256 |
b371a9b460a569a4f57988e7a2aa1f3c46a114eece95d364aba6eca337690795
|