Skip to content

Commit ce811d1

Browse files
committed
Small spelling correction for pre-commit and docs sync.
1 parent 5cd3c9b commit ce811d1

File tree

4 files changed

+56
-56
lines changed

4 files changed

+56
-56
lines changed

docs/sdk/api.mdx

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def create_project(
172172
```python
173173
create_workspace(
174174
name: str,
175+
key: str,
175176
organization_id: UUID,
176177
description: str | None = None,
177178
) -> Workspace
@@ -198,6 +199,7 @@ Creates a new workspace.
198199
def create_workspace(
199200
self,
200201
name: str,
202+
key: str,
201203
organization_id: UUID,
202204
description: str | None = None,
203205
) -> Workspace:
@@ -214,6 +216,7 @@ def create_workspace(
214216

215217
payload = {
216218
"name": name,
219+
"key": key,
217220
"description": description,
218221
"org_id": str(organization_id),
219222
}
@@ -237,7 +240,7 @@ Deletes a specific workspace.
237240

238241
* **`workspace_id`**
239242
(`str | UUID`)
240-
–The workspace identifier.
243+
–The workspace key.
241244

242245
<Accordion title="Source code in dreadnode/api/client.py" icon="code">
243246
```python
@@ -246,7 +249,7 @@ def delete_workspace(self, workspace_id: str | UUID) -> None:
246249
Deletes a specific workspace.
247250
248251
Args:
249-
workspace_id (str | UUID): The workspace identifier.
252+
workspace_id (str | UUID): The workspace key.
250253
"""
251254

252255
self.request("DELETE", f"/workspaces/{workspace_id!s}")
@@ -707,17 +710,15 @@ def get_github_access_token(self, repos: list[str]) -> GithubTokenResponse:
707710
### get\_organization
708711

709712
```python
710-
get_organization(
711-
organization_id: str | UUID,
712-
) -> Organization
713+
get_organization(org_id_or_key: UUID | str) -> Organization
713714
```
714715

715716
Retrieves details of a specific organization.
716717

717718
**Parameters:**
718719

719-
* **`organization_id`**
720-
(`str`)
720+
* **`org_id_or_key`**
721+
(`str | UUID`)
721722
–The organization identifier.
722723

723724
**Returns:**
@@ -727,17 +728,17 @@ Retrieves details of a specific organization.
727728

728729
<Accordion title="Source code in dreadnode/api/client.py" icon="code">
729730
```python
730-
def get_organization(self, organization_id: str | UUID) -> Organization:
731+
def get_organization(self, org_id_or_key: UUID | str) -> Organization:
731732
"""
732733
Retrieves details of a specific organization.
733734
734735
Args:
735-
organization_id (str): The organization identifier.
736+
org_id_or_key (str | UUID): The organization identifier.
736737
737738
Returns:
738739
Organization: The Organization object.
739740
"""
740-
response = self.request("GET", f"/organizations/{organization_id!s}")
741+
response = self.request("GET", f"/organizations/{org_id_or_key!s}")
741742
return Organization(**response.json())
742743
```
743744

@@ -1098,16 +1099,17 @@ def get_user_data_credentials(self) -> UserDataCredentials:
10981099

10991100
```python
11001101
get_workspace(
1101-
workspace_id: str | UUID, org_id: UUID | None = None
1102+
workspace_id_or_key: UUID | str,
1103+
org_id: UUID | None = None,
11021104
) -> Workspace
11031105
```
11041106

11051107
Retrieves details of a specific workspace.
11061108

11071109
**Parameters:**
11081110

1109-
* **`workspace_id`**
1110-
(`str`)
1111+
* **`workspace_id_or_key`**
1112+
(`str | UUID`)
11111113
–The workspace identifier.
11121114

11131115
**Returns:**
@@ -1117,20 +1119,22 @@ Retrieves details of a specific workspace.
11171119

11181120
<Accordion title="Source code in dreadnode/api/client.py" icon="code">
11191121
```python
1120-
def get_workspace(self, workspace_id: str | UUID, org_id: UUID | None = None) -> Workspace:
1122+
def get_workspace(
1123+
self, workspace_id_or_key: UUID | str, org_id: UUID | None = None
1124+
) -> Workspace:
11211125
"""
11221126
Retrieves details of a specific workspace.
11231127
11241128
Args:
1125-
workspace_id (str): The workspace identifier.
1129+
workspace_id_or_key (str | UUID): The workspace identifier.
11261130
11271131
Returns:
11281132
Workspace: The Workspace object.
11291133
"""
11301134
params: dict[str, str] = {}
11311135
if org_id:
11321136
params = {"org_id": str(org_id)}
1133-
response = self.request("GET", f"/workspaces/{workspace_id!s}", params=params)
1137+
response = self.request("GET", f"/workspaces/{workspace_id_or_key!s}", params=params)
11341138
return Workspace(**response.json())
11351139
```
11361140

@@ -1793,6 +1797,14 @@ is_active: bool
17931797

17941798
Is the organization active?
17951799

1800+
### key
1801+
1802+
```python
1803+
key: str
1804+
```
1805+
1806+
URL-friendly identifier for the organization.
1807+
17961808
### max\_members
17971809

17981810
```python
@@ -1809,14 +1821,6 @@ name: str
18091821

18101822
Name of the organization.
18111823

1812-
### slug
1813-
1814-
```python
1815-
slug: str
1816-
```
1817-
1818-
URL-friendly slug for the organization.
1819-
18201824
### updated\_at
18211825

18221826
```python
@@ -2321,6 +2325,14 @@ is_default: bool
23212325

23222326
Is the workspace the default one?
23232327

2328+
### key
2329+
2330+
```python
2331+
key: str
2332+
```
2333+
2334+
Unique key for the workspace.
2335+
23242336
### name
23252337

23262338
```python
@@ -2353,14 +2365,6 @@ project_count: int | None
23532365

23542366
Number of projects in the workspace.
23552367

2356-
### slug
2357-
2358-
```python
2359-
slug: str
2360-
```
2361-
2362-
URL-friendly slug for the workspace.
2363-
23642368
### updated\_at
23652369

23662370
```python

docs/sdk/main.mdx

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,13 @@ in the following order:
173173
1. Environment variables:
174174
2. `DREADNODE_SERVER_URL` or `DREADNODE_SERVER`
175175
3. `DREADNODE_API_TOKEN` or `DREADNODE_API_KEY`
176-
4. Dreadnode profile (from `dreadnode login`)
177-
5. Uses `profile` parameter if provided
178-
6. Falls back to `DREADNODE_PROFILE` environment variable
179-
7. Defaults to active profile
176+
4. `DREADNODE_ORGANIZATION`
177+
5. `DREADNODE_WORKSPACE`
178+
6. `DREADNODE_PROJECT`
179+
7. Dreadnode profile (from `dreadnode login`)
180+
8. Uses `profile` parameter if provided
181+
9. Falls back to `DREADNODE_PROFILE` environment variable
182+
10. Defaults to active profile
180183

181184
**Parameters:**
182185

@@ -214,7 +217,7 @@ in the following order:
214217
(`str | None`, default:
215218
`None`
216219
)
217-
–The default project name to associate all runs with. This can also be in the format `org/workspace/project`.
220+
–The default project name to associate all runs with. This can also be in the format `org/workspace/project` using the keys.
218221
* **`service_name`**
219222
(`str | None`, default:
220223
`None`
@@ -270,6 +273,10 @@ def configure(
270273
1. Environment variables:
271274
- `DREADNODE_SERVER_URL` or `DREADNODE_SERVER`
272275
- `DREADNODE_API_TOKEN` or `DREADNODE_API_KEY`
276+
- `DREADNODE_ORGANIZATION`
277+
- `DREADNODE_WORKSPACE`
278+
- `DREADNODE_PROJECT`
279+
273280
2. Dreadnode profile (from `dreadnode login`)
274281
- Uses `profile` parameter if provided
275282
- Falls back to `DREADNODE_PROFILE` environment variable
@@ -282,7 +289,7 @@ def configure(
282289
local_dir: The local directory to store data in.
283290
organization: The default organization name or ID to use.
284291
workspace: The default workspace name or ID to use.
285-
project: The default project name to associate all runs with. This can also be in the format `org/workspace/project`.
292+
project: The default project name to associate all runs with. This can also be in the format `org/workspace/project` using the keys.
286293
service_name: The service name to use for OpenTelemetry.
287294
service_version: The service version to use for OpenTelemetry.
288295
console: Log span information to the console (`DREADNODE_CONSOLE` or the default is True).
@@ -342,19 +349,8 @@ def configure(
342349
self.local_dir = local_dir
343350

344351
_org, _workspace, _project = self._extract_project_components(project)
345-
346352
self.organization = _org or organization or os.environ.get(ENV_ORGANIZATION)
347-
with contextlib.suppress(ValueError):
348-
self.organization = UUID(
349-
str(self.organization)
350-
) # Now, it's a UUID if possible, else str (name/slug)
351-
352353
self.workspace = _workspace or workspace or os.environ.get(ENV_WORKSPACE)
353-
with contextlib.suppress(ValueError):
354-
self.workspace = UUID(
355-
str(self.workspace)
356-
) # Now, it's a UUID if possible, else str (name/slug)
357-
358354
self.project = _project or project or os.environ.get(ENV_PROJECT)
359355

360356
self.service_name = service_name

docs/sdk/task.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,7 @@ async def run_always(self, *args: P.args, **kwargs: P.kwargs) -> TaskSpan[R]: #
683683

684684
# Log the output
685685

686+
output_object_hash = None
686687
if log_output and (
687688
not isinstance(self.log_inputs, Inherited) or seems_useful_to_serialize(output)
688689
):
@@ -691,13 +692,12 @@ async def run_always(self, *args: P.args, **kwargs: P.kwargs) -> TaskSpan[R]: #
691692
output,
692693
attributes={"auto": True},
693694
)
694-
elif run is not None:
695695
# Link the output to the inputs
696-
for input_object_hash in input_object_hashes:
697-
run.link_objects(output_object_hash, input_object_hash)
698-
699-
if create_run:
700-
run.log_output("output", output, attributes={"auto": True})
696+
if run is not None:
697+
for input_object_hash in input_object_hashes:
698+
run.link_objects(output_object_hash, input_object_hash)
699+
elif run is not None and create_run:
700+
run.log_output("output", output, attributes={"auto": True})
701701

702702
# Score and check assertions
703703

dreadnode/api/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ class Organization(BaseModel):
502502
name: str
503503
"""Name of the organization."""
504504
key: str
505-
"""URL-friendly identifer for the organization."""
505+
"""URL-friendly identifier for the organization."""
506506
description: str | None
507507
"""Description of the organization."""
508508
is_active: bool

0 commit comments

Comments
 (0)