Metadata-Version: 2.4
Name: nanorix
Version: 0.2.0
Summary: Python client for the Nanorix API — sealed processing with cryptographic destruction proofs
Project-URL: Homepage, https://nanorix.io
Project-URL: Documentation, https://docs.nanorix.io
Project-URL: Repository, https://nanorix.io
Author-email: "Nanorix Inc." <support@nanorix.io>
License: Proprietary
License-File: LICENSE
Keywords: compliance,cryptographic-proof,data-destruction,gdpr,hipaa,nanorix,security
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: httpx<1.0.0,>=0.25.0
Requires-Dist: pydantic<3.0.0,>=2.0.0
Provides-Extra: dev
Requires-Dist: mypy>=1.5; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Requires-Dist: ruff>=0.1; extra == 'dev'
Description-Content-Type: text/markdown

# Nanorix Python SDK

Sealed processing with cryptographic destruction proofs.

## Installation

```bash
pip install nanorix
```

## Quick Start

```python
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:

```python
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:

```python
# 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

```python
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

```python
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

```python
client = nanorix.Client(
    api_key="nrx_live_...",
    base_url="https://api.nanorix.io",  # default
    timeout=30.0,                        # default
    max_retries=3,                       # default
)
```

## Documentation

- [API Reference](https://docs.nanorix.io)
- [Dashboard](https://app.nanorix.io)
- [Verify a CDP](https://nanorix.io/verify)
