Set cell tags in a Jupyter notebook from a special comment.
Many tools in the Jupyter ecosystem (ex. nbmake, nbstripout) use cell tags to configure their behavior.
However, some frontends to Jupyter (ex. ein) can't modify tags.
This server extension watches for a special comment in the content of the cell and sets tags correspondingly.
# %tags: keep_output, another_tag
print("Hello World!")
A cell containing the text above will be given the tags keep_output
,
another_tag
on saving.
pip install nbtag
If you use pipx
, make sure to inject nbtag
into the Jupyter package's
environment.
jupyter serverextension enable nbtag
jupyter serverextension list
Only works with jupyter server
, not with jupyter notebook
, but I think you
should be using jupyter server
+ nbclassic
instead of jupyter notebook
anyway?