Metadata-Version: 2.4
Name: dxpipe-sdk
Version: 0.1.1
Summary: Python SDK for DxPipe model editing and simulation workflows
Author: DxPipe Team
License-Expression: LicenseRef-Proprietary
Keywords: dxpipe,pipeline-simulation,oil-gas,sdk,digital-twin
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
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 :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.31.0
Requires-Dist: websocket-client>=1.8.0
Provides-Extra: dev
Requires-Dist: build>=1.2.2; extra == "dev"
Requires-Dist: twine>=5.1.1; extra == "dev"

# dxpipe-sdk

dxpipe-sdk is a Python SDK for DxPipe model editing, simulation execution, streaming result retrieval, and runtime command control.

## Features

- Token-based authentication against the DxPipe backend
- Create models for supported workspace types and open existing models
- Add, remove, connect, and configure components in the model graph
- Save model snapshots and start simulation jobs
- Poll or stream logs, plots, tables, inspect data, and container messages
- Send runtime commands to components during online or transient execution

## Requirements

- Python 3.10 or later
- A reachable DxPipe service endpoint
- A DxPipe account that can obtain access tokens

## Install

Install from a built wheel or from PyPI after publication:

```bash
pip install dxpipe-sdk
```

For local development in this repository:

```bash
pip install -e .
```

## Quick Start

```python
from dxpipe_sdk import DxPipeClient

client = DxPipeClient(
    base_url="http://localhost:8000",
    username="admin",
    password="your-password",
)

model = client.create_model(
    name="sdk-demo-model",
    workspace_type="lps_online",
    description="Created by dxpipe-sdk",
)

source = model.add_component("Source", position=(0, 0))
pipe = model.add_component("Pipe", position=(240, 0))
load = model.add_component("Load", position=(480, 0))

model.connect(source, "0", pipe, "0")
model.connect(pipe, "1", load, "0")

model.save()
job = model.run(timeout=120, image="dxpipe")

for message in job.stream_results(timeout=2):
    print(message.get("type"), message.get("key"))
```

## Public API

The package currently exports these main entry points:

- `DxPipeClient`
- `Model`
- `Component`
- `Connection`
- `Job`
- `MetaService`
- `ResultStream`
- `LogMessage`
- `PlotMessage`
- `TableMessage`
- `InspectMessage`
- `ContainerMessage`
- `DxPipeError`
- `AuthError`
- `APIError`
- `NotFoundError`
- `ValidationError`

## Examples

- `examples/quickstart.py`: create, save, run, and fetch results
- `examples/transient_streaming.py`: stream transient online results and send commands during execution
- `examples/run_existing_model.py`: open an existing model by ID and run it

## Release Validation

Build and metadata check:

```bash
python -m build
python -m twine check dist/*
```

Minimal install smoke test with the built wheel:

```bash
python -m venv .smoke-venv
.smoke-venv\Scripts\python -m pip install dist\dxpipe_sdk-0.1.1-py3-none-any.whl
.smoke-venv\Scripts\python -c "from dxpipe_sdk import DxPipeClient, Model, Job, ResultStream; print('smoke ok')"
```

## License

This package is currently distributed as proprietary software.
