Skip to main content

Set Jupyter notebook cell tags from a special comment

Project description

nbtag

Set cell tags in a Jupyter notebook from a special comment.

Why use this extension?

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.

How to use

# %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.

Install

pip install nbtag

If you use pipx, make sure to inject nbtag into the Jupyter package's environment.

Enable

jupyter serverextension enable nbtag

jupyter serverextension list

Compatibility

Only works with jupyter server, not with jupyter notebook, but I think you should be using jupyter server + nbclassic instead of jupyter notebook anyway?

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nbtag-0.0.1.tar.gz (2.2 kB view hashes)

Uploaded Source

Built Distribution

nbtag-0.0.1-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page