Metadata-Version: 2.1
Name: chemetrian
Version: 0.1.0
Summary: Official Python SDK for the Chemetrian API (Bayesian Optimization, and more).
Home-page: https://www.chemetrian.com
License: MIT
Keywords: chemetrian,bayesian-optimization,chemistry,api-client
Author: Chemetrian
Author-email: dev@chemetrian.com
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
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 :: Scientific/Engineering :: Chemistry
Requires-Dist: pandas (>=1.5)
Requires-Dist: requests (>=2.28,<3.0)
Project-URL: Repository, https://gitlab.com/patel.simd/chemetrian-python-sdk
Description-Content-Type: text/markdown

# chemetrian

Official Python SDK for the Chemetrian API. Drive Bayesian Optimization (and future
services) with pandas DataFrames and one API key.

## Install

```bash
pip install chemetrian
```

## Quickstart

```python
from chemetrian import Chemetrian

client = Chemetrian(api_key="sk_live_…")                 # or set CHEMETRIAN_API_KEY
# QA: Chemetrian(api_key="sk_live_…", base_url="https://qa.chemetrian.com")

features = [
    {"feature_name": "temp",     "feature_type": "CONTINUOUS_NUMERICAL",
     "lower_bound": 20, "upper_bound": 120, "step_size": 10},
    {"feature_name": "catalyst", "feature_type": "CATEGORICAL",
     "feature_values": ["Pd", "Ni", "Cu"]},
]
targets = [{"target_name": "yield", "goal": "maximize", "threshold": 0}]

# 1. Start a campaign → DataFrame of suggested experiments (priority == 1)
df = client.bayesian_optimization.initialize(
    project="amide-coupling", workflow_name="run-1",
    features=features, targets=targets, batch_size=4,
)

# 2. Run the suggested rows, fill in the measured target, submit → next batch
df.loc[df["priority"] == 1, "yield"] = [72.4, 55.1, 38.9, 80.2]
df = client.bayesian_optimization.run_round("amide-coupling", "run-1", df, batch_size=4)

# 3. (Optional) start from existing data instead of step 1
df = client.bayesian_optimization.initialize_with_experiments(
    project="amide-coupling", workflow_name="run-2",
    experiments=historical_df, targets=targets, batch_size=4,   # features auto-detected
)
```

Each call submits a job and blocks until it finishes (polling under the hood), then returns
a DataFrame. `priority`: `1` = suggested (run it), `-1` = completed.

## Projects & workflows

```python
client.list_projects()
client.create_project("amide-coupling", description="Q3 scouting")
client.bayesian_optimization.list_workflows("amide-coupling")
```

## Errors

All raise subclasses of `chemetrian.ChemetrianError`: `ValidationError` (client-side),
`AuthError` (401), `InsufficientCreditsError` (402), `NotFoundError` (404),
`RateLimitError` (429, auto-retried), `JobFailedError`, `JobTimeoutError`.

## Configuration

| arg / env | purpose |
|---|---|
| `api_key` / `CHEMETRIAN_API_KEY` | your key |
| `base_url` / `CHEMETRIAN_API_URL` | API host (QA vs prod) |
| `poll_interval`, `poll_timeout` | how long the SDK waits for a job |

