Metadata-Version: 2.4
Name: zerostyl-sdk
Version: 0.1.1
Summary: Python SDK for the ZeroStyl zk toolkit on Arbitrum Stylus: ABI schema types and typed-bindings codegen
Project-URL: Repository, https://github.com/kazai777/zerostyl
Author-email: kazai777 <kazai777.dev@gmail.com>
License: MIT
License-File: LICENSE
Keywords: arbitrum,halo2,privacy,stylus,zero-knowledge,zk-snarks
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Description-Content-Type: text/markdown

# zerostyl-sdk (Python)

Python SDK for the [ZeroStyl](https://github.com/kazai777/zerostyl) zk toolkit on
Arbitrum Stylus. Parses the exporter's `abi.json` documents into typed dataclasses and
generates typed Python bindings — the same scope as `@zerostyl/sdk-ts`, in Python.

Pure Python, zero runtime dependencies, Python ≥ 3.10.

## Install

```bash
pip install zerostyl-sdk
```

Or from a clone of the repository, for development:

```bash
cd packages/sdk-py
python -m pip install ".[dev]"
```

## Usage

```python
from pathlib import Path
from zerostyl_sdk import parse_abi_schema, generate_bindings

abi = parse_abi_schema(Path("abi.json").read_text())
print(abi.circuit.name, abi.circuit.num_public_inputs)

bindings = generate_bindings(abi)   # a Python module as a string
Path("deposit_bindings.py").write_text(bindings)
```

CLI (equivalent of the TS SDK's `zerostyl-sdk generate`):

```bash
zerostyl-sdk-py generate --abi abi.json --out bindings.py
python -m zerostyl_sdk generate --abi abi.json
```

Generated output for the demo circuit:

```python
DEPOSIT_CIRCUIT: Final = {
    "name": "deposit",
    ...
}

@dataclass(frozen=True)
class DepositWitness:
    collateral: str
    collateral_nonce: str
    threshold: str

@dataclass(frozen=True)
class DepositPublicInputs:
    collateral_commitment: str
```

Type mapping: `u64`/`u128` → `int`, `bool` → `bool`, `fp`/`bytes32`/`address` → `str`
(`0x`-prefixed hex), arrays → `tuple[..., ...]`.

## Tests

```bash
python -m pytest
ruff check src tests
```

The snapshot test locks the generated bindings for
`examples/zk_private_demo/abi.json`; regenerate with
`REGEN_SDK_PY_SNAPSHOTS=1 python -m pytest`.

## Scope and future work

Codegen only — proof generation from Python (bindings to the Rust prover) and on-chain
submission helpers are future work, mirroring the TypeScript SDK's roadmap.

## License

MIT — see the repository's [LICENSE](../../LICENSE).
