Skip to main content

The noteable API interface

Project description

papermill-origami

A papermill engine for running Noteable notebooks

CI PyPI - License PyPI - Python Version PyPI Code style: black


Install | Getting Started | License | Code of Conduct | Contributing

Intro to Papermill-Origami

Papermill-Origami is the bridge library between the Origami Noteable SDK and Papermill. It build a papermill engine that can talk to Noteable APIs to run Notebooks.

Requirements

Python 3.8+

Installation

Poetry

poetry add papermill-origami

Pip

pip install papermill-origami

Getting Started

API Token

Get your access token from your User Settings -> API Tokens

or alternatively you can generate a post request to generate a new token

curl -X 'POST' \
  'https://app.noteable.io/gate/api/v1/tokens' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "ttl": 31536000,
  "name": "my_token"
}'

Engine Registration

The noteable engine keyword will use the following environment variables by default:

NOTEABLE_DOMAIN = app.noteable.io
NOTEABLE_TOKEN = MY_TOKEN_VALUE_HERE

Then the engine is enabled by running papermill as normal. But now you have access to the noteable:// scheme as well as the ability to tell papermill to use Noteable as the execution location for your notebook.

import papermill as pm

file_id = '...'

pm.execute_notebook(
    f'noteable://{file_id}',
    None, # Set no particular output notebook, but a log of the resulting exeuction link still prints
    # This turns on the Noteable API interface
    engine_name='noteable', # exclude this kwarg to run the Notebook locally
)

Advanced Setup

For more advanced control or reuse of a NoteableClient SDK object you can use the async await pattern around a client constructor. This reuses the connection throughout the life cycle of the context block.

import papermill as pm
from papermill.iorw import papermill_io
from papermill_origami import ClientConfig, NoteableClient, NoteableHandler 


domain = 'app.noteable.io'
token = MY_TOKEN_VALUE_HERE
file_id = '...'

async with NoteableClient(token, config=ClientConfig(domain=domain)) as client:
    file = await client.get_notebook(file_id)
    papermill_io.register("noteable://", NoteableHandler(client))
    pm.execute_notebook(
        f'noteable://{file_id}',
        None,
        engine_name='noteable',
        # Noteable-specific kwargs
        file=file,
        client=client,
    )

Contributing

See CONTRIBUTING.md.


Open sourced with ❤️ by Noteable for the community.

Boost Data Collaboration with Notebooks

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

papermill_origami-0.0.9.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

papermill_origami-0.0.9-py3-none-any.whl (34.3 kB view details)

Uploaded Python 3

File details

Details for the file papermill_origami-0.0.9.tar.gz.

File metadata

  • Download URL: papermill_origami-0.0.9.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.2 Linux/5.15.0-1022-azure

File hashes

Hashes for papermill_origami-0.0.9.tar.gz
Algorithm Hash digest
SHA256 a918ea84a47f359e2b903770b21936f8dca7e75d95667260c203a5fc6dccd778
MD5 59cd1a5c3f22aba79bab215d265f4ed9
BLAKE2b-256 6e32a69940a5ca2f1d0e6110f6fc13b01cf98c838767ddc5f82f0eb7c75cebe5

See more details on using hashes here.

File details

Details for the file papermill_origami-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: papermill_origami-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 34.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.2 Linux/5.15.0-1022-azure

File hashes

Hashes for papermill_origami-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 9269fc2a064366aaf5de18bfb04efc3c2a4069f19c03d2f69e9b7758cbf1b11e
MD5 b1ede09e63e72b1663b3c4e6e7bf386a
BLAKE2b-256 59623fe700101ea5aeca68c5eb240276835d5c9eb3efb95e8fdb523d355532d7

See more details on using hashes here.

Supported by

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