Skip to main content

nb_as_module

pip install nb_as_module

Load a Jupyter Notebook as a module object.

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.

Google Colab

There is also a helper module for Google Colab.

To install in Google Colab, run in a cell: !pip install nb_as_module

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 = nb_as_module.colab.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.)

Metadata

Release files for nb-as-module 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nb-as-module 0.2.2
File Size Uploaded Provenance
nb_as_module-0.2.2.tar.gz 4.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nb-as-module 0.2.2
File Interpreter ABI Platform
nb_as_module-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / nb_as_module-0.2.2.tar.gz

Download URL nb_as_module-0.2.2.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
74cdf1cd77d4b32784cddda4df99818c1a839490be4784eee9a24da502dd9346
BLAKE2b-256 checksum
How to use checksums
b6873b410efb4b0f97c395f74525c67a765d7c6ebc13eca16db2e607c958ba45
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / nb_as_module-0.2.2-py3-none-any.whl

Download URL nb_as_module-0.2.2-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88641a6b437243bbdb7ec31c4984b1d963d25d3d54419f15bdb16b00b3cb697f
BLAKE2b-256 checksum
How to use checksums
6866f93255383f7829654a575f3b2fe9f9c895e940228d2cb25c5073ab1f7bc8
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for nb-as-module 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page