JuBox
Programmatical Jupyter Notebook API for humans
Jupyter Notebook extension, Python 3, Easy to use
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
- Mikael Koli - Miksus - koli.mikael@gmail.com
License
Metadata
Release files for JuBox 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| JuBox-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / JuBox-0.4.0-py3-none-any.whl
| Download URL | JuBox-0.4.0-py3-none-any.whl |
|---|---|
| Size | 55.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec05708e634c93450376e1c14b8226ddcd84e820ce98afb77a6e257e8e68964d
|
|
BLAKE2b-256 checksum How to use checksums |
499aae6be248eb31dd2e9a049963ee13b9eef8348997781deba491177fc99c96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|