Skip to main content

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 client
  • AsyncStorageClient -- 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 results
  • ListPage -- paginated listing
  • Scope -- access scope (use account_scope(), project_scope(), session_scope())

Uploads

  • ResumableUpload / AsyncResumableUpload -- multipart resumable uploads for large files
  • StorageReader / StorageWriter -- streaming read/write

Exceptions

All exceptions inherit from StorageError:

  • AuthorisationError
  • ObjectNotFoundError
  • VersionConflictError
  • AlreadyExistsError
  • LeaseConflictError
  • UploadNotFoundError
  • QuotaExceededError
  • PartMismatchError
  • StorageTransportError

Examples

See the examples/ directory for complete working examples:

  • basic_crud.py -- put, get, list, delete
  • async_client.py -- async usage with asyncio
  • file_upload_download.py -- file uploads with progress
  • optimistic_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

riffsdk-0.8.0.tar.gz (96.5 kB view details)

Uploaded Source

Built Distribution

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

riffsdk-0.8.0-py3-none-any.whl (29.7 kB view details)

Uploaded Python 3

File details

Details for the file riffsdk-0.8.0.tar.gz.

File metadata

  • Download URL: riffsdk-0.8.0.tar.gz
  • Upload date:
  • Size: 96.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for riffsdk-0.8.0.tar.gz
Algorithm Hash digest
SHA256 c19a9d644e5a604982a2799b59c86f53e9efbbae3c79583b0c48b2c72d5d4789
MD5 3bf2c2c73788caf96695d284780f20d3
BLAKE2b-256 ddd20e35b5a6b8d42e87c7d5ecce8b4faa788ed1d4b312f88c484d88d29c3c34

See more details on using hashes here.

Provenance

The following attestation bundles were made for riffsdk-0.8.0.tar.gz:

Publisher: release.yml on databutton/riff-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file riffsdk-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: riffsdk-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 29.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for riffsdk-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2347c55c48d2a5c16023a22f53a1a8aee1414f56fc60bdc5276166f5104b9567
MD5 e7ea594286b2ac3376520d4fe835a085
BLAKE2b-256 dfc0690e80fe16d624b1b24576ba8dcf7ee32ee235ca99205d02de25a5c9966c

See more details on using hashes here.

Provenance

The following attestation bundles were made for riffsdk-0.8.0-py3-none-any.whl:

Publisher: release.yml on databutton/riff-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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