Skip to main content

The Noteable API interface

Project description

Origami


Launch, edit, and share Jupyter notebooks in automation.

CI codecov code coverage PyPI - License PyPI - Python Version PyPI Code style: black


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

Intro to Origami

Origami is a 🐍 Python library for talking to Noteable notebooks. This is the official way to access the full breadth of API calls and access patterns in async Python for rich programmatic access to notebooks. You can use Noteable for free with a quick signup.

Requirements

Python 3.8+

Installation

For stable release:

pip install noteable-origami
poetry add noteable-origami

For alpha pre-release:

pip install noteable-origami --pre

Getting Started

Warning Developer note: this documentation is written for the 1.0 alpha release. For stable release, see pre-1.0 README

API Tokens

The Noteable API requires an authentication token. You can manage tokens at the Noteable user settings page.

  1. Log in to Noteable (sign up is free)
  2. In the User Settings tab, navigate to API Tokens and generate a new token

Usage

The example below shows how to create a Notebook, launch a Kernel, add new cells, and execute code.

# Grab a project_id from the Noteable UI, the url will look like: app.noteable.io/p/....
api_token = '...'

# Client for interacting with Noteables REST API
from origami.clients.api import APIClient
api_client = APIClient(api_token)

# Sanity check your user information
user = await api_client.user_info()

# Choose a project to create the notebook in, here using the ChatGPT plugin default project
project_id = user.origamist_default_project_id

# Create a new Notebook
file = await api_client.create_notebook(project_id=project_id, path="Demo.ipynb")

# Start a Kernel
await api_client.launch_kernel(file.id)

# Client for Real-time Updates (RTU), used with Notebooks
realtime_notebook = await api_client.connect_realtime(file)

# Add a new cell
from origami.models.notebook import CodeCell
cell = CodeCell(source="print('Hello World')")
await realtime_notebook.add_cell(cell)

# Execute the cell
queued_execution = await realtime_notebook.queue_execution(cell.id)

# Wait for the execution to be complete, cell is an updated instance of CodeCell with metadata/outputs
cell = await queued_execution

# Grab the output
output_collection = await api_client.get_output_collection(cell.output_collection_id)
print(output_collection.outputs[0].content.raw) # 'Hello World\n'

1.0 Roadmap

Origami is heading towards a 1.0 release. The alpha release candidate is on Pypi now, installable with a --pre flag. The 1.0 release represents a major refactor of the Origami using the best practices and lessons learned from creating multiple production API and RTU clients, including our ChatGPT plugin. It will likely come out of alpha once all of our internal applications are using the Origami 1.0 syntax.

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

noteable_origami-1.0.0a3.tar.gz (33.2 kB view hashes)

Uploaded Source

Built Distribution

noteable_origami-1.0.0a3-py3-none-any.whl (41.1 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