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.0a3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3f6b3fbd8014d6aa73152872ddf1e8c712388216072f277d87dd8c32ea2d24a |
|
MD5 | f736310f83e32a29e3dedb6864c5e591 |
|
BLAKE2b-256 | 9024e2211d300cc6904d3118e421e00655450411853a34af8dd5aae66cdbd528 |