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 withfactory/generators/oagen/retab-gen→node 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).
Metadata
Release files for rafflesia-sdk 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rafflesia_sdk-0.2.1.tar.gz | 106.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rafflesia_sdk-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 225.3 kB
Release files / rafflesia_sdk-0.2.1.tar.gz
| Download URL | rafflesia_sdk-0.2.1.tar.gz |
|---|---|
| Size | 106.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac006e78f83377f77595252c99c54eb71d85ddfae5a6d9100e2b65d27a75e7a9
|
|
BLAKE2b-256 checksum How to use checksums |
dd82b5bd4ff12e62a6c6b0eea238e639d6d4dc7186b063005f5d2abaf2b0b693
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / rafflesia_sdk-0.2.1-py3-none-any.whl
| Download URL | rafflesia_sdk-0.2.1-py3-none-any.whl |
|---|---|
| Size | 119.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a155b972991805918b97cc9284390b3ec1e6bdf2cc1dd930758c7db892c4aae
|
|
BLAKE2b-256 checksum How to use checksums |
c6e8c5eed42b3aa9dced47fcdf00635ed264abf577353b72c3ee06eb924ce3bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|