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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jupyter-inheritance-0.1.0.tar.gz.
File metadata
- Download URL: jupyter-inheritance-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51ed0462c7482a3374f965c3835a7254afca447f789a1777bc33729c0d538962
|
|
| MD5 |
ffe019ae58c8a51fa6920b0efee9608b
|
|
| BLAKE2b-256 |
66b1ab4988ac1dd0da9fde06a311f0d0e5f5c0ad8ef3ee6c8ce8317bf6aa4510
|
File details
Details for the file jupyter_inheritance-0.1.0-py3-none-any.whl.
File metadata
- Download URL: jupyter_inheritance-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4ac7d81cb6eb99ca145901c6ef1e46a975e68224b8bda98b705abc15ff62a41
|
|
| MD5 |
cd32012e851e84546628888e2e57fb6d
|
|
| BLAKE2b-256 |
c2fbaebda62f6f3233fb0016d50ac1e836689457a48b00fa8cc904a34fa21180
|