Skip to main content

Nanorix Python SDK

Sealed ephemeral capsules for regulated data, with independently verifiable AuditProofs.

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()

AuditProof Access

Every destroyed capsule produces an AuditProof covering the full lifecycle — ingress, execution, egress, and destruction:

# AuditRecord — your private audit trail
full = cdp.full()
print(full.activity)       # Complete event timeline
print(full.destruction)    # 8-step chain verification

# AuditProof — 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

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.6.0.tar.gz (611.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nanorix-0.6.0-py3-none-any.whl (480.7 kB view details)

Uploaded Python 3

File details

Details for the file nanorix-0.6.0.tar.gz.

File metadata

  • Download URL: nanorix-0.6.0.tar.gz
  • Upload date:
  • Size: 611.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for nanorix-0.6.0.tar.gz
Algorithm Hash digest
SHA256 9d0e439f16f0b0fd6fa0f352c9ae0577f36f4a3ffbe158d4b4c36098edb62e9a
MD5 61427db31890e3f7b87f2b1c6a45fa49
BLAKE2b-256 63d4dd88f6caaca521641df3fb3626d8443b9545c2b4edcc43f6bacbe61779b0

See more details on using hashes here.

File details

Details for the file nanorix-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: nanorix-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 480.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for nanorix-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f02315e0b0a37d8cafc6c4efb0a160e3199f796361c2cfccf44b04823bd1f939
MD5 0124dc6782fbaf98aafd3355b766d5c5
BLAKE2b-256 66dfce1d41f2eddc22222ca5bd90002fcc6d97b3db1b43595e4f0e63bb4f65ce

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 files

0.5.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page