Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
chore(sdk): deprecate the sandbox git module (#1774)
devin-ai-integration[bot]d4a7f411fea1
diff --git a/.changeset/quiet-moons-repeat.md b/.changeset/quiet-moons-repeat.mdnew file mode 100644index 000000000..c973891c7--- /dev/null+++ b/.changeset/quiet-moons-repeat.md@@ -0,0 +1,6 @@+---+'e2b': patch+'@e2b/python-sdk': patch+---++Deprecate the sandbox git module (`sandbox.git`) and its public types and errors. Run git through the commands module instead, e.g. `sandbox.commands.run('git clone <url> repo')`. The module keeps working and will be removed in the next major version.diff --git a/packages/js-sdk/src/errors.ts b/packages/js-sdk/src/errors.tsindex 5ae98e06a..e9fbcdc23 100644--- a/packages/js-sdk/src/errors.ts+++ b/packages/js-sdk/src/errors.ts@@ -102,6 +102,8 @@ export class AuthenticationError extends Error {/*** Thrown when git authentication fails.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export class GitAuthError extends AuthenticationError {constructor(message: string) {@@ -112,6 +114,8 @@ export class GitAuthError extends AuthenticationError {/*** Thrown when git upstream tracking is missing.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export class GitUpstreamError extends SandboxError {constructor(message: string) {diff --git a/packages/js-sdk/src/sandbox/git/index.ts b/packages/js-sdk/src/sandbox/git/index.tsindex 2715c7494..82e664d1e 100644--- a/packages/js-sdk/src/sandbox/git/index.ts+++ b/packages/js-sdk/src/sandbox/git/index.ts@@ -32,6 +32,8 @@ const DEFAULT_GIT_ENV: Record<string, string> = {/*** Options for git operations in the sandbox.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitRequestOptsextends Partial<@@ -43,6 +45,8 @@ export interface GitRequestOpts/*** Options for cloning a repository.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitCloneOpts extends GitRequestOpts {/**@@ -75,6 +79,8 @@ export interface GitCloneOpts extends GitRequestOpts {/*** Options for initializing a repository.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitInitOpts extends GitRequestOpts {/**@@ -89,6 +95,8 @@ export interface GitInitOpts extends GitRequestOpts {/*** Options for adding a git remote.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitRemoteAddOpts extends GitRequestOpts {/**@@ -103,6 +111,8 @@ export interface GitRemoteAddOpts extends GitRequestOpts {/*** Options for creating a commit.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitCommitOpts extends GitRequestOpts {/**@@ -121,6 +131,8 @@ export interface GitCommitOpts extends GitRequestOpts {/*** Options for staging files.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitAddOpts extends GitRequestOpts {/**@@ -135,11 +147,15 @@ export interface GitAddOpts extends GitRequestOpts {/*** Supported reset modes.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export type GitResetMode = 'soft' | 'mixed' | 'hard' | 'merge' | 'keep'/*** Options for resetting a repository.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitResetOpts extends GitRequestOpts {/**@@ -158,6 +174,8 @@ export interface GitResetOpts extends GitRequestOpts {/*** Options for restoring files or unstaging changes.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitRestoreOpts extends GitRequestOpts {/**@@ -179,6 +197,8 @@ export interface GitRestoreOpts extends GitRequestOpts {}/*** Options for deleting a branch.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitDeleteBranchOpts extends GitRequestOpts {/**@@ -189,6 +209,8 @@ export interface GitDeleteBranchOpts extends GitRequestOpts {/*** Options for pushing commits.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitPushOpts extends GitRequestOpts {/**@@ -215,6 +237,8 @@ export interface GitPushOpts extends GitRequestOpts {/*** Options for pulling commits.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitPullOpts extends GitRequestOpts {/**@@ -240,6 +264,8 @@ export interface GitPullOpts extends GitRequestOpts {*//*** Options for git config operations.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitConfigOpts extends GitRequestOpts {/**@@ -256,6 +282,8 @@ export interface GitConfigOpts extends GitRequestOpts {/*** Options for dangerously authenticating git globally via the credential helper.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitDangerouslyAuthenticateOpts extends GitRequestOpts {/**@@ -282,6 +310,8 @@ export interface GitDangerouslyAuthenticateOpts extends GitRequestOpts {/*** Module for running git operations in the sandbox.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export class Git {constructor(private readonly commands: Commands) {}diff --git a/packages/js-sdk/src/sandbox/git/utils.ts b/packages/js-sdk/src/sandbox/git/utils.tsindex 6df7fbc88..af587ea06 100644--- a/packages/js-sdk/src/sandbox/git/utils.ts+++ b/packages/js-sdk/src/sandbox/git/utils.ts@@ -4,6 +4,8 @@ import { CommandExitError } from '../commands/commandHandle'/*** Parsed git status entry for a file.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitFileStatus {/**@@ -34,6 +36,8 @@ export interface GitFileStatus {/*** Supported normalized git status labels.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export type GitStatusLabel =| 'conflict'@@ -48,11 +52,15 @@ export type GitStatusLabel =/*** Scope for git config operations.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export type GitConfigScope = 'global' | 'local' | 'system'/*** Parsed git repository status.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitStatus {/**@@ -123,6 +131,8 @@ export interface GitStatus {/*** Parsed git branch list.+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/export interface GitBranches {/**diff --git a/packages/js-sdk/src/sandbox/index.ts b/packages/js-sdk/src/sandbox/index.tsindex f22de94e0..6dd455743 100644--- a/packages/js-sdk/src/sandbox/index.ts+++ b/packages/js-sdk/src/sandbox/index.ts@@ -58,7 +58,6 @@ export interface SandboxUrlOpts {* - Access Linux OS* - Create, list, and delete files and directories* - Run commands- * - Run git operations* - Run isolated code* - Access the internet*@@ -92,6 +91,8 @@ export class Sandbox extends SandboxApi {readonly pty: Pty/*** Module for running git operations in the sandbox+ *+ * @deprecated Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.*/readonly git: Gitdiff --git a/packages/python-sdk/e2b/exceptions.py b/packages/python-sdk/e2b/exceptions.pyindex 7846654da..1ac9689f0 100644--- a/packages/python-sdk/e2b/exceptions.py+++ b/packages/python-sdk/e2b/exceptions.py@@ -88,6 +88,8 @@ class AuthenticationException(Exception):class GitAuthException(AuthenticationException):"""Raised when git authentication fails.++ :deprecated: Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version."""pass@@ -96,6 +98,8 @@ class GitAuthException(AuthenticationException):class GitUpstreamException(SandboxException):"""Raised when git upstream tracking is missing.++ :deprecated: Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version."""passdiff --git a/packages/python-sdk/e2b/sandbox/_git/types.py b/packages/python-sdk/e2b/sandbox/_git/types.pyindex 35006e210..55f4875b9 100644--- a/packages/python-sdk/e2b/sandbox/_git/types.py+++ b/packages/python-sdk/e2b/sandbox/_git/types.py@@ -4,7 +4,10 @@ from typing import List, Optionalfrom typing_extensions import LiteralGitResetMode = Literal["soft", "mixed", "hard", "merge", "keep"]-"""Mode for a git reset operation."""+"""Mode for a git reset operation.++:deprecated: Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.+"""@dataclass@@ -12,6 +15,8 @@ class GitFileStatus:"""Parsed git status entry for a file.+ :deprecated: Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.+:param name: Path relative to the repository root:param status: Normalized status string (e.g. "modified", "added"):param index_status: Index status character from porcelain output@@ -33,6 +38,8 @@ class GitStatus:"""Parsed git repository status.+ :deprecated: Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.+:param current_branch: Current branch name, if available:param upstream: Upstream branch name, if available:param ahead: Number of commits the branch is ahead of upstream@@ -124,6 +131,8 @@ class GitBranches:"""Parsed git branch list.+ :deprecated: Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.+:param branches: List of branch names:param current_branch: Current branch name, if available"""diff --git a/packages/python-sdk/e2b/sandbox_async/git.py b/packages/python-sdk/e2b/sandbox_async/git.pyindex b57fb5a76..a33cb97d8 100644--- a/packages/python-sdk/e2b/sandbox_async/git.py+++ b/packages/python-sdk/e2b/sandbox_async/git.py@@ -49,6 +49,8 @@ DEFAULT_GIT_ENV = {"GIT_TERMINAL_PROMPT": "0"}class Git:"""Async module for running git operations in the sandbox.++ :deprecated: Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version."""def __init__(self, commands: Commands) -> None:diff --git a/packages/python-sdk/e2b/sandbox_async/main.py b/packages/python-sdk/e2b/sandbox_async/main.pyindex 319600875..df3b16387 100644--- a/packages/python-sdk/e2b/sandbox_async/main.py+++ b/packages/python-sdk/e2b/sandbox_async/main.py@@ -94,6 +94,8 @@ class AsyncSandbox(SandboxApi):def git(self) -> Git:"""Module for running git operations in the sandbox.++ :deprecated: Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version."""return self._gitdiff --git a/packages/python-sdk/e2b/sandbox_sync/git.py b/packages/python-sdk/e2b/sandbox_sync/git.pyindex 39edb5c04..9c7b0dc3d 100644--- a/packages/python-sdk/e2b/sandbox_sync/git.py+++ b/packages/python-sdk/e2b/sandbox_sync/git.py@@ -49,6 +49,8 @@ DEFAULT_GIT_ENV = {"GIT_TERMINAL_PROMPT": "0"}class Git:"""Module for running git operations in the sandbox.++ :deprecated: Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version."""def __init__(self, commands: Commands) -> None:diff --git a/packages/python-sdk/e2b/sandbox_sync/main.py b/packages/python-sdk/e2b/sandbox_sync/main.pyindex 2ebda95aa..9c5d40f0d 100644--- a/packages/python-sdk/e2b/sandbox_sync/main.py+++ b/packages/python-sdk/e2b/sandbox_sync/main.py@@ -93,6 +93,8 @@ class Sandbox(SandboxApi):def git(self) -> Git:"""Module for running git operations in the sandbox.++ :deprecated: Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version."""return self._git