Skip to main content

No project description provided

Project description

Streambook

Python notebooks without compromises.

  • Write your code in any editor (emacs, vi, vscode)
  • Use standard tools (git, black, lint, pytest)
  • Export to standard Jupyter format for collaboration

Quick start

Install:

pip install streambook

Run streambook on a Python file. For the example notebook included:

pip install matplotlib
streambook run example.py

The output should look like this streambook.

Editing your file example.py should automatically update the viewer.

When you are done and ready to export to a notebook run:

streambook convert example.py

This produces a standard notebook.

How does this work?

Streambook is a simple library (< 50 lines!) that hooks together Streamlit + Jupytext + Watchdog.

  • Streamlit - Live updating webview with an advanced caching system
  • Jupytext - Bidirectional bridge between plaintext and jupyter format
  • Watchdog - File watching in python

Is this fast enough?

image

A "benefit" of using notebooks is being able to keep data cached in memory, at the cost of often forgetting how it was created and in what order.

Streambook instead reruns your notebook from the top whenever the file is changed. Typically this is pretty fast for writing demos or quick notebooks.

However this can be very slow for long running ML applications, particularly for users used to standard notebooks. In order to circumvent this issue there are two tricks.

  1. You can divide your notebook us into sections. This allows you to edit individual parts of the notebook.
streambook run --section "Main" example.py
  1. You can write functions and add caching.

Streamlit's caching API to makes it pretty easy in most use case. See https://docs.streamlit.io/en/stable/caching.html for docs.

An example is given in the notebook.

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

streambook-0.3.tar.gz (6.7 kB view hashes)

Uploaded Source

Built Distribution

streambook-0.3-py3-none-any.whl (7.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