The Noteable API interface
Project description
Origami
Launch, edit, and share Jupyter notebooks in automation.
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.
- Log in to Noteable (sign up is free)
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for noteable_origami-1.0.0a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3d068c00c81b739421aca693d5e064eab4e2b1e1dbe629739fbf69786aa5b06 |
|
MD5 | 34272ce45fdee4fb9788be6a77298ef7 |
|
BLAKE2b-256 | 0b9f6976bd4f99ab985ee9b0c3ad1fd8ba515f362d1ec2859f0e26f217a85564 |