Load a Jupyter Notebook as a module object.
Project description
nb_as_module
pip install nb_as_module
Load a Jupyter Notebook as a module object.
Examples
from nb_as_module import nb_as_module
my_module = nb_as_module('path/to/notebook.ipynb', name='my_module')
my_module.hello() # where `hello` is a function defined in the notebook.
There is also a helper module for Google Colab.
import nb_as_module.colab
# Mount Google Drive, where Colab notebooks are saved.
# (Note you will be asked permission for access here.)
nb_as_module.colab.mount_drive()
# Get a list of your notebooks:
list_of_notebooks = nb_as_module.colab.list_nbs()
print(list_of_notebooks)
#> ['hello.ipynb', ...]
# Load one of the notebooks in the list, as a module:
hello = as_module('hello.ipynb', 'hello')
# Run a function from the module.
hello.hello()
#> Hello, world.
doc
Put <!--docstring--> at the beggining of markdown cells,
to use them as __doc__
documentation. (If multiple cells are used,
they will be concatenated.)
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
nb_as_module-0.2.1.tar.gz
(4.1 kB
view details)
Built Distribution
File details
Details for the file nb_as_module-0.2.1.tar.gz
.
File metadata
- Download URL: nb_as_module-0.2.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a9f912ea7e83619b4c502141336ab43f713c5dcb311961e9828cd6262786a40 |
|
MD5 | d8b8bb88739731eb3c804b4e32065449 |
|
BLAKE2b-256 | 60e9c1bf85eda31b1e5d9af812d598115da7b2a05b5d59d71e1aaa5bdacc7920 |
File details
Details for the file nb_as_module-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: nb_as_module-0.2.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ec24101cd0458eced0f8c314fed149b8dafb98a90bbf077f70f9fde428a749d |
|
MD5 | cdf7cf2fec312964ea9b9eed790fb5e6 |
|
BLAKE2b-256 | b2023efbaa60c9c9563858c90aeec704bfd63c9ccb269462b8859a56a07bc1f4 |