Skip to main content

A tool to merge / concatenate Jupyter (IPython) notebooks

Project description

https://travis-ci.org/jbn/nbmerge.svg?branch=master https://coveralls.io/repos/github/jbn/nbmerge/badge.svg?branch=master https://img.shields.io/pypi/dm/nbmerge.svg https://img.shields.io/pypi/v/nbmerge.svg https://img.shields.io/badge/license-MIT-blue.svg https://img.shields.io/pypi/pyversions/nbmerge.svg

nbmerge: merge / concatenate Jupyter notebooks

Installation

pip install nbmerge

Usage

nbmerge file_1.ipynb file_2.ipynb file_3.ipynb > merged.ipynb

Lineage

@fperez wrote an nbmerge.py script which “Merge[s]/concatenate[s] multiple IPython notebooks into one.” I use it a lot. Evidently, other people do, too. In early 2016, he opened an issue to add the script as an nbconvert tool, but nothing came of it. However, he and @Carreau came up with good (i.e. unsurprising) semantics for metadata merging and notebook naming:

metadata = {}
for n in reversed(notebooks):
    metadata.update(n.metadata)

I don’t think it’s possible to implement the merger as a preprocessor. Preprocessors are stateless, so you can’t implement a reduce operation. Instead, I wrote (er, packaged up) this library as an nbstripoutput-like package . It fits in a Makefile script just fine.

Right now, only the basic (originally fperez’s) functionality is implemented. However, I’m going to follow kynan’s lead and slowly pull in functionality similar to his nbstripout package.

Project details


Download files

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

Files for nbmerge, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size nbmerge-0.0.1.tar.gz (5.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page