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.1.tar.gz
(17.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.1-py3-none-any.whl
(16.2 kB
view details)
File details
Details for the file nanorix-0.1.1.tar.gz.
File metadata
- Download URL: nanorix-0.1.1.tar.gz
- Upload date:
- Size: 17.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 |
8a74ed0fad5a798d65881ab7efc617ab7ebdb28f2be19510d18a3dc420f0b5b1
|
|
| MD5 |
e841752b24444052c1ed327a8606cc59
|
|
| BLAKE2b-256 |
eb96993806c7c2162c1af0eefc53adb5468fe5f8c150c2dee35392cc43b4cb87
|
File details
Details for the file nanorix-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nanorix-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.2 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 |
874f6dbe4332fa936ab872285b5d0437c93a0b97ddd3fc293807a85b5fcddbe4
|
|
| MD5 |
1a6b78cc61930c695bf12585bc87bd73
|
|
| BLAKE2b-256 |
9157bbc7b9af666b9420dd907bf1504f9297f9da6d15d294d7dffc4b5b637998
|