Metadata-Version: 2.4
Name: lltp
Version: 0.1.0a1
Summary: Python reference SDK for the Lab-in-the-Loop Transport Protocol (LLTP) v0.1
Author: BioLM
License: Apache-2.0
Project-URL: Homepage, https://github.com/BioLM/lltp-py
Project-URL: Repository, https://github.com/BioLM/lltp-py
Project-URL: Documentation, https://github.com/lltprotocol/lltp
Keywords: lltp,bio-ai,lab-in-the-loop
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.23.0
Requires-Dist: jsonschema<5,>=4.0
Requires-Dist: importlib_resources>=5.0; python_version < "3.10"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-httpx>=0.30.0; extra == "dev"
Dynamic: license-file

# lltp-py

Python reference SDK for [LLTP](https://github.com/lltprotocol/lltp) (Lab-in-the-Loop Transport Protocol) v0.1.

**Primary audience:** authors of `{provider}-lltp` connectors (and similar
consumables). Agents and design tools typically talk to those connectors, not
this SDK directly — though nothing prevents using the client helpers that way.

Maintained by [BioLM](https://biolm.com) during protocol kickoff. See the [spec repo `GOVERNANCE.md`](https://github.com/lltprotocol/lltp/blob/main/GOVERNANCE.md) for long-term stewardship intent.

**Status:** v0.1-alpha. Message signing (`sign` / `verify`) is not yet implemented.

## Install

```bash
pip install lltp
```

For local development:

```bash
pip install -e ".[dev]"
```

Requires Python >=3.8.

## Quick start

```python
from lltp import validate_envelope, derive_order_status
from lltp.client import LLTPClient
import json

with open("tests/fixtures/scenario-a-dna-synthesis/01-order.json") as f:
    order = json.load(f)

validate_envelope(order)
print(derive_order_status(order["requirements"]))  # IN_PROGRESS
```

### Mock provider (Scenario A)

```bash
pip install -e .
python scripts/mock_provider.py --port 8765
```

In another shell:

```python
from lltp.client import LLTPClient
import json

with open("tests/fixtures/scenario-a-dna-synthesis/01-order.json") as f:
    order = json.load(f)

with LLTPClient() as client:
    catalog = client.fetch_catalog("http://127.0.0.1:8765")
    summary = client.submit_order("http://127.0.0.1:8765", order)
    print(summary)
```

## API overview

| Module | Purpose |
|--------|---------|
| `lltp.validate` | `validate_envelope`, `validate_catalog` (JSON Schema) |
| `lltp.lifecycle` | `derive_order_status`, `merge_requirements` |
| `lltp.client` | `LLTPClient` — HTTP client for provider endpoints |
| `lltp.webhook` | `WebhookHandler` — merge STATUS/RESULT deltas |

## Tests

```bash
pip install -e ".[dev]"
pytest
```

## Refreshing vendored schemas and fixtures

When the [spec repo](https://github.com/lltprotocol/lltp) changes:

```bash
cp ../lltp/schema/0.1/{envelope,provider}.schema.json src/lltp/schemas/
cp ../lltp/examples/catalog/twist.json tests/fixtures/catalog/
cp ../lltp/examples/scenario-a-dna-synthesis/*.json tests/fixtures/scenario-a-dna-synthesis/
```

## Conformance

See [CONFORMANCE.md](CONFORMANCE.md) for what this alpha SDK implements vs deferred.

## Related repositories

- [lltp](https://github.com/lltprotocol/lltp) — protocol specification
- [BioLM/lltp-js](https://github.com/BioLM/lltp-js) — JavaScript/TypeScript reference SDK
- `{provider}-lltp` — provider connectors (separate repos; e.g. `twist-lltp`) that use this SDK

## License

Apache-2.0. See [LICENSE](LICENSE).
