Skip to main content

Jupyter Notebook Application Builder

Project description

PyPI Version Anaconda-Server Badge Tests Tests

Coverage badge2

Introduction

nbappinator's goal is to make interactive Jupyter apps easier to develop and maintain, and reduce the learning curve involved with building & deploying Voila applications.

nbappinator provides an opinionated model for adding apps consisting of interaction widgets, such as buttons and dropdowns, along with display widgets including charts and grid / dataframe rendering.

A secondary goal is to make it easy to swap UI extensions, support different deployment environments, and insulate the developer from implementation decisions relating to web technologies.

By creating a TabbedUiModel, you can easily add new display widgets to each page/tab, and set interactions as function calls for each action.

Foundation

nbappinator builds on a few great projects that provide useful building blocks in Jupyter, which themselves build on other great web technologies. Yet, nbappinator is intended to be implementation agnostic - a core goal is to allow any of these components to be swapped out.

  • ipyvuetify: Provides the underlying UI widgets, bringing modern VUE components to Jupyter.
  • ipyaggrid: Wraps the excellent AG Grid javascript grid library. AG Grid provides some great enterprise features too.
  • ipytree: A tree widget for Jupyter

Plotly is given first class support, although any matplotlib charting library works too, such as Seaborn.

This all builds on Jupyter and ipywidgets, of course.

Getting Started

import nbappinator as nbapp

def my_action(component, action, args, app: nbapp.UiModel, caller: str):
    with app.messages:
        print("This message will be written to the Messages footer")
        app.get_page(0).add_textstatic("This is some text")

def choose_action(component, action, args, app: nbapp.UiModel, caller: str):
    with app.messages:
        chosen_value = app.get_values(caller)
        print(f"You chose {chosen_value}")
        app.get_page(1).add_textstatic(f"You chose {chosen_value}")

# Create a Tabbed UI comprised of three sections:
# "Config" Header,  Tabbed Pages: "First Tab" and "Second Tab", and a "Messages" Footer
myapp = nbapp.TabbedUiModel(pages=["First Tab", "Second Tab"], log_footer = "Messages", headers=["Config"])
myapp.get_page("Config").add_textstatic("This is some static text in the Config section of the page. You could add global settings, buttons and other widgets here.")

# Add a button to First Tab
myapp.get_page(0).add_button(name="but1", label="Some button", action=my_action)
myapp.get_page(0).add_textstatic("Click the button")

# Add a dropdown selection to Second Tab
myapp.get_page(1).add_select(name="choose1", label="Choose A Number", options=list(range(10)), action=choose_action)

# Render the app:
myapp.display()

Testing Notes

A significant portion of the tests are Notebook smoketests designed to exercise the code base in its entirety.

The coverage report primarily reflects the percentage of the code base that the Notebooks exercise: but manual verification of the Notebook behavior is still required.

Some assertions are baked into the Notebooks, but largely its intended to ensure that all the features are exercised.

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

nbappinator-0.1.3.tar.gz (18.1 kB view hashes)

Uploaded Source

Built Distribution

nbappinator-0.1.3-py3-none-any.whl (16.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