Skip to content

Commit ebbdaee

Browse files
chore(api): rename workspaces to machines
Plus some changes to SDK config settings
1 parent e4097a4 commit ebbdaee

67 files changed

Lines changed: 1242 additions & 1233 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 27
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/dedalus-labs%2Fdedalus-7a281169c5f380aa29376e393f8c5f87d35998fecc9e1210835f1165c0bc467f.yml
3-
openapi_spec_hash: da9a43b37a46e0d22a823085861cdd82
4-
config_hash: 7fcee0473099fe6d9a119f37c80e53d7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/dedalus-labs%2Fdedalus-6a258bad8212a32bd01b1908ab115e08736d156d6907697a7e556b1809383790.yml
3+
openapi_spec_hash: d80976534189646de029c562bb3ca9a1
4+
config_hash: 795e855c41188604a3e270623e39c126

README.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ client = Dedalus(
4141
api_key=os.environ.get("DEDALUS_API_KEY"), # This is the default and can be omitted
4242
)
4343

44-
workspace = client.workspaces.create(
44+
machine = client.machines.create(
4545
memory_mib=2048,
4646
storage_gib=10,
4747
vcpu=1,
4848
)
49-
print(workspace.workspace_id)
49+
print(machine.machine_id)
5050
```
5151

5252
While you can provide a `x_api_key` keyword argument,
@@ -69,12 +69,12 @@ client = AsyncDedalus(
6969

7070

7171
async def main() -> None:
72-
workspace = await client.workspaces.create(
72+
machine = await client.machines.create(
7373
memory_mib=2048,
7474
storage_gib=10,
7575
vcpu=1,
7676
)
77-
print(workspace.workspace_id)
77+
print(machine.machine_id)
7878

7979

8080
asyncio.run(main())
@@ -107,12 +107,12 @@ async def main() -> None:
107107
api_key=os.environ.get("DEDALUS_API_KEY"), # This is the default and can be omitted
108108
http_client=DefaultAioHttpClient(),
109109
) as client:
110-
workspace = await client.workspaces.create(
110+
machine = await client.machines.create(
111111
memory_mib=2048,
112112
storage_gib=10,
113113
vcpu=1,
114114
)
115-
print(workspace.workspace_id)
115+
print(machine.machine_id)
116116

117117

118118
asyncio.run(main())
@@ -127,11 +127,11 @@ from dedalus_sdk import Dedalus
127127

128128
client = Dedalus()
129129

130-
stream = client.workspaces.watch(
131-
workspace_id="workspace_id",
130+
stream = client.machines.watch(
131+
machine_id="machine_id",
132132
)
133-
for workspace in stream:
134-
print(workspace.workspace_id)
133+
for machine in stream:
134+
print(machine.machine_id)
135135
```
136136

137137
The async client uses the exact same interface.
@@ -141,11 +141,11 @@ from dedalus_sdk import AsyncDedalus
141141

142142
client = AsyncDedalus()
143143

144-
stream = await client.workspaces.watch(
145-
workspace_id="workspace_id",
144+
stream = await client.machines.watch(
145+
machine_id="machine_id",
146146
)
147-
async for workspace in stream:
148-
print(workspace.workspace_id)
147+
async for machine in stream:
148+
print(machine.machine_id)
149149
```
150150

151151
## Using types
@@ -168,12 +168,12 @@ from dedalus_sdk import Dedalus
168168

169169
client = Dedalus()
170170

171-
all_workspaces = []
171+
all_machines = []
172172
# Automatically fetches more pages as needed.
173-
for workspace in client.workspaces.list():
174-
# Do something with workspace here
175-
all_workspaces.append(workspace)
176-
print(all_workspaces)
173+
for machine in client.machines.list():
174+
# Do something with machine here
175+
all_machines.append(machine)
176+
print(all_machines)
177177
```
178178

179179
Or, asynchronously:
@@ -186,11 +186,11 @@ client = AsyncDedalus()
186186

187187

188188
async def main() -> None:
189-
all_workspaces = []
189+
all_machines = []
190190
# Iterate through items across all pages, issuing requests as needed.
191-
async for workspace in client.workspaces.list():
192-
all_workspaces.append(workspace)
193-
print(all_workspaces)
191+
async for machine in client.machines.list():
192+
all_machines.append(machine)
193+
print(all_machines)
194194

195195

196196
asyncio.run(main())
@@ -199,7 +199,7 @@ asyncio.run(main())
199199
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
200200

201201
```python
202-
first_page = await client.workspaces.list()
202+
first_page = await client.machines.list()
203203
if first_page.has_next_page():
204204
print(f"will fetch next page using these details: {first_page.next_page_info()}")
205205
next_page = await first_page.get_next_page()
@@ -211,11 +211,11 @@ if first_page.has_next_page():
211211
Or just work directly with the returned data:
212212

213213
```python
214-
first_page = await client.workspaces.list()
214+
first_page = await client.machines.list()
215215

216216
print(f"next page cursor: {first_page.next_cursor}") # => "next page cursor: ..."
217-
for workspace in first_page.items:
218-
print(workspace.workspace_id)
217+
for machine in first_page.items:
218+
print(machine.machine_id)
219219

220220
# Remove `await` for non-async usage.
221221
```
@@ -236,7 +236,7 @@ from dedalus_sdk import Dedalus
236236
client = Dedalus()
237237

238238
try:
239-
client.workspaces.create(
239+
client.machines.create(
240240
memory_mib=2048,
241241
storage_gib=10,
242242
vcpu=1,
@@ -283,7 +283,7 @@ client = Dedalus(
283283
)
284284

285285
# Or, configure per-request:
286-
client.with_options(max_retries=5).workspaces.create(
286+
client.with_options(max_retries=5).machines.create(
287287
memory_mib=2048,
288288
storage_gib=10,
289289
vcpu=1,
@@ -310,7 +310,7 @@ client = Dedalus(
310310
)
311311

312312
# Override per-request:
313-
client.with_options(timeout=5.0).workspaces.create(
313+
client.with_options(timeout=5.0).machines.create(
314314
memory_mib=2048,
315315
storage_gib=10,
316316
vcpu=1,
@@ -355,15 +355,15 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
355355
from dedalus_sdk import Dedalus
356356

357357
client = Dedalus()
358-
response = client.workspaces.with_raw_response.create(
358+
response = client.machines.with_raw_response.create(
359359
memory_mib=2048,
360360
storage_gib=10,
361361
vcpu=1,
362362
)
363363
print(response.headers.get('X-My-Header'))
364364

365-
workspace = response.parse() # get the object that `workspaces.create()` would have returned
366-
print(workspace.workspace_id)
365+
machine = response.parse() # get the object that `machines.create()` would have returned
366+
print(machine.machine_id)
367367
```
368368

369369
These methods return an [`APIResponse`](https://github.com/dedalus-labs/dedalus-python/tree/main/src/dedalus_sdk/_response.py) object.
@@ -377,7 +377,7 @@ The above interface eagerly reads the full response body when you make the reque
377377
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
378378

379379
```python
380-
with client.workspaces.with_streaming_response.create(
380+
with client.machines.with_streaming_response.create(
381381
memory_mib=2048,
382382
storage_gib=10,
383383
vcpu=1,

0 commit comments

Comments
 (0)