Skip to main content

A tool to generate parameterized Jupyter Notebooks

Project description

https://travis-ci.org/rasmunk/notebook_parameterizer.svg?branch=master https://badge.fury.io/py/notebook-parameterizer.svg

A tool to generate parameterized Jupyter Notebooks. This tool is similar to that of Papermill, but acts as a compliment to parameterize a Notebook not based on a preset cell that contains the parameters, but allows for parameterization throughout a Notebook without having to specify so.

Instead the notebook_parameterizer uses a parameters YAML file to define which variables should be set to what value. With these preset variables in the parameters file, the notebook_parameterizer searches every cell for variable assignments that match the given key in the parameters file.

Usage

An example of how to use the notebook_parameterizer can be seen below:

$ notebook_parameterizer -h
Usage: notebook_parameterizer [OPTIONS] NOTEBOOK_PATH PARAMETERS_PATH

Options:
-o, --output_notebook_path TEXT
                                Path to the parameterized output notebook
-e, --expand_env_values         Should ENV_ prefixed parameter values be
                                expanded to their matching OS environment
                                variable value

-h, --help                      Show this message and exit.

The NOTEBOOK_PATH is the path to the Notebook that should be parameterized.

The PARAMETERS_PATH is the path to the YAML file that contains the variables that should be parameterized.

For instance, given the following Notebook in example/notebooks/hello_world.ipynb.

res/hello_world.png

We can paramterize the Notebook with the example/parameters/hello_world.yml parameters file:

num: 1000
div_by: 4

This is achived by executing the following command:

$ notebook_parameterizer example/notebooks/hello_world.ipynb \
 example/parameters/hello_world.yml \
 -o new_hello_world.ipynb

After applying the notebook_parameterizer, the generated new_hello_world.ipynb Notebook has the following content.

res/parameterized_hello_world.png

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

notebook_parameterizer-0.0.4.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

notebook_parameterizer-0.0.4-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file notebook_parameterizer-0.0.4.tar.gz.

File metadata

  • Download URL: notebook_parameterizer-0.0.4.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.7

File hashes

Hashes for notebook_parameterizer-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8d0cdd53466218364b48c55b6d24963dc7591d7be894deb869f62d80cf861e95
MD5 6bbb1dac6c4884cb6752826c230e4f2c
BLAKE2b-256 3f6f4ec54495daecd9c3bb2b4490127ee1b489875dd6c7b62f4abbe4bf7d7e49

See more details on using hashes here.

File details

Details for the file notebook_parameterizer-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: notebook_parameterizer-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.7

File hashes

Hashes for notebook_parameterizer-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fe5a9894ae5acb610f4aa7be83229aef7853f17c4ae2dfca488c1f4ef9e5d369
MD5 dcb36bf6c2375e890ccd761cc6f36405
BLAKE2b-256 ede09ceb73aa30e01319d63af67ac9cb5ef5d032c5d5957c4f96622f2562e451

See more details on using hashes here.

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