Skip to main content

Jupyter notebooks runner

Project description

CI codecov Python 3.10 Stable Version License: MIT Checked with mypy

nbr

NBR lets you run local and remote jupyter-notebooks.

Installation

In a terminal, run:

pip install nbr

Usage

Launch a Jupyter server:

jupyter server

Execution a local notebook, using a remote server:

import asyncio
from nbr import NotebookRunner, Notebook, JupyterAPI, ExecutionStatus


async def main() -> None:
    jupyter_api = JupyterAPI()
    notebook = Notebook.read_file(path="Untitled.ipynb")

    async with NotebookRunner(notebook=notebook, jupyter_api=jupyter_api) as runner:
        result = await runner.execute_all_cells()

        if result.status == ExecutionStatus.SUCCESS:
            notebook.save(path="Executed.ipynb")
    
if __name__ == "__main__":
    asyncio.run(main())

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

nbr-1.0.0b0.tar.gz (7.5 kB view hashes)

Uploaded Source

Built Distribution

nbr-1.0.0b0-py3-none-any.whl (9.6 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