Skip to main content

Jupyter notebooks runner

Project description

CI Python 3.10 Code style: black Checked with mypy

nbr

NBR lets you run local and remote jupyter-notebooks.

Installation

In a terminal, run:

python3 -m pip install nbr

Usage

Launch a Jupyter server:

jupyter server --ServerApp.token='' --ServerApp.password='' --ServerApp.disable_check_xsrf=True

Execution a local notebook, using a remote server:

import nbr
import nbformat
import asyncio

async def main() -> None:
    nb_file = nbformat.read("Untitled.ipynb", as_version=4)
    
    async with nbr.NotebookRunner(host="127.0.0.1", port=8888) as runner:
        result = await runner.execute(cells=nb_file.cells)
        
        nb_file.cells = result.executed_cells
        nbformat.write(nb_file, "executed_notebook.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-0.0.1b0.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

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