Metadata-Version: 2.4
Name: signety
Version: 1.0.0
Summary: Python SDK for Signety supply chain tracking and product authentication
Author-email: Signety <dev@signety.co>
License: MIT
Project-URL: Homepage, https://signety.co
Project-URL: Documentation, https://docs.signety.co/sdk/python
Project-URL: Repository, https://github.com/signety/signety-python
Keywords: signety,supply-chain,product-authentication,qr-code,tracking
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT 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 :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.25.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
Requires-Dist: respx>=0.20; extra == "dev"

# Signety Python SDK

Python SDK for [Signety](https://signety.co) supply chain tracking and product authentication.

## Installation

```bash
pip install signety
```

## Quick Start

```python
from signety import Signety

client = Signety(api_key="sk_live_your_key_here")

# Record a supply chain event
result = client.events.create(
    unit_serial="A7K3M9P2Q5W8",
    event_type="SHIP",
    from_location="MUM-WH-1",
    to_location="DEL-DC-2",
)

if result.success:
    print("Event recorded:", result.data)
elif result.queued:
    print("API unavailable — event queued for retry")
else:
    print("Error:", result.error)
```

## Features

- **Supply chain events**: Record MANUFACTURE, PACK, SHIP, RECEIVE, DELIVER, RETURN events
- **Unit tracking**: Look up units by serial number, get full supply chain timeline
- **Order sync**: Sync external orders for scan-to-bind packing
- **Inventory**: Query stock levels per location per SKU
- **Shipments**: Create and track shipments between locations
- **Webhooks**: Register endpoints to receive event notifications
- **Local retry queue**: Failed API calls are queued locally and retried automatically
- **Kill switch**: `Signety(enabled=False)` disables all network calls instantly
- **Async support**: `AsyncSignety` for async/await usage

## Authentication

Generate an API key in the Signety enterprise dashboard (Supply Chain > API Keys).

```python
client = Signety(api_key="sk_live_...")
```

## Error Handling

All methods return `Result` objects — they never raise exceptions.

```python
result = client.events.create(...)

if result.success:
    event = result.data
elif result.queued:
    print("Queued for retry")
else:
    print(f"Error: {result.error}")
```

## Webhook Verification

```python
is_valid = Signety.verify_webhook_signature(
    payload=request.body,
    signature=request.headers["X-Signety-Signature"],
    secret="whsec_your_secret",
)
```

## Retry Queue

Failed calls are automatically saved to `~/.signety/queue/` and retried on the next successful call (piggyback flush). You can also flush manually:

```python
flushed, failed = client.flush()
```

Or via CLI:
```bash
signety flush --api-key sk_live_...
```

## Requirements

- Python 3.9+
- httpx >= 0.25.0
- pydantic >= 2.0.0

## License

MIT
