Skip to main content

Unix commands for Jupyter notebooks.

Project description

nbcommands

image image image image

nbcommands bring the goodness of Unix commands to Jupyter notebooks.

Installation

You can simply use pip to install nbcommands:

$ pip install nbcommands

or conda:

$ conda install -c conda-forge nbcommands

Usage

nbcommands installs the following commands which let you interact with your Jupyter notebooks without spinning up a notebook server.

  • nbtouch: Update the access and modification times of each Jupyter notebook to the current time.

      $ nbtouch notebook1.ipynb notebook2.ipynb

    nbtouch

  • nbgrep: Search for a pattern in Jupyter notebooks.

      $ nbgrep "os" notebook1.ipynb notebook2.ipynb

    nbgrep

  • nbhead: Print the first 5 cells of a Jupyter notebook to standard output.

      $ nbhead notebook1.ipynb

    nbhead

    Note: You can also specify the number of cells you want to print using the -n option.

      $ nbhead -n 10 notebook1.ipynb
  • nbtail: Print the last 5 cells of a Jupyter notebook to standard output.

      $ nbtail notebook2.ipynb

    nbtail

    Note: You can also specify the number of cells you want to print using the -n option.

      $ nbtail -n 10 notebook2.ipynb
  • nbcat: Concatenate Jupyter notebooks to standard output.

      $ nbcat notebook1.ipynb notebook2.ipynb

    nbcat

    Note: You can create a new notebook by concatenating multiple notebooks using the -o option.

      $ nbcat notebook1.ipynb notebook2.ipynb -o notebook3.ipynb
  • nbless: Print a Jupyter notebook using a pager program.

      $ nbless notebook1.ipynb

    nbless

And some non-Unix goodness,

  • nbblack: Blacken Jupyter notebooks.

      $ nbblack notebook1.ipynb notebook2.ipynb

    nbblack


Planned enhancements:

  • nbstrip: Strip outputs from Jupyter notebooks.
  • nbdiff: Find the diff between two Jupyter notebooks.
  • nbecho: Add a code cell to a Jupyter notebook.
  • nbedit: Interactively edit a Jupyter notebook.
  • nbtime: Run and time a Jupyter notebook.
  • nbwc: Print word count for a Jupyter notebook.

Versioning

nbcommands uses Semantic Versioning. For the available versions, see the tags on this repository.

License

This project is licensed under the Apache License, see the LICENSE file for details.

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

nbcommands-0.4.0.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

nbcommands-0.4.0-py3-none-any.whl (12.6 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