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 capsulefile (one-time setup)
capsulefile = client.capsulefiles.create(
name="patient-risk-scorer",
runtime="python3.11",
entrypoint="python model.py",
files=["model.py", "requirements.txt"],
)
client.capsulefiles.wait_until_finalized(capsulefile.id)
# Process data — capsule auto-destroyed after completion
outputs, cdp = client.capsules.run(
capsulefile=capsulefile.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.create(capsulefile="cf_...")
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(capsulefile="cf_...", 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(
capsulefile="cf_...",
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.3.0.tar.gz
(18.9 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.3.0-py3-none-any.whl
(16.5 kB
view details)
File details
Details for the file nanorix-0.3.0.tar.gz.
File metadata
- Download URL: nanorix-0.3.0.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2c9b97473e336c3196a3ea19783faf6aa92c972216578834d983888c1bf04f3
|
|
| MD5 |
03cc91e2eb1f246910bae0f78ba9e250
|
|
| BLAKE2b-256 |
d84dca4c028f5ce87d7b8aae6705db8e40364f031f089f43389f17a48ae7aab7
|
File details
Details for the file nanorix-0.3.0-py3-none-any.whl.
File metadata
- Download URL: nanorix-0.3.0-py3-none-any.whl
- Upload date:
- Size: 16.5 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 |
de3cdb4aa34d03464dccbb2f36d6d5c176003efbc3250a71c083d06772b8b18a
|
|
| MD5 |
67d8837c427af49ed3e8a2550bf8c95f
|
|
| BLAKE2b-256 |
fd7e0fdf876ccd09876673f7dfbc965164da7573d230fac45ad3618fd690c23e
|