Python client for the Nanorix API — sealed processing with cryptographic destruction proofs
Project description
Nanorix Python SDK
Sealed processing with cryptographic destruction proofs.
Installation
pip install nanorix
Quick Start
import nanorix
client = nanorix.Client(api_key="nrx_live_...")
# Create a template (one-time setup)
template = client.templates.create(
name="patient-risk-scorer",
runtime="python3.11",
entrypoint="python model.py",
files=["model.py", "requirements.txt"],
)
client.templates.wait_until_ready(template.id)
# Process data — capsule auto-destroyed after completion
outputs, cdp = client.capsules.run(
template=template.id,
inputs={"patient.csv": open("patient.csv", "rb")},
)
# The proof
print(cdp.verify_url) # https://nanorix.io/verify/cap_...
Workspace Mode
For multi-step workflows with full control:
capsule = client.capsules.start(template="tmpl_...")
capsule.upload("patient.csv", data)
capsule.execute("python preprocess.py")
capsule.execute("python model.py")
prediction = capsule.download("prediction.json")
cdp = capsule.destroy()
# Share the proof with auditors
verification = cdp.verification()
CDP Access
Every destroyed capsule produces a Cryptographic Destruction Proof:
# Full CDP — your private audit trail
full = cdp.full()
print(full.activity) # Complete event timeline
print(full.destruction) # 8-step chain verification
# Verification CDP — safe to share
verify = cdp.verification()
print(verify.data_ingested) # File count and hashes only
print(verify.residency) # How long data existed
# Zero filenames, commands, or operational details
Error Handling
from nanorix import ExecutionError, TimeoutError
try:
outputs, cdp = client.capsules.run(template="tmpl_...", inputs=inputs)
except ExecutionError as e:
print(f"Exit code: {e.exit_code}")
print(f"CDP still generated: {e.cdp}") # Destruction happened
except TimeoutError as e:
print(f"Capsule still alive: {e.capsule.id}")
# Decide: retry, debug, or destroy
Async Support
import nanorix
async with nanorix.AsyncClient(api_key="nrx_live_...") as client:
outputs, cdp = await client.capsules.run(
template="tmpl_...",
inputs={"data.csv": data},
)
Configuration
client = nanorix.Client(
api_key="nrx_live_...",
base_url="https://api.nanorix.io", # default
timeout=30.0, # default
max_retries=3, # default
)
Documentation
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
nanorix-0.1.0.tar.gz
(15.8 kB
view details)
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
nanorix-0.1.0-py3-none-any.whl
(15.4 kB
view details)
File details
Details for the file nanorix-0.1.0.tar.gz.
File metadata
- Download URL: nanorix-0.1.0.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a8b78baf55a0d088a66d43db5b359995a57e0ee54cd381ab01cf5bed2ededa1
|
|
| MD5 |
f7065b2dda170c3f3ef163986090f1d7
|
|
| BLAKE2b-256 |
d5b38cb77104892f5de0a3567de252d4712fbfeeb91dd6b2b1e6a36b7370d477
|
File details
Details for the file nanorix-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nanorix-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
422862a4373eead8d5c999082a9c5de3180f533f2ab7228ad5088bfbdf87269a
|
|
| MD5 |
7ab4f319d2b171098832d33d2f269306
|
|
| BLAKE2b-256 |
12b7420efcb29cdc509a1d575858961f4ae4537fc8a48199f3b032840eb42645
|