Skip to main content

Rafflesia Python SDK

A typed Python client for the Rafflesia public API, generated from the server's OpenAPI contract by the oagen product generator.

pip install rafflesia-sdk
from rafflesia import Rafflesia

client = Rafflesia(api_key="...")  # or RAFFLESIA_API_KEY env var
databases = client.homology.databases.list()
releases = client.homology.databases.releases.list("tomato")
result = client.homology(
    database="tomato",
    query={
        "kind": "protein_sequence",
        "sequence": "MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQ",
    },
)
batch = client.homology_many(
    database_release_id=releases.data[0].id,
    queries=[
        {"kind": "protein_sequence", "sequence": "MTEYK"},
        {"kind": "protein_sequence", "sequence": "GAGGVGKS"},
    ],
    include=[],
    limit=100,
)

Async:

from rafflesia import AsyncRafflesia

async with AsyncRafflesia(api_key="...") as client:
    result = await client.homology(
        database="tomato",
        query={"kind": "protein_sequence", "sequence": "MTEYK"},
    )
    batch = await client.homology_many(
        database="tomato",
        queries=[
            {"kind": "protein_sequence", "sequence": "MTEYK"},
            {"kind": "protein_sequence", "sequence": "GAGGVGKS"},
        ],
    )

Runs

run() and submit() create the same durable request. run() waits for its result; submit() returns a handle immediately. Once accepted, request_id is the only value needed to recover, inspect, fetch, or cancel the run.

result = client.run("meta-ai/esm2/650m", {"sequences": ["MTEYK"]})

handle = client.submit(
    "meta-ai/esm2/650m",
    {"sequences": ["MTEYK"]},
    start_timeout=30,
)
status = client.status(handle.request_id, with_logs=True)
result = client.result(handle.request_id)
client.cancel(handle.request_id)

# Recover the same durable handle in another process.
handle = client.get_handle(handle.request_id)

A local wait timeout does not cancel accepted work. Raw webhook URLs are not accepted; register a webhook endpoint and pass its ID when submitting.

File-bearing model fields use managed URLs. The high-level storage helpers use a one-shot upload through 10 MiB, then switch to resumable direct-to-bucket multipart transfer without retaining the complete file in memory:

url = client.storage.upload_file(
    "structure.cif",
    content_type="chemical/x-mmcif",
    lifecycle={
        "expires_in": "30d",
        "initial_acl": {
            "default": "forbid",
            "rules": [{"user": "user_123", "decision": "allow"}],
        },
    },
)
raw_url = client.storage.upload(b"bytes", "application/octet-stream")
image_url = client.storage.upload_image(image, file_name="preview.jpg")

AsyncRafflesia exposes the same three helpers as coroutines. The generated one-request operation remains available as storage.upload_raw(...) when the full response envelope is needed.

base_url defaults to https://api.rafflesia.ai (override via the base_url argument or RAFFLESIA_API_BASE_URL). When no API key is configured the client sends anonymous requests, which is convenient against a local unauthenticated server.

Layout

  • rafflesia/resources/, rafflesia/types/generated from the OpenAPI contract; do not edit by hand. Regenerate with factory/generators/oagen/retab-gennode scripts/generate-product.mjs python.
  • rafflesia/client.py, rafflesia/_resource.py, rafflesia/exceptions.py, rafflesia/utils/ — hand-written runtime the emitter reuses; kept stable across regeneration (the emitter only prunes files it previously generated).

Download files

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

Source Distribution

rafflesia_sdk-0.2.1.tar.gz (106.2 kB view details)

Uploaded Source

Built Distribution

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

rafflesia_sdk-0.2.1-py3-none-any.whl (119.0 kB view details)

Uploaded Python 3

File details

Details for the file rafflesia_sdk-0.2.1.tar.gz.

File metadata

  • Download URL: rafflesia_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 106.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rafflesia_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ac006e78f83377f77595252c99c54eb71d85ddfae5a6d9100e2b65d27a75e7a9
MD5 817eae9f7a130a4373a2fe66dd314e72
BLAKE2b-256 dd82b5bd4ff12e62a6c6b0eea238e639d6d4dc7186b063005f5d2abaf2b0b693

See more details on using hashes here.

File details

Details for the file rafflesia_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: rafflesia_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 119.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rafflesia_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a155b972991805918b97cc9284390b3ec1e6bdf2cc1dd930758c7db892c4aae
MD5 96d61748ff56ddec13688e42391fa6ba
BLAKE2b-256 c6e8c5eed42b3aa9dced47fcdf00635ed264abf577353b72c3ee06eb924ce3bb

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page