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.start(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.2.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.2.0-py3-none-any.whl
(16.5 kB
view details)
File details
Details for the file nanorix-0.2.0.tar.gz.
File metadata
- Download URL: nanorix-0.2.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 |
1ec257eca92376dc167dcc954cc0cf830dc72a699a75703cc9a21983ed18faeb
|
|
| MD5 |
f42daa39d5380bcbd9305ef119c3e0ec
|
|
| BLAKE2b-256 |
e8064db4f0fab824bb0b0e0e8e77b1ac151e3d7449773799aeacf7e7e457dfbe
|
File details
Details for the file nanorix-0.2.0-py3-none-any.whl.
File metadata
- Download URL: nanorix-0.2.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 |
8ae8816b6b2aaf9740b0eec37b4be77a46501f33b71847fe07c382f0143d6b75
|
|
| MD5 |
404551344173dd59e3e2ec45d4888e86
|
|
| BLAKE2b-256 |
2346e02af82be6392b7f88240c91e9f018033388f55fd4d3112957bb7bbe8764
|