A JupyterLab extension for colouring notebook cell backgrounds.
Project description
jupyterlab_empinken_extension
A JupyterLab extension for colouring notebook cell backgrounds.
Builds on jupyterlab-celltagsclasses
and earlier versions of jupyterlab_empinken_extension
.
The buttons set tags on selected cells and the cell is styled correspondingly.
In v0.6.x:
- book /
book-open-outline
icon: "activity" [maps tostyle-activity
cell tag], by default, a blue background; used to idnetify activity blockls (follows OU VLE theme); - tick /
check
icon: "solution" [maps tostyle-solution
cell tag], by default, a green background; used to identify solution cells; - head/mortarboard ("scholar") /
school-outline
icon: "learner" [maps to cell tagstyle-learner
], by default, a yellow background; used as a nudge to students ("you should edit / add content to this cell"); - quote /
format-quote-close
icon: "tutor" [maps to cell tagstyle-tutor
], by default, a pink background; used by tutors to highlight feedback cells; used by editors/critical readers to highlight feedback cells to authors.
Icons from Material Design Icons
Any old style tags (style-student
rather than style-learner
, style-commentate
rather than style-tutor
) will be lazily updated as and when an empinken button is clicked on a cell tagged in the old style.
In 0.5.6
:
A
: "activity" [maps tostyle-activity
cell tag], by default, a blue background; used to idnetify activity blockls (follows OU VLE theme);S
: "solution" [maps tostyle-solution
cell tag], by default, a green background; used to identify solution cells;L
: "learner" [maps to cell tagstyle-learner
], by default, a yellow background; used as a nudge to students ("you should edit / add content to this cell");T
: "tutor" [maps to cell tagstyle-tutor
], by default, a pink background; used by tutors to highlight feedback cells; used by editors/critical readers to highlight feedback cells to authors.
Associated tools: in tm351_nb_utils
command lines tools:
- empinken tags updater — updates tags in notebooks to new style (
style-activity
/style-solution
/style-learner
/style-tutor
format):upgrade_empinken_tags NOTEBOOKS_PATH
)
Requirements
- JupyterLab >= 4.0.0
Initial set-up
# Create orphan branch
% git checkout --orphan NEWBRANCH
# Clear old files
git rm -rf .
# Use template to create base extenion
copier copy https://github.com/jupyterlab/extension-template .
Install
To install the extension, execute:
pip install jupyterlab_empinken_extension
Uninstall
To remove the extension, execute:
pip uninstall jupyterlab_empinken_extension
TH BUILD
jlpm build
hatch build
Contributing
Set up environment
cd
into dir and run pipenv install
Each terminal session, cd
into dir and run pipenv shell
.
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_empinken_extension 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
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
Development uninstall
pip uninstall jupyterlab_empinken_extension
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 jupyterlab_empinken_extension
within that folder.
Testing the extension
Frontend tests
This extension is using Jest for JavaScript code testing.
To execute them, execute:
jlpm
jlpm test
Integration tests
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.
Packaging the extension
See RELEASE
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
File details
Details for the file jupyterlab_empinken_extension-0.6.2.tar.gz
.
File metadata
- Download URL: jupyterlab_empinken_extension-0.6.2.tar.gz
- Upload date:
- Size: 817.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f72b65be20092a585262fb809aa1244090b1de180b889c51bfb8964aef7af3ff |
|
MD5 | 90b20db2d58b604beefcf441c69557a2 |
|
BLAKE2b-256 | 4dbeb3599a89fddd32f0df78027db5adb9aa1a12b45040fc75dcc31d5ed5c5f9 |
File details
Details for the file jupyterlab_empinken_extension-0.6.2-py3-none-any.whl
.
File metadata
- Download URL: jupyterlab_empinken_extension-0.6.2-py3-none-any.whl
- Upload date:
- Size: 65.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22bcef2dfa8e630b8e3fe149664e99f018c6799311710668955395e8617d7263 |
|
MD5 | 9ef5d4ee277a2a94c8d0bd6aca2ac786 |
|
BLAKE2b-256 | 5929dc4b729d355ce0fe59c5a70308f6e2fc0ac28765bf2891945b3d9f438c85 |