Skip to main content

A python package that allows importing Jupyter notebooks as python modules

Project description

Jupyter notebooks module loader

Allows to import Jupyter notebooks as if there were regular python modules.

The code is based on the following example from Jupyter's documentation:
https://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Importing%20Notebooks.html

Installation

pip install jupyter-module-loader

Usage

Suppose a project has the following files structure:

src/
├── main.py
└── my_notebook.ipynb

Let my_notebook.ipynb have a cell containing following code:

    def fn():
        ...

Within main.py it is possible to import my_notebook.ipynb like so:

    import jupyter_module_loader
    jupyter_module_loader.register()

    import my_notebook
    my_notebook.fn() # Calls fn() defined within the notebook above

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

jupyter-module-loader-0.0.1.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

jupyter_module_loader-0.0.1-py3-none-any.whl (8.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page