fix: align behavior and API surface between the JS and Python SDKs#1411
fix: align behavior and API surface between the JS and Python SDKs#1411mishushakov wants to merge 8 commits into
Conversation
Python: pause()/beta_pause() return bool, get_metrics no longer returns [] in debug mode, kill debug-mode handling matches JS, send_stdin accepts bytes + request_timeout on handle, git.reset GitResetMode + validation, sandbox_url in get_api_params, from_image requires both credentials. JS: getInfo() includes sandboxDomain (getFullInfo internal), fromImage requires both credentials, getBuildStatus logsOffset defaults to 0, requestTimeoutMs 0 disables the timeout. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-sdk-alignment # Conflicts: # packages/python-sdk/e2b/sandbox_sync/sandbox_api.py
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move the debug-mode short-circuit for get_metrics into the instance method (like kill) and implement it in the JS SDK so getMetrics() returns [] in debug mode in both SDKs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…g path Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Matches the Python SDK's single get_info. getInfo now performs the request directly and returns SandboxInfo (incl. sandboxDomain, without the envd access token). The envd access token is still obtained from the create/connect responses, not getInfo. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Implement the debug-mode short-circuit for kill and get_metrics on both the instance methods and the class/static methods (SandboxApi / _cls_*) in JS and Python, so it applies whether called as Sandbox.kill(id) or sandbox.kill(). The API client is never constructed in debug mode (the guard runs first). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ython) - JS: unit-test git.reset invalid mode + remoteAdd/remoteGet guards via a stub command runner (mirrors Python's test_args.py). - JS + Python (sync + async): cover sending bytes/Uint8Array via send_stdin. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR SummaryMedium Risk Overview Python stdin APIs accept Reviewed by Cursor Bugbot for commit 5389f4b. Bugbot is set up for automated code reviews on this repo. Configure here. |
🦋 Changeset detectedLatest commit: 5389f4b The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Package ArtifactsBuilt from ad04efa. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.28.2-mishushakov-python-js-sdk-alignment.0.tgzCLI ( npm install ./e2b-cli-2.11.1-mishushakov-python-js-sdk-alignment.0.tgzPython SDK ( pip install ./e2b-2.27.0+mishushakov.python.js.sdk.alignment-py3-none-any.whl |
|
|
||
| // Set the registry config if provided | ||
| if (credentials) { | ||
| if (!credentials.username || !credentials.password) { |
There was a problem hiding this comment.
probably should do credential check before doing the work above
|
|
||
| # Set the registry config if provided | ||
| if username and password: | ||
| if username or password: |
There was a problem hiding this comment.
slight divergence with the js here; js checks if (credentials) { this checks if username or password: so if username and password are present but falsy, JS will reject but Python will allow
| } | ||
| } | ||
|
|
||
| static async getFullInfo(sandboxId: string, opts?: SandboxApiOpts) { |
There was a problem hiding this comment.
maybe a reason to make major instead of minor but not end of world
Aligns several behavioral and API-surface discrepancies between the JS and Python SDKs found during a cross-SDK audit. Python:
commands.send_stdin/CommandHandle.send_stdinnow acceptbytes(plusrequest_timeouton the handle),git.resetgets a typedGitResetModewith JS-matching validation,sandbox_urlis threaded throughget_api_params(and the deadSandboxOptskey removed), andfrom_imagerequires bothusernameandpasswordwhen credentials are given. JS:getFullInfowas removed in favor of a singlegetInfothat now includessandboxDomain(matching Python'sget_info),fromImagerequires both credentials,getBuildStatusdefaultslogsOffsetto0,getMetrics/killshort-circuit consistently in debug mode (instance + static), andrequestTimeoutMs: 0explicitly disables the request timeout. Tests were added on both sides (git-arg validation, stdin bytes, credential validation, timeout-0, connection config) and the CLI'ssandbox infonow usesgetInfo. See the changeset for the full per-SDK list.Usage examples
🤖 Generated with Claude Code