Skip to main content

A JupyterLab extension that will listen for code cell changes and run if ending in dot (`.`).

Project description

nbdotrun

Github Actions Status

A JupyterLab extension that will listen for code cell changes and run if ending in dot (.) by default, or any other configured trigger symbol.

shift-enter to run a code cell is just as fast as enter ., so why use this?

It's mostly to support my own workflow. I use Jupytext with its paired notebooks feature enabled. Jupytext allows you to edit your text-only files (e.g. .py or .md) as though they were notebook files (json structured in the .ipynb format). It lets you do this in JupyterLab itself, giving you a standard notebook interface even though underneath there is a simple text file. However I don't like editing in JupyterLab. Instead, I like to have the JupyterLab interface open to view rich outputs like images and interactive plots, and to tinker with widgets. The actual writing of cells however, I prefer to do in a text editor. Jupytext syncs changes I make in the text editor to the notebook (without needing to reload due to the wonderful jupyter-collaboration extension). Sometimes I want the cell I edited in the text editor to also run in JupyterLab so that I can see the output. I want to do this without having to switch over from the text editor to JupyterLab, going to the edited cell, and running it manually. So instead I just put . at the last line of the edited cell in the text editor, and have it run automatically.

Requirements

  • JupyterLab >= 4.0.0

Install

To install the extension, execute:

pip install nbdotrun

Uninstall

To remove the extension, execute:

pip uninstall nbdotrun

Contributing

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 nbdotrun 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

Development uninstall

pip uninstall nbdotrun

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 nbdotrun within that folder.

Packaging the extension

See RELEASE

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

nbdotrun-0.1.1.tar.gz (107.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nbdotrun-0.1.1-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file nbdotrun-0.1.1.tar.gz.

File metadata

  • Download URL: nbdotrun-0.1.1.tar.gz
  • Upload date:
  • Size: 107.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for nbdotrun-0.1.1.tar.gz
Algorithm Hash digest
SHA256 023760e73468360b1c4dd94a3e66fe86ccd76ff582fe86737f26e292b9e1bbb4
MD5 edc430daea686d6d847ad9142a75290f
BLAKE2b-256 aa313cfacbaccc1dea7c0da8ea2eb44ba729012b1718249e6e30cd09ea9ca0ab

See more details on using hashes here.

File details

Details for the file nbdotrun-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nbdotrun-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for nbdotrun-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9cdc8a451a3a7a923831f40aa8638536b7340dd4ddc2e1aa54c977fda9d3ed34
MD5 6abeaa62824b235961a8976936fe2fa2
BLAKE2b-256 fd0914abaf3b7f71575dfe40d6fb782a86bb2473cd740b63744f472219a77699

See more details on using hashes here.

Supported by

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