Python SDK for the Riff Storage API
Project description
riffsdk
Python SDK for the Riff Storage API. Provides sync and async clients for storing, retrieving, and managing objects.
Installation
uv add riffsdk
# or
pip install riffsdk
Or install from a branch (for pre-release testing):
uv add git+https://github.com/databutton/riff-sdk-python.git@main
# or
pip install git+https://github.com/databutton/riff-sdk-python.git@main
Quick start
from riffsdk.storage import StorageClient
client = StorageClient()
# Upload
meta = client.put("hello.txt", "Hello, world!")
# Download
data = client.get("hello.txt")
# List
for obj in client.list("hello"):
print(f"{obj.key} ({obj.size} bytes)")
# Delete
client.delete("hello.txt")
client.close()
Async
from riffsdk.storage import AsyncStorageClient
async with AsyncStorageClient() as client:
await client.put("key", b"data", content_type="application/octet-stream")
data = await client.get("key")
Authentication
Set the RIFF_TOKEN environment variable. The SDK picks it up automatically.
API
Clients
StorageClient-- sync clientAsyncStorageClient-- async client
Both support: put, get, stat, exists, list, delete, close, and context manager usage.
Models
ObjectMeta-- metadata for a stored object (key, version, size, content_type, timestamps)UploadResult,DownloadResult-- operation resultsListPage-- paginated listingScope-- access scope (useaccount_scope(),project_scope(),session_scope())
Uploads
ResumableUpload/AsyncResumableUpload-- multipart resumable uploads for large filesStorageReader/StorageWriter-- streaming read/write
Exceptions
All exceptions inherit from StorageError:
AuthorisationErrorObjectNotFoundErrorVersionConflictErrorAlreadyExistsErrorLeaseConflictErrorUploadNotFoundErrorQuotaExceededErrorPartMismatchErrorStorageTransportError
Examples
See the examples/ directory for complete working examples:
basic_crud.py-- put, get, list, deleteasync_client.py-- async usage with asynciofile_upload_download.py-- file uploads with progressoptimistic_concurrency.py-- version-based conflict handling
Development
Requires Python 3.11+ and uv.
uv sync --dev # Install dependencies
mise run test # Run tests
mise run lint # Lint
mise run format # Format code
See AGENTS.md for full development workflow details.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file riffsdk-0.11.0.tar.gz.
File metadata
- Download URL: riffsdk-0.11.0.tar.gz
- Upload date:
- Size: 99.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
471ed49845a663665dbae580aba10caff4e1067dadaa40b2f2806dd6a2313c51
|
|
| MD5 |
6099f9bd3725cf767c0f9b06ed5b5d00
|
|
| BLAKE2b-256 |
43a00cadb9d24af26773184046b9d17b3ff006ae94a592d87cdf5da2dbdc1f4f
|
Provenance
The following attestation bundles were made for riffsdk-0.11.0.tar.gz:
Publisher:
release.yml on databutton/riff-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
riffsdk-0.11.0.tar.gz -
Subject digest:
471ed49845a663665dbae580aba10caff4e1067dadaa40b2f2806dd6a2313c51 - Sigstore transparency entry: 1804790279
- Sigstore integration time:
-
Permalink:
databutton/riff-sdk-python@76ff6b3241abb2f86efbcb725c764f31d754b6e1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/databutton
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@76ff6b3241abb2f86efbcb725c764f31d754b6e1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file riffsdk-0.11.0-py3-none-any.whl.
File metadata
- Download URL: riffsdk-0.11.0-py3-none-any.whl
- Upload date:
- Size: 31.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d697b60cf166a18832737cb42c3b250051419dcdc1863c2241a08a976863f78
|
|
| MD5 |
704d22037f44b0b413ef062a56901f51
|
|
| BLAKE2b-256 |
df53d25ae6b21cb6174d11bb8b37e9031523325bf82e87050f4fb68181bda82f
|
Provenance
The following attestation bundles were made for riffsdk-0.11.0-py3-none-any.whl:
Publisher:
release.yml on databutton/riff-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
riffsdk-0.11.0-py3-none-any.whl -
Subject digest:
3d697b60cf166a18832737cb42c3b250051419dcdc1863c2241a08a976863f78 - Sigstore transparency entry: 1804790308
- Sigstore integration time:
-
Permalink:
databutton/riff-sdk-python@76ff6b3241abb2f86efbcb725c764f31d754b6e1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/databutton
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@76ff6b3241abb2f86efbcb725c764f31d754b6e1 -
Trigger Event:
push
-
Statement type: