synthgraph-sdk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- synthgraph_sdk-0.1.0/.gitignore +38 -0
- synthgraph_sdk-0.1.0/PKG-INFO +322 -0
- synthgraph_sdk-0.1.0/README.md +306 -0
- synthgraph_sdk-0.1.0/pyproject.toml +40 -0
- synthgraph_sdk-0.1.0/src/synthgraph/__init__.py +34 -0
- synthgraph_sdk-0.1.0/src/synthgraph/client.py +69 -0
- synthgraph_sdk-0.1.0/src/synthgraph/config.py +23 -0
- synthgraph_sdk-0.1.0/src/synthgraph/experiments.py +52 -0
- synthgraph_sdk-0.1.0/src/synthgraph/generations.py +124 -0
- synthgraph_sdk-0.1.0/src/synthgraph/http.py +174 -0
- synthgraph_sdk-0.1.0/src/synthgraph/models/__init__.py +16 -0
- synthgraph_sdk-0.1.0/src/synthgraph/models/experiment.py +16 -0
- synthgraph_sdk-0.1.0/src/synthgraph/models/generation.py +76 -0
- synthgraph_sdk-0.1.0/src/synthgraph/models/project.py +15 -0
- synthgraph_sdk-0.1.0/src/synthgraph/models/reference.py +27 -0
- synthgraph_sdk-0.1.0/src/synthgraph/projects.py +40 -0
- synthgraph_sdk-0.1.0/src/synthgraph/serialization/__init__.py +3 -0
- synthgraph_sdk-0.1.0/src/synthgraph/serialization/json.py +14 -0
- synthgraph_sdk-0.1.0/tests/test_client.py +90 -0
- synthgraph_sdk-0.1.0/tests/test_config.py +54 -0
- synthgraph_sdk-0.1.0/tests/test_experiments.py +140 -0
- synthgraph_sdk-0.1.0/tests/test_generation.py +366 -0
- synthgraph_sdk-0.1.0/tests/test_http.py +210 -0
- synthgraph_sdk-0.1.0/tests/test_models.py +62 -0
- synthgraph_sdk-0.1.0/tests/test_package.py +5 -0
- synthgraph_sdk-0.1.0/tests/test_projects.py +98 -0
- synthgraph_sdk-0.1.0/tests/test_references.py +106 -0
- synthgraph_sdk-0.1.0/tests/test_serialization.py +97 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.pyo
|
|
5
|
+
|
|
6
|
+
# Virtual environments
|
|
7
|
+
.venv/
|
|
8
|
+
venv/
|
|
9
|
+
env/
|
|
10
|
+
|
|
11
|
+
# Packaging
|
|
12
|
+
*.egg-info/
|
|
13
|
+
dist/
|
|
14
|
+
build/
|
|
15
|
+
|
|
16
|
+
# Testing
|
|
17
|
+
.pytest_cache/
|
|
18
|
+
.coverage
|
|
19
|
+
htmlcov/
|
|
20
|
+
|
|
21
|
+
# Type checking
|
|
22
|
+
.mypy_cache/
|
|
23
|
+
|
|
24
|
+
# Ruff
|
|
25
|
+
.ruff_cache/
|
|
26
|
+
|
|
27
|
+
# IDEs
|
|
28
|
+
.idea/
|
|
29
|
+
.vscode/
|
|
30
|
+
|
|
31
|
+
# OS
|
|
32
|
+
.DS_Store
|
|
33
|
+
Thumbs.db
|
|
34
|
+
|
|
35
|
+
# Environment / secrets
|
|
36
|
+
.env
|
|
37
|
+
.env.*
|
|
38
|
+
!.env.example
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: synthgraph-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for SynthGraph experiment provenance and lineage tracking.
|
|
5
|
+
Author: SynthGraph
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Requires-Dist: httpx<1.0,>=0.27
|
|
9
|
+
Requires-Dist: pydantic<3.0,>=2.0
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: mypy<2.0,>=1.11; extra == 'dev'
|
|
12
|
+
Requires-Dist: pytest-cov<6.0,>=5.0; extra == 'dev'
|
|
13
|
+
Requires-Dist: pytest<9.0,>=8.0; extra == 'dev'
|
|
14
|
+
Requires-Dist: ruff<1.0,>=0.6; extra == 'dev'
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# SynthGraph Python SDK
|
|
18
|
+
|
|
19
|
+
The official Python SDK for SynthGraph.
|
|
20
|
+
|
|
21
|
+
SynthGraph allows researchers to capture experiment provenance and lineage from
|
|
22
|
+
their existing research environments without moving their workflows into the
|
|
23
|
+
SynthGraph platform.
|
|
24
|
+
|
|
25
|
+
## Status
|
|
26
|
+
|
|
27
|
+
Early development.
|
|
28
|
+
|
|
29
|
+
The SDK is currently under active development and the public API is not yet
|
|
30
|
+
stable.
|
|
31
|
+
|
|
32
|
+
## Planned v1.0 capabilities
|
|
33
|
+
|
|
34
|
+
- Project and experiment management
|
|
35
|
+
- Synthetic-data generation provenance
|
|
36
|
+
- Dataset references
|
|
37
|
+
- Training-run provenance
|
|
38
|
+
- Evaluation metrics
|
|
39
|
+
- Asset references
|
|
40
|
+
- Code and environment metadata
|
|
41
|
+
- Experiment lineage
|
|
42
|
+
- Cloud and self-hosted SynthGraph deployments
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
Install the SDK from the project directory:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install -e .
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For development:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install -e ".[dev]"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
A typical SynthGraph workflow is:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
Project
|
|
64
|
+
└── Experiment
|
|
65
|
+
└── Generation
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Create a project
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from synthgraph import SynthGraphClient
|
|
72
|
+
|
|
73
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
74
|
+
project = client.projects.create(
|
|
75
|
+
name="Synthetic Research",
|
|
76
|
+
description="Synthetic-data research project",
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
print(project.id)
|
|
80
|
+
print(project.name)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Create an experiment
|
|
84
|
+
|
|
85
|
+
Experiments belong to projects:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from synthgraph import SynthGraphClient
|
|
89
|
+
|
|
90
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
91
|
+
experiment = client.experiments.create(
|
|
92
|
+
project_id="project_123",
|
|
93
|
+
name="Rainy Scene Study",
|
|
94
|
+
description="Study of synthetic rainy-scene generation",
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
print(experiment.id)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Record a synthetic-data generation
|
|
101
|
+
|
|
102
|
+
Use `Generator` to describe the software or tool that produced the result,
|
|
103
|
+
and `Reproducibility` to capture information needed to reproduce the run.
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from synthgraph import (
|
|
107
|
+
Generator,
|
|
108
|
+
Reproducibility,
|
|
109
|
+
SynthGraphClient,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
113
|
+
generation = client.generations.create(
|
|
114
|
+
experiment_id="experiment_123",
|
|
115
|
+
name="Rainy Scene Generation",
|
|
116
|
+
generator=Generator(
|
|
117
|
+
name="blender",
|
|
118
|
+
version="4.2.0",
|
|
119
|
+
type="3d_renderer",
|
|
120
|
+
),
|
|
121
|
+
parameters={
|
|
122
|
+
"samples": 512,
|
|
123
|
+
"weather": "rain",
|
|
124
|
+
},
|
|
125
|
+
reproducibility=Reproducibility(
|
|
126
|
+
seed=42,
|
|
127
|
+
),
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
print(generation.id)
|
|
131
|
+
print(generation.status)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Record input and output references
|
|
135
|
+
|
|
136
|
+
Generations can reference assets and datasets without moving the underlying
|
|
137
|
+
data into SynthGraph.
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from synthgraph import (
|
|
141
|
+
AssetReference,
|
|
142
|
+
DatasetReference,
|
|
143
|
+
Generator,
|
|
144
|
+
Reproducibility,
|
|
145
|
+
SynthGraphClient,
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
input_asset = AssetReference(
|
|
149
|
+
id="asset_123",
|
|
150
|
+
uri="file:///data/model.blend",
|
|
151
|
+
name="model.blend",
|
|
152
|
+
type="3d_model",
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
input_dataset = DatasetReference(
|
|
156
|
+
id="dataset_123",
|
|
157
|
+
uri="s3://bucket/input-scenes",
|
|
158
|
+
name="input-scenes",
|
|
159
|
+
format="image",
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
output_dataset = DatasetReference(
|
|
163
|
+
id="dataset_456",
|
|
164
|
+
uri="s3://bucket/output-scenes",
|
|
165
|
+
name="output-scenes",
|
|
166
|
+
format="image",
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
170
|
+
generation = client.generations.create(
|
|
171
|
+
experiment_id="experiment_123",
|
|
172
|
+
name="Referenced Generation",
|
|
173
|
+
generator=Generator(name="blender", version="4.2.0"),
|
|
174
|
+
parameters={
|
|
175
|
+
"samples": 512,
|
|
176
|
+
},
|
|
177
|
+
reproducibility=Reproducibility(seed=42),
|
|
178
|
+
inputs=[input_asset, input_dataset],
|
|
179
|
+
outputs=[output_dataset],
|
|
180
|
+
)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
References contain metadata about the data location and identity. The SDK
|
|
184
|
+
does not upload the referenced files or datasets.
|
|
185
|
+
|
|
186
|
+
## Reading existing resources
|
|
187
|
+
|
|
188
|
+
Resources can be retrieved by ID.
|
|
189
|
+
|
|
190
|
+
### Get a project
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
194
|
+
project = client.projects.get("project_123")
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Get an experiment
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
201
|
+
experiment = client.experiments.get("experiment_123")
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Get a generation
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
208
|
+
generation = client.generations.get("generation_123")
|
|
209
|
+
print(generation.status)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Listing resources
|
|
213
|
+
|
|
214
|
+
### List experiments
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
218
|
+
experiments = client.experiments.list(
|
|
219
|
+
project_id="project_123",
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
for experiment in experiments:
|
|
223
|
+
print(experiment.id, experiment.name)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### List generations
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
230
|
+
generations = client.generations.list(
|
|
231
|
+
experiment_id="experiment_123",
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
for generation in generations:
|
|
235
|
+
print(generation.id, generation.status)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Configuration
|
|
239
|
+
|
|
240
|
+
The client can be configured directly:
|
|
241
|
+
|
|
242
|
+
```python
|
|
243
|
+
from synthgraph import SynthGraphClient
|
|
244
|
+
|
|
245
|
+
client = SynthGraphClient(
|
|
246
|
+
api_key="your-api-key",
|
|
247
|
+
api_url="https://api.example.com",
|
|
248
|
+
timeout=30.0,
|
|
249
|
+
)
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Or through `SynthGraphConfig`:
|
|
253
|
+
|
|
254
|
+
```python
|
|
255
|
+
from synthgraph import SynthGraphClient, SynthGraphConfig
|
|
256
|
+
|
|
257
|
+
config = SynthGraphConfig(
|
|
258
|
+
api_key="your-api-key",
|
|
259
|
+
api_url="https://api.example.com",
|
|
260
|
+
timeout=30.0,
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
with SynthGraphClient(config=config) as client:
|
|
264
|
+
project = client.projects.get("project_123")
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Do not combine `config` with `api_key`, `api_url`, or `timeout` on the same
|
|
268
|
+
`SynthGraphClient` instance.
|
|
269
|
+
|
|
270
|
+
## Development
|
|
271
|
+
|
|
272
|
+
From this directory:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
pip install -e ".[dev]"
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Run tests:
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
pytest
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Run linting:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
ruff check .
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Run type checking:
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
mypy src
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Current SDK surface
|
|
297
|
+
|
|
298
|
+
The current public client exposes:
|
|
299
|
+
|
|
300
|
+
```python
|
|
301
|
+
with SynthGraphClient(...) as client:
|
|
302
|
+
client.projects
|
|
303
|
+
client.experiments
|
|
304
|
+
client.generations
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
The SDK currently supports:
|
|
308
|
+
|
|
309
|
+
- Project creation, retrieval, and listing
|
|
310
|
+
- Experiment creation, retrieval, and listing
|
|
311
|
+
- Generation creation, retrieval, and listing
|
|
312
|
+
- Asset references
|
|
313
|
+
- Dataset references
|
|
314
|
+
- Generator metadata
|
|
315
|
+
- Reproducibility metadata
|
|
316
|
+
- HTTP error handling
|
|
317
|
+
- Custom API URLs
|
|
318
|
+
- Custom HTTP transports for testing
|
|
319
|
+
|
|
320
|
+
## License
|
|
321
|
+
|
|
322
|
+
Apache-2.0
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
# SynthGraph Python SDK
|
|
2
|
+
|
|
3
|
+
The official Python SDK for SynthGraph.
|
|
4
|
+
|
|
5
|
+
SynthGraph allows researchers to capture experiment provenance and lineage from
|
|
6
|
+
their existing research environments without moving their workflows into the
|
|
7
|
+
SynthGraph platform.
|
|
8
|
+
|
|
9
|
+
## Status
|
|
10
|
+
|
|
11
|
+
Early development.
|
|
12
|
+
|
|
13
|
+
The SDK is currently under active development and the public API is not yet
|
|
14
|
+
stable.
|
|
15
|
+
|
|
16
|
+
## Planned v1.0 capabilities
|
|
17
|
+
|
|
18
|
+
- Project and experiment management
|
|
19
|
+
- Synthetic-data generation provenance
|
|
20
|
+
- Dataset references
|
|
21
|
+
- Training-run provenance
|
|
22
|
+
- Evaluation metrics
|
|
23
|
+
- Asset references
|
|
24
|
+
- Code and environment metadata
|
|
25
|
+
- Experiment lineage
|
|
26
|
+
- Cloud and self-hosted SynthGraph deployments
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
Install the SDK from the project directory:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install -e .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
For development:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install -e ".[dev]"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick start
|
|
43
|
+
|
|
44
|
+
A typical SynthGraph workflow is:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
Project
|
|
48
|
+
└── Experiment
|
|
49
|
+
└── Generation
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Create a project
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from synthgraph import SynthGraphClient
|
|
56
|
+
|
|
57
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
58
|
+
project = client.projects.create(
|
|
59
|
+
name="Synthetic Research",
|
|
60
|
+
description="Synthetic-data research project",
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
print(project.id)
|
|
64
|
+
print(project.name)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Create an experiment
|
|
68
|
+
|
|
69
|
+
Experiments belong to projects:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from synthgraph import SynthGraphClient
|
|
73
|
+
|
|
74
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
75
|
+
experiment = client.experiments.create(
|
|
76
|
+
project_id="project_123",
|
|
77
|
+
name="Rainy Scene Study",
|
|
78
|
+
description="Study of synthetic rainy-scene generation",
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
print(experiment.id)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Record a synthetic-data generation
|
|
85
|
+
|
|
86
|
+
Use `Generator` to describe the software or tool that produced the result,
|
|
87
|
+
and `Reproducibility` to capture information needed to reproduce the run.
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from synthgraph import (
|
|
91
|
+
Generator,
|
|
92
|
+
Reproducibility,
|
|
93
|
+
SynthGraphClient,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
97
|
+
generation = client.generations.create(
|
|
98
|
+
experiment_id="experiment_123",
|
|
99
|
+
name="Rainy Scene Generation",
|
|
100
|
+
generator=Generator(
|
|
101
|
+
name="blender",
|
|
102
|
+
version="4.2.0",
|
|
103
|
+
type="3d_renderer",
|
|
104
|
+
),
|
|
105
|
+
parameters={
|
|
106
|
+
"samples": 512,
|
|
107
|
+
"weather": "rain",
|
|
108
|
+
},
|
|
109
|
+
reproducibility=Reproducibility(
|
|
110
|
+
seed=42,
|
|
111
|
+
),
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
print(generation.id)
|
|
115
|
+
print(generation.status)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Record input and output references
|
|
119
|
+
|
|
120
|
+
Generations can reference assets and datasets without moving the underlying
|
|
121
|
+
data into SynthGraph.
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from synthgraph import (
|
|
125
|
+
AssetReference,
|
|
126
|
+
DatasetReference,
|
|
127
|
+
Generator,
|
|
128
|
+
Reproducibility,
|
|
129
|
+
SynthGraphClient,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
input_asset = AssetReference(
|
|
133
|
+
id="asset_123",
|
|
134
|
+
uri="file:///data/model.blend",
|
|
135
|
+
name="model.blend",
|
|
136
|
+
type="3d_model",
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
input_dataset = DatasetReference(
|
|
140
|
+
id="dataset_123",
|
|
141
|
+
uri="s3://bucket/input-scenes",
|
|
142
|
+
name="input-scenes",
|
|
143
|
+
format="image",
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
output_dataset = DatasetReference(
|
|
147
|
+
id="dataset_456",
|
|
148
|
+
uri="s3://bucket/output-scenes",
|
|
149
|
+
name="output-scenes",
|
|
150
|
+
format="image",
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
154
|
+
generation = client.generations.create(
|
|
155
|
+
experiment_id="experiment_123",
|
|
156
|
+
name="Referenced Generation",
|
|
157
|
+
generator=Generator(name="blender", version="4.2.0"),
|
|
158
|
+
parameters={
|
|
159
|
+
"samples": 512,
|
|
160
|
+
},
|
|
161
|
+
reproducibility=Reproducibility(seed=42),
|
|
162
|
+
inputs=[input_asset, input_dataset],
|
|
163
|
+
outputs=[output_dataset],
|
|
164
|
+
)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
References contain metadata about the data location and identity. The SDK
|
|
168
|
+
does not upload the referenced files or datasets.
|
|
169
|
+
|
|
170
|
+
## Reading existing resources
|
|
171
|
+
|
|
172
|
+
Resources can be retrieved by ID.
|
|
173
|
+
|
|
174
|
+
### Get a project
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
178
|
+
project = client.projects.get("project_123")
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Get an experiment
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
185
|
+
experiment = client.experiments.get("experiment_123")
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Get a generation
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
192
|
+
generation = client.generations.get("generation_123")
|
|
193
|
+
print(generation.status)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Listing resources
|
|
197
|
+
|
|
198
|
+
### List experiments
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
202
|
+
experiments = client.experiments.list(
|
|
203
|
+
project_id="project_123",
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
for experiment in experiments:
|
|
207
|
+
print(experiment.id, experiment.name)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### List generations
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
with SynthGraphClient(api_key="your-api-key") as client:
|
|
214
|
+
generations = client.generations.list(
|
|
215
|
+
experiment_id="experiment_123",
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
for generation in generations:
|
|
219
|
+
print(generation.id, generation.status)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Configuration
|
|
223
|
+
|
|
224
|
+
The client can be configured directly:
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
from synthgraph import SynthGraphClient
|
|
228
|
+
|
|
229
|
+
client = SynthGraphClient(
|
|
230
|
+
api_key="your-api-key",
|
|
231
|
+
api_url="https://api.example.com",
|
|
232
|
+
timeout=30.0,
|
|
233
|
+
)
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Or through `SynthGraphConfig`:
|
|
237
|
+
|
|
238
|
+
```python
|
|
239
|
+
from synthgraph import SynthGraphClient, SynthGraphConfig
|
|
240
|
+
|
|
241
|
+
config = SynthGraphConfig(
|
|
242
|
+
api_key="your-api-key",
|
|
243
|
+
api_url="https://api.example.com",
|
|
244
|
+
timeout=30.0,
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
with SynthGraphClient(config=config) as client:
|
|
248
|
+
project = client.projects.get("project_123")
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Do not combine `config` with `api_key`, `api_url`, or `timeout` on the same
|
|
252
|
+
`SynthGraphClient` instance.
|
|
253
|
+
|
|
254
|
+
## Development
|
|
255
|
+
|
|
256
|
+
From this directory:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
pip install -e ".[dev]"
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Run tests:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
pytest
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Run linting:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
ruff check .
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Run type checking:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
mypy src
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Current SDK surface
|
|
281
|
+
|
|
282
|
+
The current public client exposes:
|
|
283
|
+
|
|
284
|
+
```python
|
|
285
|
+
with SynthGraphClient(...) as client:
|
|
286
|
+
client.projects
|
|
287
|
+
client.experiments
|
|
288
|
+
client.generations
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
The SDK currently supports:
|
|
292
|
+
|
|
293
|
+
- Project creation, retrieval, and listing
|
|
294
|
+
- Experiment creation, retrieval, and listing
|
|
295
|
+
- Generation creation, retrieval, and listing
|
|
296
|
+
- Asset references
|
|
297
|
+
- Dataset references
|
|
298
|
+
- Generator metadata
|
|
299
|
+
- Reproducibility metadata
|
|
300
|
+
- HTTP error handling
|
|
301
|
+
- Custom API URLs
|
|
302
|
+
- Custom HTTP transports for testing
|
|
303
|
+
|
|
304
|
+
## License
|
|
305
|
+
|
|
306
|
+
Apache-2.0
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "synthgraph-sdk"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python SDK for SynthGraph experiment provenance and lineage tracking."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "SynthGraph" }
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"pydantic>=2.0,<3.0",
|
|
17
|
+
"httpx>=0.27,<1.0",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.optional-dependencies]
|
|
21
|
+
dev = [
|
|
22
|
+
"pytest>=8.0,<9.0",
|
|
23
|
+
"pytest-cov>=5.0,<6.0",
|
|
24
|
+
"ruff>=0.6,<1.0",
|
|
25
|
+
"mypy>=1.11,<2.0",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[tool.hatch.build.targets.wheel]
|
|
29
|
+
packages = ["src/synthgraph"]
|
|
30
|
+
|
|
31
|
+
[tool.pytest.ini_options]
|
|
32
|
+
testpaths = ["tests"]
|
|
33
|
+
|
|
34
|
+
[tool.ruff]
|
|
35
|
+
line-length = 100
|
|
36
|
+
target-version = "py311"
|
|
37
|
+
|
|
38
|
+
[tool.mypy]
|
|
39
|
+
python_version = "3.11"
|
|
40
|
+
strict = true
|