Skip to main content

Object oriented interface to Jupyter Notebook

Project description

JuBox

Build Status

Programmatical Jupyter Notebook API for humans

Jupyter Notebook extension, Python 3, Easy to use


Example

What?

  • Pythonic approach to load, modify, run and save Jupyter Notebooks in Python code
  • This enables to quickly and easily create:
    • Parametrized notebooks
    • Version controlable notebooks directly from inserted code snippets, Python files or even straight from Python functions and classes.
    • Notebooks with code generated markdown

Installation

  • Pip install from pip
pip install jubox
  • Clone the source code and pip install:
git clone https://github.com/Miksus/jubox.git
cd jubox
pip install -e .

Example

See demo or cook book for detailed examples.

from jubox import JupyterNotebook, CodeCell

# Load jupyter Notebook
nb = JupyterNotebook("my_file.ipynb")
nb.load()

# Run the notebook
# by making a copy (output is lost if raised exception)
nb_runned = nb()

# or in place (maintains exceptions in the notebook)
nb(inplace=True)


# save the file to the original file
nb.save()
# or to new file
nb.to_ipynb("run_notebook.ipynb")


# Get cells with specific tags
param_cells = nb.cells.get(tags=["parametrized"])

# Rewrite the first tagged cell with dict of parameters
new_cell = CodeCell.from_variable_dict(run_date="2020-01-01", category="blue")
param_cells[0].overwrite(new_cell)

Features

  • Convenient object oriented API for Jupyter Notebooks.
  • API includes:
    • Load, save and run notebooks in Python
    • Conveniently select specific cells using tags, source, regex or the type
    • Conveniently select specific outputs of a cell and render it to HTML or plain text
    • Render Jupyter Notebooks in a Jupyter Notebook!

Test

Pytest was chosen as testing suites. Tests are found in test directory inside the source.


Author


License

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

JuBox-0.4.0-py3-none-any.whl (55.8 kB view details)

Uploaded Python 3

File details

Details for the file JuBox-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: JuBox-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 55.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.2.0.post20200511 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.6

File hashes

Hashes for JuBox-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec05708e634c93450376e1c14b8226ddcd84e820ce98afb77a6e257e8e68964d
MD5 89806a53ba5a773d696f3ccd164023fd
BLAKE2b-256 499aae6be248eb31dd2e9a049963ee13b9eef8348997781deba491177fc99c96

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