Inherit from Jupyter kernels
Project description
Jupyter Inheritance
Inherit Jupyter Kernels
You have a notebook base.ipynb
with a cell
import os
from datetime import datetime
class Test:
msg = "Hey!"
def add(x, y):
return x + y
test = Test()
now = datetime.now()
that has been executed. You can create a new notebook and run the following code:
from jupyter_inheritance import inherit_from
inherit_from("base.ipynb")
assert add(1, 4) == 5
assert isinstance(test, Test)
print(test.msg)
print(now) # same value as `now` in `base.ipynb`!
print(os.listdir("."))
The base.ipynb
content is not executed from scratch in the new notebook,
all the existing objects are copied directly from base.ipynb
kernel. This
ensures that everything stays exactly the same (e.g. timestamps, random numbers,
responses from externals APIs).
You can even do mixins!
from jupyter_inheritance import inherit_from
for notebook in ("base_1.ipynb", "base_2.ipynb"):
inherit_from(notebook)
Installation
Just the usual
pip install jupyter-inheritance
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for jupyter-inheritance-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51ed0462c7482a3374f965c3835a7254afca447f789a1777bc33729c0d538962 |
|
MD5 | ffe019ae58c8a51fa6920b0efee9608b |
|
BLAKE2b-256 | 66b1ab4988ac1dd0da9fde06a311f0d0e5f5c0ad8ef3ee6c8ce8317bf6aa4510 |
Close
Hashes for jupyter_inheritance-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4ac7d81cb6eb99ca145901c6ef1e46a975e68224b8bda98b705abc15ff62a41 |
|
MD5 | cd32012e851e84546628888e2e57fb6d |
|
BLAKE2b-256 | c2fbaebda62f6f3233fb0016d50ac1e836689457a48b00fa8cc904a34fa21180 |