Skip to content

Refactor Sandbox object in Python#855

Merged
jakubno merged 5 commits intomainfrom
refactor-sandbox-detail
Aug 10, 2025
Merged

Refactor Sandbox object in Python#855
jakubno merged 5 commits intomainfrom
refactor-sandbox-detail

Conversation

@jakubno
Copy link
Copy Markdown
Member

@jakubno jakubno commented Aug 10, 2025

Description

We can simplify typing and return only SandboxInfo in SDKs as the types are very similar (there are some extra fields in detail, which we don't want to expose but we need them e.g. for connect)

@jakubno jakubno self-assigned this Aug 10, 2025
@jakubno jakubno added the Improvement Improvement for current functionality label Aug 10, 2025
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Aug 10, 2025

⚠️ No Changeset found

Latest commit: 4eb56d4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Sync API Method Fails to Handle Errors

The _cls_get_info method in the sync API client is missing error handling for API Error responses, unlike its async counterpart. When the API returns an Error object, the sync method attempts to pass it directly to SandboxInfo._from_sandbox_detail, which expects a SandboxDetail object. This type mismatch will likely result in an AttributeError.

packages/python-sdk/e2b/sandbox_sync/sandbox_api.py#L95-L106

res = get_sandboxes_sandbox_id.sync_detailed(
sandbox_id,
client=api_client,
)
if res.status_code >= 300:
raise handle_api_exception(res)
if res.parsed is None:
raise Exception("Body of the request is None")
return SandboxInfo._from_sandbox_detail(res.parsed)

Fix in Cursor Fix in Web

Comment @cursor review or bugbot run to trigger another review on this PR

@jakubno jakubno merged commit 1aee7c8 into main Aug 10, 2025
7 of 8 checks passed
@jakubno jakubno deleted the refactor-sandbox-detail branch August 10, 2025 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Improvement Improvement for current functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants