Skip to content

Commit c385566

Browse files
mishushakovtristone13thclaude
authored
fix(python-sdk): correct Sandbox.list() docstring (also lists paused) (#1511)
Integration branch PR for #1500. Merges the docstring fix into `main`. Once #1500 is merged into `python-sdk-list-docstring-base`, this PR will carry those changes into `main`. --------- Co-authored-by: Leinux <tristone13th@outlook.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent d071bb7 commit c385566

4 files changed

Lines changed: 28 additions & 9 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@e2b/python-sdk": patch
3+
"e2b": patch
4+
---
5+
6+
Correct `Sandbox.list()` documentation across both SDKs: it returns a paginator (`SandboxPaginator` / `AsyncSandboxPaginator`), not a list, and by default the server returns sandboxes in both `running` and `paused` states. The docstrings now describe the return type accurately and show how to iterate pages via `paginator.next_items()` / `await paginator.nextItems()` while `paginator.has_next` / `paginator.hasNext` is true. No behavior change.

packages/js-sdk/src/sandbox/index.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,18 @@ export class Sandbox extends SandboxApi {
227227
}
228228

229229
/**
230-
* List all sandboxes.
230+
* List sandboxes.
231231
*
232-
* @param opts connection options.
232+
* By default (no `query.state` set in `opts`), returns sandboxes in both
233+
* `running` and `paused` states. To filter by state, pass
234+
* `opts.query.state = [...]`.
235+
*
236+
* @param opts connection options, plus optional `query` to filter by
237+
* metadata / state and `limit` / `nextToken` for pagination.
233238
*
234-
* @returns paginator for listing sandboxes.
239+
* @returns a {@link SandboxPaginator} that yields pages of sandboxes
240+
* (running and paused by default). Iterate pages via
241+
* `await paginator.nextItems()` while `paginator.hasNext` is `true`.
235242
*/
236243
static list(opts?: SandboxListOpts): SandboxPaginator {
237244
return new SandboxPaginator(opts)

packages/python-sdk/e2b/sandbox_async/sandbox_api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,16 @@ def list(
6363
**opts: Unpack[ApiParams],
6464
) -> AsyncSandboxPaginator:
6565
"""
66-
List all running sandboxes.
66+
List sandboxes.
6767
68-
:param query: Filter the list of sandboxes by metadata or state, e.g. `SandboxListQuery(metadata={"key": "value"})` or `SandboxListQuery(state=[SandboxState.RUNNING])`
68+
By default (no `query.state` set), returns sandboxes in both `running`
69+
and `paused` states. To filter by state, pass `query=SandboxQuery(state=[...])`.
70+
71+
:param query: Filter the list of sandboxes by metadata or state, e.g. `SandboxQuery(metadata={"key": "value"})` or `SandboxQuery(state=[SandboxState.RUNNING])`
6972
:param limit: Maximum number of sandboxes to return per page
7073
:param next_token: Token for pagination
7174
72-
:return: List of running sandboxes
75+
:return: An `AsyncSandboxPaginator` that yields pages of sandboxes (running and paused by default). Iterate pages via `await paginator.next_items()` while `paginator.has_next` is True.
7376
"""
7477
return AsyncSandboxPaginator(
7578
query=query,

packages/python-sdk/e2b/sandbox_sync/sandbox_api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,16 @@ def list(
6262
**opts: Unpack[ApiParams],
6363
) -> SandboxPaginator:
6464
"""
65-
List all running sandboxes.
65+
List sandboxes.
6666
67-
:param query: Filter the list of sandboxes by metadata or state, e.g. `SandboxListQuery(metadata={"key": "value"})` or `SandboxListQuery(state=[SandboxState.RUNNING])`
67+
By default (no `query.state` set), returns sandboxes in both `running`
68+
and `paused` states. To filter by state, pass `query=SandboxQuery(state=[...])`.
69+
70+
:param query: Filter the list of sandboxes by metadata or state, e.g. `SandboxQuery(metadata={"key": "value"})` or `SandboxQuery(state=[SandboxState.RUNNING])`
6871
:param limit: Maximum number of sandboxes to return per page
6972
:param next_token: Token for pagination
7073
71-
:return: List of running sandboxes
74+
:return: A `SandboxPaginator` that yields pages of sandboxes (running and paused by default). Iterate pages via `paginator.next_items()` while `paginator.has_next` is True.
7275
"""
7376
return SandboxPaginator(
7477
query=query,

0 commit comments

Comments
 (0)