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.5.0.tar.gz (583.1 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.5.0-py3-none-any.whl (466.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nanorix-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2656ad8f96c86bdaca5ca2cef8688f94a9937fc87e960d6edf955123b806851a
MD5 bb1300e53b85e31ffe21b142f7bd8f59
BLAKE2b-256 28ba723e9fe456a6b91652152fa958ab1fda9a045ad0eb740fc5041ab0b384bc

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nanorix-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3627d3b7fb19e8dfc6dd760d22b7aaabd57641665b0359ed0fb900e352fc7601
MD5 ceab500b745dc492ab4facc2cdc7fa70
BLAKE2b-256 0c8762e5bfb31d740f5f8299ebaea8115a9387be08ad99aea3e629ea368e3ead

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.0

2 files

This release

0.5.0 This release

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