Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Add python tests

Jakub Novak2f21c73a84d3
diff --git a/packages/python-sdk/connect/client.py b/packages/python-sdk/connect/client.py
index bef973e30..5fdfddd62 100644
--- a/packages/python-sdk/connect/client.py
+++ b/packages/python-sdk/connect/client.py
@@ -60,7 +60,6 @@ def error_for_response(http_resp: httpcore.Response):
try:
error = json.loads(http_resp.content)
except (json.decoder.JSONDecodeError, KeyError):
-
if http_resp.status == 429:
return ConnectException(
Code.resource_exhausted,
diff --git a/packages/python-sdk/e2b/envd/filesystem/filesystem_connect.py b/packages/python-sdk/e2b/envd/filesystem/filesystem_connect.py
index 618705e67..652c5206d 100644
--- a/packages/python-sdk/e2b/envd/filesystem/filesystem_connect.py
+++ b/packages/python-sdk/e2b/envd/filesystem/filesystem_connect.py
@@ -16,7 +16,7 @@ class FilesystemClient:
response_type=filesystem_dot_filesystem__pb2.StatResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
self._make_dir = connect.Client(
pool=pool,
@@ -24,7 +24,7 @@ class FilesystemClient:
response_type=filesystem_dot_filesystem__pb2.MakeDirResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
self._move = connect.Client(
pool=pool,
@@ -32,7 +32,7 @@ class FilesystemClient:
response_type=filesystem_dot_filesystem__pb2.MoveResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
self._list_dir = connect.Client(
pool=pool,
@@ -40,7 +40,7 @@ class FilesystemClient:
response_type=filesystem_dot_filesystem__pb2.ListDirResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
self._watch_dir = connect.Client(
pool=pool,
@@ -48,7 +48,7 @@ class FilesystemClient:
response_type=filesystem_dot_filesystem__pb2.WatchDirResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
self._remove = connect.Client(
pool=pool,
@@ -56,23 +56,35 @@ class FilesystemClient:
response_type=filesystem_dot_filesystem__pb2.RemoveResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
- def stat(self, req: filesystem_dot_filesystem__pb2.StatRequest, **opts) -> filesystem_dot_filesystem__pb2.StatResponse:
+ def stat(
+ self, req: filesystem_dot_filesystem__pb2.StatRequest, **opts
+ ) -> filesystem_dot_filesystem__pb2.StatResponse:
return self._stat.call_unary(req, **opts)
- def make_dir(self, req: filesystem_dot_filesystem__pb2.MakeDirRequest, **opts) -> filesystem_dot_filesystem__pb2.MakeDirResponse:
+ def make_dir(
+ self, req: filesystem_dot_filesystem__pb2.MakeDirRequest, **opts
+ ) -> filesystem_dot_filesystem__pb2.MakeDirResponse:
return self._make_dir.call_unary(req, **opts)
- def move(self, req: filesystem_dot_filesystem__pb2.MoveRequest, **opts) -> filesystem_dot_filesystem__pb2.MoveResponse:
+ def move(
+ self, req: filesystem_dot_filesystem__pb2.MoveRequest, **opts
+ ) -> filesystem_dot_filesystem__pb2.MoveResponse:
return self._move.call_unary(req, **opts)
- def list_dir(self, req: filesystem_dot_filesystem__pb2.ListDirRequest, **opts) -> filesystem_dot_filesystem__pb2.ListDirResponse:
+ def list_dir(
+ self, req: filesystem_dot_filesystem__pb2.ListDirRequest, **opts
+ ) -> filesystem_dot_filesystem__pb2.ListDirResponse:
return self._list_dir.call_unary(req, **opts)
- def watch_dir(self, req: filesystem_dot_filesystem__pb2.WatchDirRequest , **opts) -> Generator[filesystem_dot_filesystem__pb2.WatchDirResponse, Any, None]:
+ def watch_dir(
+ self, req: filesystem_dot_filesystem__pb2.WatchDirRequest, **opts
+ ) -> Generator[filesystem_dot_filesystem__pb2.WatchDirResponse, Any, None]:
return self._watch_dir.call_server_stream(req, **opts)
- def remove(self, req: filesystem_dot_filesystem__pb2.RemoveRequest, **opts) -> filesystem_dot_filesystem__pb2.RemoveResponse:
+ def remove(
+ self, req: filesystem_dot_filesystem__pb2.RemoveRequest, **opts
+ ) -> filesystem_dot_filesystem__pb2.RemoveResponse:
return self._remove.call_unary(req, **opts)
diff --git a/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.py b/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.py
index bfd24c5f2..dd562c02a 100644
--- a/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.py
+++ b/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.py
@@ -7,57 +7,62 @@ from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
+
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
-
-
-DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x66ilesystem/filesystem.proto\x12\nfilesystem\"G\n\x0bMoveRequest\x12\x16\n\x06source\x18\x01 \x01(\tR\x06source\x12 \n\x0b\x64\x65stination\x18\x02 \x01(\tR\x0b\x64\x65stination\"\x0e\n\x0cMoveResponse\"$\n\x0eMakeDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\"\x11\n\x0fMakeDirResponse\"#\n\rRemoveRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\"\x10\n\x0eRemoveResponse\"!\n\x0bStatRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\";\n\x0cStatResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry\"I\n\tEntryInfo\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12(\n\x04type\x18\x02 \x01(\x0e\x32\x14.filesystem.FileTypeR\x04type\"$\n\x0eListDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\"B\n\x0fListDirResponse\x12/\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x15.filesystem.EntryInfoR\x07\x65ntries\"%\n\x0fWatchDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\"\xe1\x02\n\x10WatchDirResponse\x12?\n\x05start\x18\x01 \x01(\x0b\x32\'.filesystem.WatchDirResponse.StartEventH\x00R\x05start\x12N\n\nfilesystem\x18\x02 \x01(\x0b\x32,.filesystem.WatchDirResponse.FilesystemEventH\x00R\nfilesystem\x12\x46\n\tkeepalive\x18\x03 \x01(\x0b\x32&.filesystem.WatchDirResponse.KeepAliveH\x00R\tkeepalive\x1a\x0c\n\nStartEvent\x1aP\n\x0f\x46ilesystemEvent\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.filesystem.EventTypeR\x04type\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent*R\n\x08\x46ileType\x12\x19\n\x15\x46ILE_TYPE_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x46ILE_TYPE_FILE\x10\x01\x12\x17\n\x13\x46ILE_TYPE_DIRECTORY\x10\x02*\x98\x01\n\tEventType\x12\x1a\n\x16\x45VENT_TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x45VENT_TYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENT_TYPE_WRITE\x10\x02\x12\x15\n\x11\x45VENT_TYPE_REMOVE\x10\x03\x12\x15\n\x11\x45VENT_TYPE_RENAME\x10\x04\x12\x14\n\x10\x45VENT_TYPE_CHMOD\x10\x05\x32\x94\x03\n\nFilesystem\x12\x39\n\x04Stat\x12\x17.filesystem.StatRequest\x1a\x18.filesystem.StatResponse\x12\x42\n\x07MakeDir\x12\x1a.filesystem.MakeDirRequest\x1a\x1b.filesystem.MakeDirResponse\x12\x39\n\x04Move\x12\x17.filesystem.MoveRequest\x1a\x18.filesystem.MoveResponse\x12\x42\n\x07ListDir\x12\x1a.filesystem.ListDirRequest\x1a\x1b.filesystem.ListDirResponse\x12G\n\x08WatchDir\x12\x1b.filesystem.WatchDirRequest\x1a\x1c.filesystem.WatchDirResponse0\x01\x12?\n\x06Remove\x12\x19.filesystem.RemoveRequest\x1a\x1a.filesystem.RemoveResponseBi\n\x0e\x63om.filesystemB\x0f\x46ilesystemProtoP\x01\xa2\x02\x03\x46XX\xaa\x02\nFilesystem\xca\x02\nFilesystem\xe2\x02\x16\x46ilesystem\\GPBMetadata\xea\x02\nFilesystemb\x06proto3')
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
+ b'\n\x1b\x66ilesystem/filesystem.proto\x12\nfilesystem"G\n\x0bMoveRequest\x12\x16\n\x06source\x18\x01 \x01(\tR\x06source\x12 \n\x0b\x64\x65stination\x18\x02 \x01(\tR\x0b\x64\x65stination"\x0e\n\x0cMoveResponse"$\n\x0eMakeDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"\x11\n\x0fMakeDirResponse"#\n\rRemoveRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"\x10\n\x0eRemoveResponse"!\n\x0bStatRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path";\n\x0cStatResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry"I\n\tEntryInfo\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12(\n\x04type\x18\x02 \x01(\x0e\x32\x14.filesystem.FileTypeR\x04type"$\n\x0eListDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"B\n\x0fListDirResponse\x12/\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x15.filesystem.EntryInfoR\x07\x65ntries"%\n\x0fWatchDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"\xe1\x02\n\x10WatchDirResponse\x12?\n\x05start\x18\x01 \x01(\x0b\x32\'.filesystem.WatchDirResponse.StartEventH\x00R\x05start\x12N\n\nfilesystem\x18\x02 \x01(\x0b\x32,.filesystem.WatchDirResponse.FilesystemEventH\x00R\nfilesystem\x12\x46\n\tkeepalive\x18\x03 \x01(\x0b\x32&.filesystem.WatchDirResponse.KeepAliveH\x00R\tkeepalive\x1a\x0c\n\nStartEvent\x1aP\n\x0f\x46ilesystemEvent\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.filesystem.EventTypeR\x04type\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent*R\n\x08\x46ileType\x12\x19\n\x15\x46ILE_TYPE_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x46ILE_TYPE_FILE\x10\x01\x12\x17\n\x13\x46ILE_TYPE_DIRECTORY\x10\x02*\x98\x01\n\tEventType\x12\x1a\n\x16\x45VENT_TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x45VENT_TYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENT_TYPE_WRITE\x10\x02\x12\x15\n\x11\x45VENT_TYPE_REMOVE\x10\x03\x12\x15\n\x11\x45VENT_TYPE_RENAME\x10\x04\x12\x14\n\x10\x45VENT_TYPE_CHMOD\x10\x05\x32\x94\x03\n\nFilesystem\x12\x39\n\x04Stat\x12\x17.filesystem.StatRequest\x1a\x18.filesystem.StatResponse\x12\x42\n\x07MakeDir\x12\x1a.filesystem.MakeDirRequest\x1a\x1b.filesystem.MakeDirResponse\x12\x39\n\x04Move\x12\x17.filesystem.MoveRequest\x1a\x18.filesystem.MoveResponse\x12\x42\n\x07ListDir\x12\x1a.filesystem.ListDirRequest\x1a\x1b.filesystem.ListDirResponse\x12G\n\x08WatchDir\x12\x1b.filesystem.WatchDirRequest\x1a\x1c.filesystem.WatchDirResponse0\x01\x12?\n\x06Remove\x12\x19.filesystem.RemoveRequest\x1a\x1a.filesystem.RemoveResponseBi\n\x0e\x63om.filesystemB\x0f\x46ilesystemProtoP\x01\xa2\x02\x03\x46XX\xaa\x02\nFilesystem\xca\x02\nFilesystem\xe2\x02\x16\x46ilesystem\\GPBMetadata\xea\x02\nFilesystemb\x06proto3'
+)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'filesystem.filesystem_pb2', _globals)
+_builder.BuildTopDescriptorsAndMessages(
+ DESCRIPTOR, "filesystem.filesystem_pb2", _globals
+)
if not _descriptor._USE_C_DESCRIPTORS:
- _globals['DESCRIPTOR']._loaded_options = None
- _globals['DESCRIPTOR']._serialized_options = b'\n\016com.filesystemB\017FilesystemProtoP\001\242\002\003FXX\252\002\nFilesystem\312\002\nFilesystem\342\002\026Filesystem\\GPBMetadata\352\002\nFilesystem'
- _globals['_FILETYPE']._serialized_start=916
- _globals['_FILETYPE']._serialized_end=998
- _globals['_EVENTTYPE']._serialized_start=1001
- _globals['_EVENTTYPE']._serialized_end=1153
- _globals['_MOVEREQUEST']._serialized_start=43
- _globals['_MOVEREQUEST']._serialized_end=114
- _globals['_MOVERESPONSE']._serialized_start=116
- _globals['_MOVERESPONSE']._serialized_end=130
- _globals['_MAKEDIRREQUEST']._serialized_start=132
- _globals['_MAKEDIRREQUEST']._serialized_end=168
- _globals['_MAKEDIRRESPONSE']._serialized_start=170
- _globals['_MAKEDIRRESPONSE']._serialized_end=187
- _globals['_REMOVEREQUEST']._serialized_start=189
- _globals['_REMOVEREQUEST']._serialized_end=224
- _globals['_REMOVERESPONSE']._serialized_start=226
- _globals['_REMOVERESPONSE']._serialized_end=242
- _globals['_STATREQUEST']._serialized_start=244
- _globals['_STATREQUEST']._serialized_end=277
- _globals['_STATRESPONSE']._serialized_start=279
- _globals['_STATRESPONSE']._serialized_end=338
- _globals['_ENTRYINFO']._serialized_start=340
- _globals['_ENTRYINFO']._serialized_end=413
- _globals['_LISTDIRREQUEST']._serialized_start=415
- _globals['_LISTDIRREQUEST']._serialized_end=451
- _globals['_LISTDIRRESPONSE']._serialized_start=453
- _globals['_LISTDIRRESPONSE']._serialized_end=519
- _globals['_WATCHDIRREQUEST']._serialized_start=521
- _globals['_WATCHDIRREQUEST']._serialized_end=558
- _globals['_WATCHDIRRESPONSE']._serialized_start=561
- _globals['_WATCHDIRRESPONSE']._serialized_end=914
- _globals['_WATCHDIRRESPONSE_STARTEVENT']._serialized_start=798
- _globals['_WATCHDIRRESPONSE_STARTEVENT']._serialized_end=810
- _globals['_WATCHDIRRESPONSE_FILESYSTEMEVENT']._serialized_start=812
- _globals['_WATCHDIRRESPONSE_FILESYSTEMEVENT']._serialized_end=892
- _globals['_WATCHDIRRESPONSE_KEEPALIVE']._serialized_start=894
- _globals['_WATCHDIRRESPONSE_KEEPALIVE']._serialized_end=905
- _globals['_FILESYSTEM']._serialized_start=1156
- _globals['_FILESYSTEM']._serialized_end=1560
+ _globals["DESCRIPTOR"]._loaded_options = None
+ _globals[
+ "DESCRIPTOR"
+ ]._serialized_options = b"\n\016com.filesystemB\017FilesystemProtoP\001\242\002\003FXX\252\002\nFilesystem\312\002\nFilesystem\342\002\026Filesystem\\GPBMetadata\352\002\nFilesystem"
+ _globals["_FILETYPE"]._serialized_start = 916
+ _globals["_FILETYPE"]._serialized_end = 998
+ _globals["_EVENTTYPE"]._serialized_start = 1001
+ _globals["_EVENTTYPE"]._serialized_end = 1153
+ _globals["_MOVEREQUEST"]._serialized_start = 43
+ _globals["_MOVEREQUEST"]._serialized_end = 114
+ _globals["_MOVERESPONSE"]._serialized_start = 116
+ _globals["_MOVERESPONSE"]._serialized_end = 130
+ _globals["_MAKEDIRREQUEST"]._serialized_start = 132
+ _globals["_MAKEDIRREQUEST"]._serialized_end = 168
+ _globals["_MAKEDIRRESPONSE"]._serialized_start = 170
+ _globals["_MAKEDIRRESPONSE"]._serialized_end = 187
+ _globals["_REMOVEREQUEST"]._serialized_start = 189
+ _globals["_REMOVEREQUEST"]._serialized_end = 224
+ _globals["_REMOVERESPONSE"]._serialized_start = 226
+ _globals["_REMOVERESPONSE"]._serialized_end = 242
+ _globals["_STATREQUEST"]._serialized_start = 244
+ _globals["_STATREQUEST"]._serialized_end = 277
+ _globals["_STATRESPONSE"]._serialized_start = 279
+ _globals["_STATRESPONSE"]._serialized_end = 338
+ _globals["_ENTRYINFO"]._serialized_start = 340
+ _globals["_ENTRYINFO"]._serialized_end = 413
+ _globals["_LISTDIRREQUEST"]._serialized_start = 415
+ _globals["_LISTDIRREQUEST"]._serialized_end = 451
+ _globals["_LISTDIRRESPONSE"]._serialized_start = 453
+ _globals["_LISTDIRRESPONSE"]._serialized_end = 519
+ _globals["_WATCHDIRREQUEST"]._serialized_start = 521
+ _globals["_WATCHDIRREQUEST"]._serialized_end = 558
+ _globals["_WATCHDIRRESPONSE"]._serialized_start = 561
+ _globals["_WATCHDIRRESPONSE"]._serialized_end = 914
+ _globals["_WATCHDIRRESPONSE_STARTEVENT"]._serialized_start = 798
+ _globals["_WATCHDIRRESPONSE_STARTEVENT"]._serialized_end = 810
+ _globals["_WATCHDIRRESPONSE_FILESYSTEMEVENT"]._serialized_start = 812
+ _globals["_WATCHDIRRESPONSE_FILESYSTEMEVENT"]._serialized_end = 892
+ _globals["_WATCHDIRRESPONSE_KEEPALIVE"]._serialized_start = 894
+ _globals["_WATCHDIRRESPONSE_KEEPALIVE"]._serialized_end = 905
+ _globals["_FILESYSTEM"]._serialized_start = 1156
+ _globals["_FILESYSTEM"]._serialized_end = 1560
# @@protoc_insertion_point(module_scope)
diff --git a/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyi b/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyi
index 5972b4714..ca59c22a2 100644
--- a/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyi
+++ b/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyi
@@ -2,7 +2,13 @@ from google.protobuf.internal import containers as _containers
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
-from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
+from typing import (
+ ClassVar as _ClassVar,
+ Iterable as _Iterable,
+ Mapping as _Mapping,
+ Optional as _Optional,
+ Union as _Union,
+)
DESCRIPTOR: _descriptor.FileDescriptor
@@ -20,6 +26,7 @@ class EventType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
EVENT_TYPE_REMOVE: _ClassVar[EventType]
EVENT_TYPE_RENAME: _ClassVar[EventType]
EVENT_TYPE_CHMOD: _ClassVar[EventType]
+
FILE_TYPE_UNSPECIFIED: FileType
FILE_TYPE_FILE: FileType
FILE_TYPE_DIRECTORY: FileType
@@ -36,7 +43,9 @@ class MoveRequest(_message.Message):
DESTINATION_FIELD_NUMBER: _ClassVar[int]
source: str
destination: str
- def __init__(self, source: _Optional[str] = ..., destination: _Optional[str] = ...) -> None: ...
+ def __init__(
+ self, source: _Optional[str] = ..., destination: _Optional[str] = ...
+ ) -> None: ...
class MoveResponse(_message.Message):
__slots__ = ()
@@ -80,7 +89,9 @@ class EntryInfo(_message.Message):
TYPE_FIELD_NUMBER: _ClassVar[int]
name: str
type: FileType
- def __init__(self, name: _Optional[str] = ..., type: _Optional[_Union[FileType, str]] = ...) -> None: ...
+ def __init__(
+ self, name: _Optional[str] = ..., type: _Optional[_Union[FileType, str]] = ...
+ ) -> None: ...
class ListDirRequest(_message.Message):
__slots__ = ("path",)
@@ -92,7 +103,9 @@ class ListDirResponse(_message.Message):
__slots__ = ("entries",)
ENTRIES_FIELD_NUMBER: _ClassVar[int]
entries: _containers.RepeatedCompositeFieldContainer[EntryInfo]
- def __init__(self, entries: _Optional[_Iterable[_Union[EntryInfo, _Mapping]]] = ...) -> None: ...
+ def __init__(
+ self, entries: _Optional[_Iterable[_Union[EntryInfo, _Mapping]]] = ...
+ ) -> None: ...
class WatchDirRequest(_message.Message):
__slots__ = ("path",)
@@ -102,16 +115,23 @@ class WatchDirRequest(_message.Message):
class WatchDirResponse(_message.Message):
__slots__ = ("start", "filesystem", "keepalive")
+
class StartEvent(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...
+
class FilesystemEvent(_message.Message):
__slots__ = ("name", "type")
NAME_FIELD_NUMBER: _ClassVar[int]
TYPE_FIELD_NUMBER: _ClassVar[int]
name: str
type: EventType
- def __init__(self, name: _Optional[str] = ..., type: _Optional[_Union[EventType, str]] = ...) -> None: ...
+ def __init__(
+ self,
+ name: _Optional[str] = ...,
+ type: _Optional[_Union[EventType, str]] = ...,
+ ) -> None: ...
+
class KeepAlive(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...
@@ -121,4 +141,9 @@ class WatchDirResponse(_message.Message):
start: WatchDirResponse.StartEvent
filesystem: WatchDirResponse.FilesystemEvent
keepalive: WatchDirResponse.KeepAlive
- def __init__(self, start: _Optional[_Union[WatchDirResponse.StartEvent, _Mapping]] = ..., filesystem: _Optional[_Union[WatchDirResponse.FilesystemEvent, _Mapping]] = ..., keepalive: _Optional[_Union[WatchDirResponse.KeepAlive, _Mapping]] = ...) -> None: ...
+ def __init__(
+ self,
+ start: _Optional[_Union[WatchDirResponse.StartEvent, _Mapping]] = ...,
+ filesystem: _Optional[_Union[WatchDirResponse.FilesystemEvent, _Mapping]] = ...,
+ keepalive: _Optional[_Union[WatchDirResponse.KeepAlive, _Mapping]] = ...,
+ ) -> None: ...
diff --git a/packages/python-sdk/e2b/envd/process/process_connect.py b/packages/python-sdk/e2b/envd/process/process_connect.py
index 7a1f8ab04..d9ef4ba1a 100644
--- a/packages/python-sdk/e2b/envd/process/process_connect.py
+++ b/packages/python-sdk/e2b/envd/process/process_connect.py
@@ -16,7 +16,7 @@ class ProcessClient:
response_type=process_dot_process__pb2.ListResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
self._connect = connect.Client(
pool=pool,
@@ -24,7 +24,7 @@ class ProcessClient:
response_type=process_dot_process__pb2.ConnectResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
self._start = connect.Client(
pool=pool,
@@ -32,7 +32,7 @@ class ProcessClient:
response_type=process_dot_process__pb2.StartResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
self._update = connect.Client(
pool=pool,
@@ -40,7 +40,7 @@ class ProcessClient:
response_type=process_dot_process__pb2.UpdateResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
self._stream_input = connect.Client(
pool=pool,
@@ -48,7 +48,7 @@ class ProcessClient:
response_type=process_dot_process__pb2.StreamInputResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
self._send_input = connect.Client(
pool=pool,
@@ -56,7 +56,7 @@ class ProcessClient:
response_type=process_dot_process__pb2.SendInputResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
self._send_signal = connect.Client(
pool=pool,
@@ -64,26 +64,40 @@ class ProcessClient:
response_type=process_dot_process__pb2.SendSignalResponse,
compressor=compressor,
json=json,
- **opts
+ **opts,
)
- def list(self, req: process_dot_process__pb2.ListRequest, **opts) -> process_dot_process__pb2.ListResponse:
+ def list(
+ self, req: process_dot_process__pb2.ListRequest, **opts
+ ) -> process_dot_process__pb2.ListResponse:
return self._list.call_unary(req, **opts)
- def connect(self, req: process_dot_process__pb2.ConnectRequest , **opts) -> Generator[process_dot_process__pb2.ConnectResponse, Any, None]:
+ def connect(
+ self, req: process_dot_process__pb2.ConnectRequest, **opts
+ ) -> Generator[process_dot_process__pb2.ConnectResponse, Any, None]:
return self._connect.call_server_stream(req, **opts)
- def start(self, req: process_dot_process__pb2.StartRequest , **opts) -> Generator[process_dot_process__pb2.StartResponse, Any, None]:
+ def start(
+ self, req: process_dot_process__pb2.StartRequest, **opts
+ ) -> Generator[process_dot_process__pb2.StartResponse, Any, None]:
return self._start.call_server_stream(req, **opts)
- def update(self, req: process_dot_process__pb2.UpdateRequest, **opts) -> process_dot_process__pb2.UpdateResponse:
+ def update(
+ self, req: process_dot_process__pb2.UpdateRequest, **opts
+ ) -> process_dot_process__pb2.UpdateResponse:
return self._update.call_unary(req, **opts)
- def stream_input(self, req: process_dot_process__pb2.StreamInputRequest, **opts) -> process_dot_process__pb2.StreamInputResponse:
+ def stream_input(
+ self, req: process_dot_process__pb2.StreamInputRequest, **opts
+ ) -> process_dot_process__pb2.StreamInputResponse:
return self._stream_input.call_client_stream(req, **opts)
- def send_input(self, req: process_dot_process__pb2.SendInputRequest, **opts) -> process_dot_process__pb2.SendInputResponse:
+ def send_input(
+ self, req: process_dot_process__pb2.SendInputRequest, **opts
+ ) -> process_dot_process__pb2.SendInputResponse:
return self._send_input.call_unary(req, **opts)
- def send_signal(self, req: process_dot_process__pb2.SendSignalRequest, **opts) -> process_dot_process__pb2.SendSignalResponse:
+ def send_signal(
+ self, req: process_dot_process__pb2.SendSignalRequest, **opts
+ ) -> process_dot_process__pb2.SendSignalResponse:
return self._send_signal.call_unary(req, **opts)
diff --git a/packages/python-sdk/e2b/envd/process/process_pb2.py b/packages/python-sdk/e2b/envd/process/process_pb2.py
index 4b2ed2219..22f2cdd34 100644
--- a/packages/python-sdk/e2b/envd/process/process_pb2.py
+++ b/packages/python-sdk/e2b/envd/process/process_pb2.py
@@ -7,83 +7,86 @@ from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
+
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
-
-
-DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15process/process.proto\x12\x07process\"\\\n\x03PTY\x12%\n\x04size\x18\x01 \x01(\x0b\x32\x11.process.PTY.SizeR\x04size\x1a.\n\x04Size\x12\x12\n\x04\x63ols\x18\x01 \x01(\rR\x04\x63ols\x12\x12\n\x04rows\x18\x02 \x01(\rR\x04rows\"\xc3\x01\n\rProcessConfig\x12\x10\n\x03\x63md\x18\x01 \x01(\tR\x03\x63md\x12\x12\n\x04\x61rgs\x18\x02 \x03(\tR\x04\x61rgs\x12\x34\n\x04\x65nvs\x18\x03 \x03(\x0b\x32 .process.ProcessConfig.EnvsEntryR\x04\x65nvs\x12\x15\n\x03\x63wd\x18\x04 \x01(\tH\x00R\x03\x63wd\x88\x01\x01\x1a\x37\n\tEnvsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\x06\n\x04_cwd\"\r\n\x0bListRequest\"n\n\x0bProcessInfo\x12.\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x16.process.ProcessConfigR\x06\x63onfig\x12\x10\n\x03pid\x18\x02 \x01(\rR\x03pid\x12\x15\n\x03tag\x18\x03 \x01(\tH\x00R\x03tag\x88\x01\x01\x42\x06\n\x04_tag\"B\n\x0cListResponse\x12\x32\n\tprocesses\x18\x01 \x03(\x0b\x32\x14.process.ProcessInfoR\tprocesses\"\x8c\x01\n\x0cStartRequest\x12\x30\n\x07process\x18\x01 \x01(\x0b\x32\x16.process.ProcessConfigR\x07process\x12#\n\x03pty\x18\x02 \x01(\x0b\x32\x0c.process.PTYH\x00R\x03pty\x88\x01\x01\x12\x15\n\x03tag\x18\x03 \x01(\tH\x01R\x03tag\x88\x01\x01\x42\x06\n\x04_ptyB\x06\n\x04_tag\"p\n\rUpdateRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x12#\n\x03pty\x18\x02 \x01(\x0b\x32\x0c.process.PTYH\x00R\x03pty\x88\x01\x01\x42\x06\n\x04_pty\"\x10\n\x0eUpdateResponse\"\x87\x04\n\x0cProcessEvent\x12\x38\n\x05start\x18\x01 \x01(\x0b\x32 .process.ProcessEvent.StartEventH\x00R\x05start\x12\x35\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x1f.process.ProcessEvent.DataEventH\x00R\x04\x64\x61ta\x12\x32\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x1e.process.ProcessEvent.EndEventH\x00R\x03\x65nd\x12?\n\tkeepalive\x18\x04 \x01(\x0b\x32\x1f.process.ProcessEvent.KeepAliveH\x00R\tkeepalive\x1a\x1e\n\nStartEvent\x12\x10\n\x03pid\x18\x01 \x01(\rR\x03pid\x1a]\n\tDataEvent\x12\x18\n\x06stdout\x18\x01 \x01(\x0cH\x00R\x06stdout\x12\x18\n\x06stderr\x18\x02 \x01(\x0cH\x00R\x06stderr\x12\x12\n\x03pty\x18\x03 \x01(\x0cH\x00R\x03ptyB\x08\n\x06output\x1a|\n\x08\x45ndEvent\x12\x1b\n\texit_code\x18\x01 \x01(\x11R\x08\x65xitCode\x12\x16\n\x06\x65xited\x18\x02 \x01(\x08R\x06\x65xited\x12\x16\n\x06status\x18\x03 \x01(\tR\x06status\x12\x19\n\x05\x65rror\x18\x04 \x01(\tH\x00R\x05\x65rror\x88\x01\x01\x42\x08\n\x06_error\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent\"<\n\rStartResponse\x12+\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x15.process.ProcessEventR\x05\x65vent\">\n\x0f\x43onnectResponse\x12+\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x15.process.ProcessEventR\x05\x65vent\"s\n\x10SendInputRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x12+\n\x05input\x18\x02 \x01(\x0b\x32\x15.process.ProcessInputR\x05input\"\x13\n\x11SendInputResponse\"C\n\x0cProcessInput\x12\x16\n\x05stdin\x18\x01 \x01(\x0cH\x00R\x05stdin\x12\x12\n\x03pty\x18\x02 \x01(\x0cH\x00R\x03ptyB\x07\n\x05input\"\xea\x02\n\x12StreamInputRequest\x12>\n\x05start\x18\x01 \x01(\x0b\x32&.process.StreamInputRequest.StartEventH\x00R\x05start\x12;\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32%.process.StreamInputRequest.DataEventH\x00R\x04\x64\x61ta\x12\x45\n\tkeepalive\x18\x03 \x01(\x0b\x32%.process.StreamInputRequest.KeepAliveH\x00R\tkeepalive\x1a@\n\nStartEvent\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x1a\x38\n\tDataEvent\x12+\n\x05input\x18\x02 \x01(\x0b\x32\x15.process.ProcessInputR\x05input\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent\"\x15\n\x13StreamInputResponse\"p\n\x11SendSignalRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x12\'\n\x06signal\x18\x02 \x01(\x0e\x32\x0f.process.SignalR\x06signal\"\x14\n\x12SendSignalResponse\"D\n\x0e\x43onnectRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\"E\n\x0fProcessSelector\x12\x12\n\x03pid\x18\x01 \x01(\rH\x00R\x03pid\x12\x12\n\x03tag\x18\x02 \x01(\tH\x00R\x03tagB\n\n\x08selector*H\n\x06Signal\x12\x16\n\x12SIGNAL_UNSPECIFIED\x10\x00\x12\x12\n\x0eSIGNAL_SIGTERM\x10\x0f\x12\x12\n\x0eSIGNAL_SIGKILL\x10\t2\xca\x03\n\x07Process\x12\x33\n\x04List\x12\x14.process.ListRequest\x1a\x15.process.ListResponse\x12>\n\x07\x43onnect\x12\x17.process.ConnectRequest\x1a\x18.process.ConnectResponse0\x01\x12\x38\n\x05Start\x12\x15.process.StartRequest\x1a\x16.process.StartResponse0\x01\x12\x39\n\x06Update\x12\x16.process.UpdateRequest\x1a\x17.process.UpdateResponse\x12J\n\x0bStreamInput\x12\x1b.process.StreamInputRequest\x1a\x1c.process.StreamInputResponse(\x01\x12\x42\n\tSendInput\x12\x19.process.SendInputRequest\x1a\x1a.process.SendInputResponse\x12\x45\n\nSendSignal\x12\x1a.process.SendSignalRequest\x1a\x1b.process.SendSignalResponseBW\n\x0b\x63om.processB\x0cProcessProtoP\x01\xa2\x02\x03PXX\xaa\x02\x07Process\xca\x02\x07Process\xe2\x02\x13Process\\GPBMetadata\xea\x02\x07Processb\x06proto3')
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
+ b'\n\x15process/process.proto\x12\x07process"\\\n\x03PTY\x12%\n\x04size\x18\x01 \x01(\x0b\x32\x11.process.PTY.SizeR\x04size\x1a.\n\x04Size\x12\x12\n\x04\x63ols\x18\x01 \x01(\rR\x04\x63ols\x12\x12\n\x04rows\x18\x02 \x01(\rR\x04rows"\xc3\x01\n\rProcessConfig\x12\x10\n\x03\x63md\x18\x01 \x01(\tR\x03\x63md\x12\x12\n\x04\x61rgs\x18\x02 \x03(\tR\x04\x61rgs\x12\x34\n\x04\x65nvs\x18\x03 \x03(\x0b\x32 .process.ProcessConfig.EnvsEntryR\x04\x65nvs\x12\x15\n\x03\x63wd\x18\x04 \x01(\tH\x00R\x03\x63wd\x88\x01\x01\x1a\x37\n\tEnvsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\x06\n\x04_cwd"\r\n\x0bListRequest"n\n\x0bProcessInfo\x12.\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x16.process.ProcessConfigR\x06\x63onfig\x12\x10\n\x03pid\x18\x02 \x01(\rR\x03pid\x12\x15\n\x03tag\x18\x03 \x01(\tH\x00R\x03tag\x88\x01\x01\x42\x06\n\x04_tag"B\n\x0cListResponse\x12\x32\n\tprocesses\x18\x01 \x03(\x0b\x32\x14.process.ProcessInfoR\tprocesses"\x8c\x01\n\x0cStartRequest\x12\x30\n\x07process\x18\x01 \x01(\x0b\x32\x16.process.ProcessConfigR\x07process\x12#\n\x03pty\x18\x02 \x01(\x0b\x32\x0c.process.PTYH\x00R\x03pty\x88\x01\x01\x12\x15\n\x03tag\x18\x03 \x01(\tH\x01R\x03tag\x88\x01\x01\x42\x06\n\x04_ptyB\x06\n\x04_tag"p\n\rUpdateRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x12#\n\x03pty\x18\x02 \x01(\x0b\x32\x0c.process.PTYH\x00R\x03pty\x88\x01\x01\x42\x06\n\x04_pty"\x10\n\x0eUpdateResponse"\x87\x04\n\x0cProcessEvent\x12\x38\n\x05start\x18\x01 \x01(\x0b\x32 .process.ProcessEvent.StartEventH\x00R\x05start\x12\x35\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x1f.process.ProcessEvent.DataEventH\x00R\x04\x64\x61ta\x12\x32\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x1e.process.ProcessEvent.EndEventH\x00R\x03\x65nd\x12?\n\tkeepalive\x18\x04 \x01(\x0b\x32\x1f.process.ProcessEvent.KeepAliveH\x00R\tkeepalive\x1a\x1e\n\nStartEvent\x12\x10\n\x03pid\x18\x01 \x01(\rR\x03pid\x1a]\n\tDataEvent\x12\x18\n\x06stdout\x18\x01 \x01(\x0cH\x00R\x06stdout\x12\x18\n\x06stderr\x18\x02 \x01(\x0cH\x00R\x06stderr\x12\x12\n\x03pty\x18\x03 \x01(\x0cH\x00R\x03ptyB\x08\n\x06output\x1a|\n\x08\x45ndEvent\x12\x1b\n\texit_code\x18\x01 \x01(\x11R\x08\x65xitCode\x12\x16\n\x06\x65xited\x18\x02 \x01(\x08R\x06\x65xited\x12\x16\n\x06status\x18\x03 \x01(\tR\x06status\x12\x19\n\x05\x65rror\x18\x04 \x01(\tH\x00R\x05\x65rror\x88\x01\x01\x42\x08\n\x06_error\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent"<\n\rStartResponse\x12+\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x15.process.ProcessEventR\x05\x65vent">\n\x0f\x43onnectResponse\x12+\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x15.process.ProcessEventR\x05\x65vent"s\n\x10SendInputRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x12+\n\x05input\x18\x02 \x01(\x0b\x32\x15.process.ProcessInputR\x05input"\x13\n\x11SendInputResponse"C\n\x0cProcessInput\x12\x16\n\x05stdin\x18\x01 \x01(\x0cH\x00R\x05stdin\x12\x12\n\x03pty\x18\x02 \x01(\x0cH\x00R\x03ptyB\x07\n\x05input"\xea\x02\n\x12StreamInputRequest\x12>\n\x05start\x18\x01 \x01(\x0b\x32&.process.StreamInputRequest.StartEventH\x00R\x05start\x12;\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32%.process.StreamInputRequest.DataEventH\x00R\x04\x64\x61ta\x12\x45\n\tkeepalive\x18\x03 \x01(\x0b\x32%.process.StreamInputRequest.KeepAliveH\x00R\tkeepalive\x1a@\n\nStartEvent\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x1a\x38\n\tDataEvent\x12+\n\x05input\x18\x02 \x01(\x0b\x32\x15.process.ProcessInputR\x05input\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent"\x15\n\x13StreamInputResponse"p\n\x11SendSignalRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x12\'\n\x06signal\x18\x02 \x01(\x0e\x32\x0f.process.SignalR\x06signal"\x14\n\x12SendSignalResponse"D\n\x0e\x43onnectRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process"E\n\x0fProcessSelector\x12\x12\n\x03pid\x18\x01 \x01(\rH\x00R\x03pid\x12\x12\n\x03tag\x18\x02 \x01(\tH\x00R\x03tagB\n\n\x08selector*H\n\x06Signal\x12\x16\n\x12SIGNAL_UNSPECIFIED\x10\x00\x12\x12\n\x0eSIGNAL_SIGTERM\x10\x0f\x12\x12\n\x0eSIGNAL_SIGKILL\x10\t2\xca\x03\n\x07Process\x12\x33\n\x04List\x12\x14.process.ListRequest\x1a\x15.process.ListResponse\x12>\n\x07\x43onnect\x12\x17.process.ConnectRequest\x1a\x18.process.ConnectResponse0\x01\x12\x38\n\x05Start\x12\x15.process.StartRequest\x1a\x16.process.StartResponse0\x01\x12\x39\n\x06Update\x12\x16.process.UpdateRequest\x1a\x17.process.UpdateResponse\x12J\n\x0bStreamInput\x12\x1b.process.StreamInputRequest\x1a\x1c.process.StreamInputResponse(\x01\x12\x42\n\tSendInput\x12\x19.process.SendInputRequest\x1a\x1a.process.SendInputResponse\x12\x45\n\nSendSignal\x12\x1a.process.SendSignalRequest\x1a\x1b.process.SendSignalResponseBW\n\x0b\x63om.processB\x0cProcessProtoP\x01\xa2\x02\x03PXX\xaa\x02\x07Process\xca\x02\x07Process\xe2\x02\x13Process\\GPBMetadata\xea\x02\x07Processb\x06proto3'
+)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'process.process_pb2', _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "process.process_pb2", _globals)
if not _descriptor._USE_C_DESCRIPTORS:
- _globals['DESCRIPTOR']._loaded_options = None
- _globals['DESCRIPTOR']._serialized_options = b'\n\013com.processB\014ProcessProtoP\001\242\002\003PXX\252\002\007Process\312\002\007Process\342\002\023Process\\GPBMetadata\352\002\007Process'
- _globals['_PROCESSCONFIG_ENVSENTRY']._loaded_options = None
- _globals['_PROCESSCONFIG_ENVSENTRY']._serialized_options = b'8\001'
- _globals['_SIGNAL']._serialized_start=2316
- _globals['_SIGNAL']._serialized_end=2388
- _globals['_PTY']._serialized_start=34
- _globals['_PTY']._serialized_end=126
- _globals['_PTY_SIZE']._serialized_start=80
- _globals['_PTY_SIZE']._serialized_end=126
- _globals['_PROCESSCONFIG']._serialized_start=129
- _globals['_PROCESSCONFIG']._serialized_end=324
- _globals['_PROCESSCONFIG_ENVSENTRY']._serialized_start=261
- _globals['_PROCESSCONFIG_ENVSENTRY']._serialized_end=316
- _globals['_LISTREQUEST']._serialized_start=326
- _globals['_LISTREQUEST']._serialized_end=339
- _globals['_PROCESSINFO']._serialized_start=341
- _globals['_PROCESSINFO']._serialized_end=451
- _globals['_LISTRESPONSE']._serialized_start=453
- _globals['_LISTRESPONSE']._serialized_end=519
- _globals['_STARTREQUEST']._serialized_start=522
- _globals['_STARTREQUEST']._serialized_end=662
- _globals['_UPDATEREQUEST']._serialized_start=664
- _globals['_UPDATEREQUEST']._serialized_end=776
- _globals['_UPDATERESPONSE']._serialized_start=778
- _globals['_UPDATERESPONSE']._serialized_end=794
- _globals['_PROCESSEVENT']._serialized_start=797
- _globals['_PROCESSEVENT']._serialized_end=1316
- _globals['_PROCESSEVENT_STARTEVENT']._serialized_start=1043
- _globals['_PROCESSEVENT_STARTEVENT']._serialized_end=1073
- _globals['_PROCESSEVENT_DATAEVENT']._serialized_start=1075
- _globals['_PROCESSEVENT_DATAEVENT']._serialized_end=1168
- _globals['_PROCESSEVENT_ENDEVENT']._serialized_start=1170
- _globals['_PROCESSEVENT_ENDEVENT']._serialized_end=1294
- _globals['_PROCESSEVENT_KEEPALIVE']._serialized_start=1296
- _globals['_PROCESSEVENT_KEEPALIVE']._serialized_end=1307
- _globals['_STARTRESPONSE']._serialized_start=1318
- _globals['_STARTRESPONSE']._serialized_end=1378
- _globals['_CONNECTRESPONSE']._serialized_start=1380
- _globals['_CONNECTRESPONSE']._serialized_end=1442
- _globals['_SENDINPUTREQUEST']._serialized_start=1444
- _globals['_SENDINPUTREQUEST']._serialized_end=1559
- _globals['_SENDINPUTRESPONSE']._serialized_start=1561
- _globals['_SENDINPUTRESPONSE']._serialized_end=1580
- _globals['_PROCESSINPUT']._serialized_start=1582
- _globals['_PROCESSINPUT']._serialized_end=1649
- _globals['_STREAMINPUTREQUEST']._serialized_start=1652
- _globals['_STREAMINPUTREQUEST']._serialized_end=2014
- _globals['_STREAMINPUTREQUEST_STARTEVENT']._serialized_start=1870
- _globals['_STREAMINPUTREQUEST_STARTEVENT']._serialized_end=1934
- _globals['_STREAMINPUTREQUEST_DATAEVENT']._serialized_start=1936
- _globals['_STREAMINPUTREQUEST_DATAEVENT']._serialized_end=1992
- _globals['_STREAMINPUTREQUEST_KEEPALIVE']._serialized_start=1296
- _globals['_STREAMINPUTREQUEST_KEEPALIVE']._serialized_end=1307
- _globals['_STREAMINPUTRESPONSE']._serialized_start=2016
- _globals['_STREAMINPUTRESPONSE']._serialized_end=2037
- _globals['_SENDSIGNALREQUEST']._serialized_start=2039
- _globals['_SENDSIGNALREQUEST']._serialized_end=2151
- _globals['_SENDSIGNALRESPONSE']._serialized_start=2153
- _globals['_SENDSIGNALRESPONSE']._serialized_end=2173
- _globals['_CONNECTREQUEST']._serialized_start=2175
- _globals['_CONNECTREQUEST']._serialized_end=2243
- _globals['_PROCESSSELECTOR']._serialized_start=2245
- _globals['_PROCESSSELECTOR']._serialized_end=2314
- _globals['_PROCESS']._serialized_start=2391
- _globals['_PROCESS']._serialized_end=2849
+ _globals["DESCRIPTOR"]._loaded_options = None
+ _globals[
+ "DESCRIPTOR"
+ ]._serialized_options = b"\n\013com.processB\014ProcessProtoP\001\242\002\003PXX\252\002\007Process\312\002\007Process\342\002\023Process\\GPBMetadata\352\002\007Process"
+ _globals["_PROCESSCONFIG_ENVSENTRY"]._loaded_options = None
+ _globals["_PROCESSCONFIG_ENVSENTRY"]._serialized_options = b"8\001"
+ _globals["_SIGNAL"]._serialized_start = 2316
+ _globals["_SIGNAL"]._serialized_end = 2388
+ _globals["_PTY"]._serialized_start = 34
+ _globals["_PTY"]._serialized_end = 126
+ _globals["_PTY_SIZE"]._serialized_start = 80
+ _globals["_PTY_SIZE"]._serialized_end = 126
+ _globals["_PROCESSCONFIG"]._serialized_start = 129
+ _globals["_PROCESSCONFIG"]._serialized_end = 324
+ _globals["_PROCESSCONFIG_ENVSENTRY"]._serialized_start = 261
+ _globals["_PROCESSCONFIG_ENVSENTRY"]._serialized_end = 316
+ _globals["_LISTREQUEST"]._serialized_start = 326
+ _globals["_LISTREQUEST"]._serialized_end = 339
+ _globals["_PROCESSINFO"]._serialized_start = 341
+ _globals["_PROCESSINFO"]._serialized_end = 451
+ _globals["_LISTRESPONSE"]._serialized_start = 453
+ _globals["_LISTRESPONSE"]._serialized_end = 519
+ _globals["_STARTREQUEST"]._serialized_start = 522
+ _globals["_STARTREQUEST"]._serialized_end = 662
+ _globals["_UPDATEREQUEST"]._serialized_start = 664
+ _globals["_UPDATEREQUEST"]._serialized_end = 776
+ _globals["_UPDATERESPONSE"]._serialized_start = 778
+ _globals["_UPDATERESPONSE"]._serialized_end = 794
+ _globals["_PROCESSEVENT"]._serialized_start = 797
+ _globals["_PROCESSEVENT"]._serialized_end = 1316
+ _globals["_PROCESSEVENT_STARTEVENT"]._serialized_start = 1043
+ _globals["_PROCESSEVENT_STARTEVENT"]._serialized_end = 1073
+ _globals["_PROCESSEVENT_DATAEVENT"]._serialized_start = 1075
+ _globals["_PROCESSEVENT_DATAEVENT"]._serialized_end = 1168
+ _globals["_PROCESSEVENT_ENDEVENT"]._serialized_start = 1170
+ _globals["_PROCESSEVENT_ENDEVENT"]._serialized_end = 1294
+ _globals["_PROCESSEVENT_KEEPALIVE"]._serialized_start = 1296
+ _globals["_PROCESSEVENT_KEEPALIVE"]._serialized_end = 1307
+ _globals["_STARTRESPONSE"]._serialized_start = 1318
+ _globals["_STARTRESPONSE"]._serialized_end = 1378
+ _globals["_CONNECTRESPONSE"]._serialized_start = 1380
+ _globals["_CONNECTRESPONSE"]._serialized_end = 1442
+ _globals["_SENDINPUTREQUEST"]._serialized_start = 1444
+ _globals["_SENDINPUTREQUEST"]._serialized_end = 1559
+ _globals["_SENDINPUTRESPONSE"]._serialized_start = 1561
+ _globals["_SENDINPUTRESPONSE"]._serialized_end = 1580
+ _globals["_PROCESSINPUT"]._serialized_start = 1582
+ _globals["_PROCESSINPUT"]._serialized_end = 1649
+ _globals["_STREAMINPUTREQUEST"]._serialized_start = 1652
+ _globals["_STREAMINPUTREQUEST"]._serialized_end = 2014
+ _globals["_STREAMINPUTREQUEST_STARTEVENT"]._serialized_start = 1870
+ _globals["_STREAMINPUTREQUEST_STARTEVENT"]._serialized_end = 1934
+ _globals["_STREAMINPUTREQUEST_DATAEVENT"]._serialized_start = 1936
+ _globals["_STREAMINPUTREQUEST_DATAEVENT"]._serialized_end = 1992
+ _globals["_STREAMINPUTREQUEST_KEEPALIVE"]._serialized_start = 1296
+ _globals["_STREAMINPUTREQUEST_KEEPALIVE"]._serialized_end = 1307
+ _globals["_STREAMINPUTRESPONSE"]._serialized_start = 2016
+ _globals["_STREAMINPUTRESPONSE"]._serialized_end = 2037
+ _globals["_SENDSIGNALREQUEST"]._serialized_start = 2039
+ _globals["_SENDSIGNALREQUEST"]._serialized_end = 2151
+ _globals["_SENDSIGNALRESPONSE"]._serialized_start = 2153
+ _globals["_SENDSIGNALRESPONSE"]._serialized_end = 2173
+ _globals["_CONNECTREQUEST"]._serialized_start = 2175
+ _globals["_CONNECTREQUEST"]._serialized_end = 2243
+ _globals["_PROCESSSELECTOR"]._serialized_start = 2245
+ _globals["_PROCESSSELECTOR"]._serialized_end = 2314
+ _globals["_PROCESS"]._serialized_start = 2391
+ _globals["_PROCESS"]._serialized_end = 2849
# @@protoc_insertion_point(module_scope)
diff --git a/packages/python-sdk/e2b/envd/process/process_pb2.pyi b/packages/python-sdk/e2b/envd/process/process_pb2.pyi
index 5934e5b49..46751e0af 100644
--- a/packages/python-sdk/e2b/envd/process/process_pb2.pyi
+++ b/packages/python-sdk/e2b/envd/process/process_pb2.pyi
@@ -2,7 +2,13 @@ from google.protobuf.internal import containers as _containers
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
-from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
+from typing import (
+ ClassVar as _ClassVar,
+ Iterable as _Iterable,
+ Mapping as _Mapping,
+ Optional as _Optional,
+ Union as _Union,
+)
DESCRIPTOR: _descriptor.FileDescriptor
@@ -11,32 +17,39 @@ class Signal(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
SIGNAL_UNSPECIFIED: _ClassVar[Signal]
SIGNAL_SIGTERM: _ClassVar[Signal]
SIGNAL_SIGKILL: _ClassVar[Signal]
+
SIGNAL_UNSPECIFIED: Signal
SIGNAL_SIGTERM: Signal
SIGNAL_SIGKILL: Signal
class PTY(_message.Message):
__slots__ = ("size",)
+
class Size(_message.Message):
__slots__ = ("cols", "rows")
COLS_FIELD_NUMBER: _ClassVar[int]
ROWS_FIELD_NUMBER: _ClassVar[int]
cols: int
rows: int
- def __init__(self, cols: _Optional[int] = ..., rows: _Optional[int] = ...) -> None: ...
+ def __init__(
+ self, cols: _Optional[int] = ..., rows: _Optional[int] = ...
+ ) -> None: ...
SIZE_FIELD_NUMBER: _ClassVar[int]
size: PTY.Size
def __init__(self, size: _Optional[_Union[PTY.Size, _Mapping]] = ...) -> None: ...
class ProcessConfig(_message.Message):
__slots__ = ("cmd", "args", "envs", "cwd")
+
class EnvsEntry(_message.Message):
__slots__ = ("key", "value")
KEY_FIELD_NUMBER: _ClassVar[int]
VALUE_FIELD_NUMBER: _ClassVar[int]
key: str
value: str
- def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ...
+ def __init__(
+ self, key: _Optional[str] = ..., value: _Optional[str] = ...
+ ) -> None: ...
CMD_FIELD_NUMBER: _ClassVar[int]
ARGS_FIELD_NUMBER: _ClassVar[int]
ENVS_FIELD_NUMBER: _ClassVar[int]
@@ -45,7 +58,13 @@ class ProcessConfig(_message.Message):
args: _containers.RepeatedScalarFieldContainer[str]
envs: _containers.ScalarMap[str, str]
cwd: str
- def __init__(self, cmd: _Optional[str] = ..., args: _Optional[_Iterable[str]] = ..., envs: _Optional[_Mapping[str, str]] = ..., cwd: _Optional[str] = ...) -> None: ...
+ def __init__(
+ self,
+ cmd: _Optional[str] = ...,
+ args: _Optional[_Iterable[str]] = ...,
+ envs: _Optional[_Mapping[str, str]] = ...,
+ cwd: _Optional[str] = ...,
+ ) -> None: ...
class ListRequest(_message.Message):
__slots__ = ()
@@ -59,13 +78,20 @@ class ProcessInfo(_message.Message):
config: ProcessConfig
pid: int
tag: str
- def __init__(self, config: _Optional[_Union[ProcessConfig, _Mapping]] = ..., pid: _Optional[int] = ..., tag: _Optional[str] = ...) -> None: ...
+ def __init__(
+ self,
+ config: _Optional[_Union[ProcessConfig, _Mapping]] = ...,
+ pid: _Optional[int] = ...,
+ tag: _Optional[str] = ...,
+ ) -> None: ...
class ListResponse(_message.Message):
__slots__ = ("processes",)
PROCESSES_FIELD_NUMBER: _ClassVar[int]
processes: _containers.RepeatedCompositeFieldContainer[ProcessInfo]
- def __init__(self, processes: _Optional[_Iterable[_Union[ProcessInfo, _Mapping]]] = ...) -> None: ...
+ def __init__(
+ self, processes: _Optional[_Iterable[_Union[ProcessInfo, _Mapping]]] = ...
+ ) -> None: ...
class StartRequest(_message.Message):
__slots__ = ("process", "pty", "tag")
@@ -75,7 +101,12 @@ class StartRequest(_message.Message):
process: ProcessConfig
pty: PTY
tag: str
- def __init__(self, process: _Optional[_Union[ProcessConfig, _Mapping]] = ..., pty: _Optional[_Union[PTY, _Mapping]] = ..., tag: _Optional[str] = ...) -> None: ...
+ def __init__(
+ self,
+ process: _Optional[_Union[ProcessConfig, _Mapping]] = ...,
+ pty: _Optional[_Union[PTY, _Mapping]] = ...,
+ tag: _Optional[str] = ...,
+ ) -> None: ...
class UpdateRequest(_message.Message):
__slots__ = ("process", "pty")
@@ -83,7 +114,11 @@ class UpdateRequest(_message.Message):
PTY_FIELD_NUMBER: _ClassVar[int]
process: ProcessSelector
pty: PTY
- def __init__(self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ..., pty: _Optional[_Union[PTY, _Mapping]] = ...) -> None: ...
+ def __init__(
+ self,
+ process: _Optional[_Union[ProcessSelector, _Mapping]] = ...,
+ pty: _Optional[_Union[PTY, _Mapping]] = ...,
+ ) -> None: ...
class UpdateResponse(_message.Message):
__slots__ = ()
@@ -91,11 +126,13 @@ class UpdateResponse(_message.Message):
class ProcessEvent(_message.Message):
__slots__ = ("start", "data", "end", "keepalive")
+
class StartEvent(_message.Message):
__slots__ = ("pid",)
PID_FIELD_NUMBER: _ClassVar[int]
pid: int
def __init__(self, pid: _Optional[int] = ...) -> None: ...
+
class DataEvent(_message.Message):
__slots__ = ("stdout", "stderr", "pty")
STDOUT_FIELD_NUMBER: _ClassVar[int]
@@ -104,7 +141,13 @@ class ProcessEvent(_message.Message):
stdout: bytes
stderr: bytes
pty: bytes
- def __init__(self, stdout: _Optional[bytes] = ..., stderr: _Optional[bytes] = ..., pty: _Optional[bytes] = ...) -> None: ...
+ def __init__(
+ self,
+ stdout: _Optional[bytes] = ...,
+ stderr: _Optional[bytes] = ...,
+ pty: _Optional[bytes] = ...,
+ ) -> None: ...
+
class EndEvent(_message.Message):
__slots__ = ("exit_code", "exited", "status", "error")
EXIT_CODE_FIELD_NUMBER: _ClassVar[int]
@@ -115,7 +158,14 @@ class ProcessEvent(_message.Message):
exited: bool
status: str
error: str
- def __init__(self, exit_code: _Optional[int] = ..., exited: bool = ..., status: _Optional[str] = ..., error: _Optional[str] = ...) -> None: ...
+ def __init__(
+ self,
+ exit_code: _Optional[int] = ...,
+ exited: bool = ...,
+ status: _Optional[str] = ...,
+ error: _Optional[str] = ...,
+ ) -> None: ...
+
class KeepAlive(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...
@@ -127,19 +177,29 @@ class ProcessEvent(_message.Message):
data: ProcessEvent.DataEvent
end: ProcessEvent.EndEvent
keepalive: ProcessEvent.KeepAlive
- def __init__(self, start: _Optional[_Union[ProcessEvent.StartEvent, _Mapping]] = ..., data: _Optional[_Union[ProcessEvent.DataEvent, _Mapping]] = ..., end: _Optional[_Union[ProcessEvent.EndEvent, _Mapping]] = ..., keepalive: _Optional[_Union[ProcessEvent.KeepAlive, _Mapping]] = ...) -> None: ...
+ def __init__(
+ self,
+ start: _Optional[_Union[ProcessEvent.StartEvent, _Mapping]] = ...,
+ data: _Optional[_Union[ProcessEvent.DataEvent, _Mapping]] = ...,
+ end: _Optional[_Union[ProcessEvent.EndEvent, _Mapping]] = ...,
+ keepalive: _Optional[_Union[ProcessEvent.KeepAlive, _Mapping]] = ...,
+ ) -> None: ...
class StartResponse(_message.Message):
__slots__ = ("event",)
EVENT_FIELD_NUMBER: _ClassVar[int]
event: ProcessEvent
- def __init__(self, event: _Optional[_Union[ProcessEvent, _Mapping]] = ...) -> None: ...
+ def __init__(
+ self, event: _Optional[_Union[ProcessEvent, _Mapping]] = ...
+ ) -> None: ...
class ConnectResponse(_message.Message):
__slots__ = ("event",)
EVENT_FIELD_NUMBER: _ClassVar[int]
event: ProcessEvent
- def __init__(self, event: _Optional[_Union[ProcessEvent, _Mapping]] = ...) -> None: ...
+ def __init__(
+ self, event: _Optional[_Union[ProcessEvent, _Mapping]] = ...
+ ) -> None: ...
class SendInputRequest(_message.Message):
__slots__ = ("process", "input")
@@ -147,7 +207,11 @@ class SendInputRequest(_message.Message):
INPUT_FIELD_NUMBER: _ClassVar[int]
process: ProcessSelector
input: ProcessInput
- def __init__(self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ..., input: _Optional[_Union[ProcessInput, _Mapping]] = ...) -> None: ...
+ def __init__(
+ self,
+ process: _Optional[_Union[ProcessSelector, _Mapping]] = ...,
+ input: _Optional[_Union[ProcessInput, _Mapping]] = ...,
+ ) -> None: ...
class SendInputResponse(_message.Message):
__slots__ = ()
@@ -159,20 +223,29 @@ class ProcessInput(_message.Message):
PTY_FIELD_NUMBER: _ClassVar[int]
stdin: bytes
pty: bytes
- def __init__(self, stdin: _Optional[bytes] = ..., pty: _Optional[bytes] = ...) -> None: ...
+ def __init__(
+ self, stdin: _Optional[bytes] = ..., pty: _Optional[bytes] = ...
+ ) -> None: ...
class StreamInputRequest(_message.Message):
__slots__ = ("start", "data", "keepalive")
+
class StartEvent(_message.Message):
__slots__ = ("process",)
PROCESS_FIELD_NUMBER: _ClassVar[int]
process: ProcessSelector
- def __init__(self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ...) -> None: ...
+ def __init__(
+ self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ...
+ ) -> None: ...
+
class DataEvent(_message.Message):
__slots__ = ("input",)
INPUT_FIELD_NUMBER: _ClassVar[int]
input: ProcessInput
- def __init__(self, input: _Optional[_Union[ProcessInput, _Mapping]] = ...) -> None: ...
+ def __init__(
+ self, input: _Optional[_Union[ProcessInput, _Mapping]] = ...
+ ) -> None: ...
+
class KeepAlive(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...
@@ -182,7 +255,12 @@ class StreamInputRequest(_message.Message):
start: StreamInputRequest.StartEvent
data: StreamInputRequest.DataEvent
keepalive: StreamInputRequest.KeepAlive
- def __init__(self, start: _Optional[_Union[StreamInputRequest.StartEvent, _Mapping]] = ..., data: _Optional[_Union[StreamInputRequest.DataEvent, _Mapping]] = ..., keepalive: _Optional[_Union[StreamInputRequest.KeepAlive, _Mapping]] = ...) -> None: ...
+ def __init__(
+ self,
+ start: _Optional[_Union[StreamInputRequest.StartEvent, _Mapping]] = ...,
+ data: _Optional[_Union[StreamInputRequest.DataEvent, _Mapping]] = ...,
+ keepalive: _Optional[_Union[StreamInputRequest.KeepAlive, _Mapping]] = ...,
+ ) -> None: ...
class StreamInputResponse(_message.Message):
__slots__ = ()
@@ -194,7 +272,11 @@ class SendSignalRequest(_message.Message):
SIGNAL_FIELD_NUMBER: _ClassVar[int]
process: ProcessSelector
signal: Signal
- def __init__(self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ..., signal: _Optional[_Union[Signal, str]] = ...) -> None: ...
+ def __init__(
+ self,
+ process: _Optional[_Union[ProcessSelector, _Mapping]] = ...,
+ signal: _Optional[_Union[Signal, str]] = ...,
+ ) -> None: ...
class SendSignalResponse(_message.Message):
__slots__ = ()
@@ -204,7 +286,9 @@ class ConnectRequest(_message.Message):
__slots__ = ("process",)
PROCESS_FIELD_NUMBER: _ClassVar[int]
process: ProcessSelector
- def __init__(self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ...) -> None: ...
+ def __init__(
+ self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ...
+ ) -> None: ...
class ProcessSelector(_message.Message):
__slots__ = ("pid", "tag")
@@ -212,4 +296,6 @@ class ProcessSelector(_message.Message):
TAG_FIELD_NUMBER: _ClassVar[int]
pid: int
tag: str
- def __init__(self, pid: _Optional[int] = ..., tag: _Optional[str] = ...) -> None: ...
+ def __init__(
+ self, pid: _Optional[int] = ..., tag: _Optional[str] = ...
+ ) -> None: ...
diff --git a/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py b/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
index ec9a078ac..9385a7d2a 100644
--- a/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
+++ b/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
@@ -72,7 +72,8 @@ class Filesystem:
format: Literal["text"] = "text",
user: Username = "user",
request_timeout: Optional[float] = None,
- ) -> str: ...
+ ) -> str:
+ ...
@overload
def read(
@@ -81,7 +82,8 @@ class Filesystem:
format: Literal["bytes"],
user: Username = "user",
request_timeout: Optional[float] = None,
- ) -> bytearray: ...
+ ) -> bytearray:
+ ...
@overload
def read(
@@ -90,7 +92,8 @@ class Filesystem:
format: Literal["stream"],
user: Username = "user",
request_timeout: Optional[float] = None,
- ) -> Iterator[bytes]: ...
+ ) -> Iterator[bytes]:
+ ...
def read(
self,
diff --git a/packages/python-sdk/e2b/sandbox/process/main.py b/packages/python-sdk/e2b/sandbox/process/main.py
index 0e8ef9b6a..0f659420b 100644
--- a/packages/python-sdk/e2b/sandbox/process/main.py
+++ b/packages/python-sdk/e2b/sandbox/process/main.py
@@ -114,7 +114,8 @@ class Process:
on_stderr: Optional[Callable[[str], None]] = None,
timeout: Optional[float] = 60,
request_timeout: Optional[float] = None,
- ) -> ProcessResult: ...
+ ) -> ProcessResult:
+ ...
@overload
def run(
@@ -128,7 +129,8 @@ class Process:
on_stderr: Optional[Callable[[str], None]] = None,
timeout: Optional[float] = 60,
request_timeout: Optional[float] = None,
- ) -> ProcessHandle: ...
+ ) -> ProcessHandle:
+ ...
def run(
self,
diff --git a/packages/python-sdk/tests/api/test_kill.py b/packages/python-sdk/tests/api/test_sbx_kill.py
similarity index 74%
rename from packages/python-sdk/tests/api/test_kill.py
rename to packages/python-sdk/tests/api/test_sbx_kill.py
index 33c6c3cf7..e73157094 100644
--- a/packages/python-sdk/tests/api/test_kill.py
+++ b/packages/python-sdk/tests/api/test_sbx_kill.py
@@ -1,6 +1,6 @@
import pytest
-from e2b import Sandbox
+from e2b import Sandbox, SandboxException
@pytest.mark.skip_debug()
@@ -10,5 +10,5 @@ def test_kill_existing_sandbox(sandbox: Sandbox):
@pytest.mark.skip_debug()
def test_kill_non_existing_sandbox():
- with pytest.raises(RuntimeError):
+ with pytest.raises(SandboxException):
Sandbox.kill("non-existing-sandbox")
diff --git a/packages/python-sdk/tests/api/test_list.py b/packages/python-sdk/tests/api/test_sbx_list.py
similarity index 100%
rename from packages/python-sdk/tests/api/test_list.py
rename to packages/python-sdk/tests/api/test_sbx_list.py
diff --git a/packages/python-sdk/tests/sandbox/commands/test_cmd_connect.py b/packages/python-sdk/tests/sandbox/commands/test_cmd_connect.py
new file mode 100644
index 000000000..eb705698d
--- /dev/null
+++ b/packages/python-sdk/tests/sandbox/commands/test_cmd_connect.py
@@ -0,0 +1,18 @@
+import pytest
+
+from e2b import NotFoundException
+
+
+def test_connect_to_process(sandbox):
+ cmd = sandbox.commands.run("sleep 10", background=True)
+ pid = cmd.pid
+
+ process_info = sandbox.commands.connect(pid)
+ assert process_info.pid == pid
+
+
+def test_connect_to_non_existing_process(sandbox):
+ non_existing_pid = 999999
+
+ with pytest.raises(NotFoundException):
+ sandbox.commands.connect(non_existing_pid)
diff --git a/packages/python-sdk/tests/sandbox/commands/test_cmd_kill.py b/packages/python-sdk/tests/sandbox/commands/test_cmd_kill.py
new file mode 100644
index 000000000..95a190c81
--- /dev/null
+++ b/packages/python-sdk/tests/sandbox/commands/test_cmd_kill.py
@@ -0,0 +1,20 @@
+import pytest
+
+from e2b import NotFoundException
+
+
+def test_kill_process(sandbox):
+ cmd = sandbox.commands.run("sleep 10", background=True)
+ pid = cmd.pid
+
+ sandbox.commands.kill(pid)
+
+ with pytest.raises(NotFoundException):
+ sandbox.commands.run(f"kill -0 {pid}")
+
+
+def test_kill_non_existing_process(sandbox):
+ non_existing_pid = 999999
+
+ with pytest.raises(NotFoundException):
+ sandbox.commands.kill(non_existing_pid)
diff --git a/packages/python-sdk/tests/sandbox/commands/test_cmd_list.py b/packages/python-sdk/tests/sandbox/commands/test_cmd_list.py
new file mode 100644
index 000000000..4d9ae9661
--- /dev/null
+++ b/packages/python-sdk/tests/sandbox/commands/test_cmd_list.py
@@ -0,0 +1,9 @@
+def test_kill_process(sandbox):
+ sandbox.commands.run("sleep 10", background=True)
+ sandbox.commands.run("sleep 10", background=True)
+
+ processes = sandbox.commands.list()
+
+ assert len(processes) >= 2
+ for process in processes:
+ assert "pid" in process
diff --git a/packages/python-sdk/tests/sandbox/commands/test_run.py b/packages/python-sdk/tests/sandbox/commands/test_run.py
index e69de29bb..acc3c930d 100644
--- a/packages/python-sdk/tests/sandbox/commands/test_run.py
+++ b/packages/python-sdk/tests/sandbox/commands/test_run.py
@@ -0,0 +1,39 @@
+import pytest
+
+
+def test_run(sandbox):
+ text = "Hello, World!"
+
+ cmd = sandbox.commands.run(f'echo "{text}"')
+
+ assert cmd.exit_code == 0
+ assert cmd.stdout == f"{text}\n"
+
+
+def test_run_with_special_characters(sandbox):
+ text = "!@#$%^&*()_+"
+
+ cmd = sandbox.commands.run(f'echo "{text}"')
+
+ assert cmd.exit_code == 0
+ assert cmd.stdout == f"{text}\n"
+
+
+def test_run_with_multiline_string(sandbox):
+ text = "Hello,\nWorld!"
+
+ cmd = sandbox.commands.run(f'echo "{text}"')
+
+ assert cmd.exit_code == 0
+ assert cmd.stdout == f"{text}\n"
+
+
+def test_run_with_timeout(sandbox):
+ cmd = sandbox.commands.run('echo "Hello, World!"', timeout=1000)
+
+ assert cmd.exit_code == 0
+
+
+def test_run_with_too_short_timeout(sandbox):
+ with pytest.raises(Exception):
+ sandbox.commands.run("sleep 10", timeout_ms=1000)
diff --git a/packages/python-sdk/tests/sandbox/commands/test_send_stdin.py b/packages/python-sdk/tests/sandbox/commands/test_send_stdin.py
index e69de29bb..7126ab81f 100644
--- a/packages/python-sdk/tests/sandbox/commands/test_send_stdin.py
+++ b/packages/python-sdk/tests/sandbox/commands/test_send_stdin.py
@@ -0,0 +1,26 @@
+def test_send_stdin_to_process(sandbox):
+ cmd = sandbox.commands.run("cat", background=True)
+ sandbox.commands.send_stdin(cmd.pid, "Hello, World!")
+ cmd.kill()
+ assert cmd.stdout == "Hello, World!"
+
+
+def test_send_empty_stdin_to_process(sandbox):
+ cmd = sandbox.commands.run("cat", background=True)
+ sandbox.commands.send_stdin(cmd.pid, "")
+ cmd.kill()
+ assert cmd.stdout == ""
+
+
+def test_send_special_characters_to_process(sandbox):
+ cmd = sandbox.commands.run("cat", background=True)
+ sandbox.commands.send_stdin(cmd.pid, "!@#$%^&*()_+")
+ cmd.kill()
+ assert cmd.stdout == "!@#$%^&*()_+"
+
+
+def test_send_multiline_string_to_process(sandbox):
+ cmd = sandbox.commands.run("cat", background=True)
+ sandbox.commands.send_stdin(cmd.pid, "Hello,\nWorld!")
+ cmd.kill()
+ assert cmd.stdout == "Hello,\nWorld!"
diff --git a/packages/python-sdk/tests/sandbox/commands/test_connect.py b/packages/python-sdk/tests/sandbox/files/test_files_list.py
similarity index 100%
rename from packages/python-sdk/tests/sandbox/commands/test_connect.py
rename to packages/python-sdk/tests/sandbox/files/test_files_list.py
diff --git a/packages/python-sdk/tests/sandbox/files/test_make_dir.py b/packages/python-sdk/tests/sandbox/files/test_make_dir.py
index e69de29bb..ce37cbed4 100644
--- a/packages/python-sdk/tests/sandbox/files/test_make_dir.py
+++ b/packages/python-sdk/tests/sandbox/files/test_make_dir.py
@@ -0,0 +1,14 @@
+def test_make_directory(sandbox):
+ dir_name = "test_directory"
+
+ sandbox.files.make_dir(dir_name)
+ exists = sandbox.files.exists(dir_name)
+ assert exists
+
+
+def test_make_nested_directory(sandbox):
+ nested_dir_name = "test_directory/nested_directory"
+
+ sandbox.files.make_dir(nested_dir_name)
+ exists = sandbox.files.exists(nested_dir_name)
+ assert exists
diff --git a/packages/python-sdk/tests/sandbox/files/test_read.py b/packages/python-sdk/tests/sandbox/files/test_read.py
index e69de29bb..e010ecbf0 100644
--- a/packages/python-sdk/tests/sandbox/files/test_read.py
+++ b/packages/python-sdk/tests/sandbox/files/test_read.py
@@ -0,0 +1,18 @@
+import pytest
+from e2b import NotFoundException
+
+
+def test_read_file(sandbox):
+ filename = "test_read.txt"
+ content = "Hello, world!"
+
+ sandbox.files.write(filename, content)
+ read_content = sandbox.files.read(filename)
+ assert read_content == content
+
+
+def test_read_non_existing_file(sandbox):
+ filename = "non_existing_file.txt"
+
+ with pytest.raises(NotFoundException):
+ sandbox.files.read(filename)
diff --git a/packages/python-sdk/tests/sandbox/files/test_remove.py b/packages/python-sdk/tests/sandbox/files/test_remove.py
index e69de29bb..6e65a6d16 100644
--- a/packages/python-sdk/tests/sandbox/files/test_remove.py
+++ b/packages/python-sdk/tests/sandbox/files/test_remove.py
@@ -0,0 +1,13 @@
+def test_remove_file(sandbox):
+ filename = "test_remove.txt"
+ content = "This file will be removed."
+
+ sandbox.files.write(filename, content)
+ sandbox.files.remove(filename)
+ exists = sandbox.files.exists(filename)
+ assert not exists
+
+
+def test_remove_non_existing_file(sandbox):
+ filename = "non_existing_file.txt"
+ sandbox.files.remove(filename)
diff --git a/packages/python-sdk/tests/sandbox/files/test_rename.py b/packages/python-sdk/tests/sandbox/files/test_rename.py
index e69de29bb..1267a6842 100644
--- a/packages/python-sdk/tests/sandbox/files/test_rename.py
+++ b/packages/python-sdk/tests/sandbox/files/test_rename.py
@@ -0,0 +1,25 @@
+import pytest
+from e2b import NotFoundException
+
+
+def test_rename_file(sandbox):
+ old_filename = "test_rename_old.txt"
+ new_filename = "test_rename_new.txt"
+ content = "This file will be renamed."
+
+ sandbox.files.write(old_filename, content)
+ sandbox.files.rename(old_filename, new_filename)
+ exists_old = sandbox.files.exists(old_filename)
+ exists_new = sandbox.files.exists(new_filename)
+ assert not exists_old
+ assert exists_new
+ read_content = sandbox.files.read(new_filename)
+ assert read_content == content
+
+
+def test_rename_non_existing_file(sandbox):
+ old_filename = "non_existing_file.txt"
+ new_filename = "new_non_existing_file.txt"
+
+ with pytest.raises(NotFoundException):
+ sandbox.files.rename(old_filename, new_filename)
diff --git a/packages/python-sdk/tests/sandbox/files/test_watch.py b/packages/python-sdk/tests/sandbox/files/test_watch.py
index e69de29bb..b459fb42d 100644
--- a/packages/python-sdk/tests/sandbox/files/test_watch.py
+++ b/packages/python-sdk/tests/sandbox/files/test_watch.py
@@ -0,0 +1,40 @@
+from time import sleep
+
+import pytest
+
+from e2b import NotFoundException
+from e2b.sandbox.filesystem.watch_handle import FilesystemEventType
+
+
+def test_watch_directory_changes(sandbox):
+ dirname = "test_watch_dir"
+ filename = "test_watch.txt"
+ content = "This file will be watched."
+ new_content = "This file has been modified."
+
+ sandbox.files.make_dir(dirname)
+ sandbox.files.write(f"{dirname}/{filename}", content)
+
+ event_triggered = False
+ handle = sandbox.files.watch(dirname)
+
+ sandbox.files.write(f"{dirname}/{filename}", new_content)
+
+ sleep(1) # wait for the event to be triggered
+
+ for event in handle:
+ if event.type == FilesystemEventType.WRITE and event.name == filename:
+ event_triggered = True
+
+ assert event_triggered
+
+ handle.close()
+
+
+def test_watch_non_existing_directory(sandbox):
+ dirname = "non_existing_watch_dir"
+
+ with pytest.raises(NotFoundException):
+ sandbox.files.watch(dirname)
+
+# TODO: Add test for nonexistent file
diff --git a/packages/python-sdk/tests/sandbox/files/test_write.py b/packages/python-sdk/tests/sandbox/files/test_write.py
index e69de29bb..0aebddcc1 100644
--- a/packages/python-sdk/tests/sandbox/files/test_write.py
+++ b/packages/python-sdk/tests/sandbox/files/test_write.py
@@ -0,0 +1,33 @@
+def test_write_file(sandbox):
+ filename = "test_write.txt"
+ content = "This is a test file."
+
+ sandbox.files.write(filename, content)
+ exists = sandbox.files.exists(filename)
+ assert exists
+
+ read_content = sandbox.files.read(filename)
+ assert read_content == content
+
+
+def test_overwrite_file(sandbox):
+ filename = "test_overwrite.txt"
+ initial_content = "Initial content."
+ new_content = "New content."
+
+ sandbox.files.write(filename, initial_content)
+ sandbox.files.write(filename, new_content)
+ read_content = sandbox.files.read(filename)
+ assert read_content == new_content
+
+
+def test_write_to_non_existing_directory(sandbox):
+ filename = "non_existing_dir/test_write.txt"
+ content = "This should succeed too."
+
+ sandbox.files.write(filename, content)
+ exists = sandbox.files.exists(filename)
+ assert exists
+
+ read_content = sandbox.files.read(filename)
+ assert read_content == content
diff --git a/packages/python-sdk/tests/sandbox/commands/test_kill.py b/packages/python-sdk/tests/sandbox/pty/test_pty_create.py
similarity index 100%
rename from packages/python-sdk/tests/sandbox/commands/test_kill.py
rename to packages/python-sdk/tests/sandbox/pty/test_pty_create.py
diff --git a/packages/python-sdk/tests/sandbox/commands/test_list.py b/packages/python-sdk/tests/sandbox/pty/test_resize.py
similarity index 100%
rename from packages/python-sdk/tests/sandbox/commands/test_list.py
rename to packages/python-sdk/tests/sandbox/pty/test_resize.py
diff --git a/packages/python-sdk/tests/sandbox/files/test_list.py b/packages/python-sdk/tests/sandbox/pty/test_stream_input.py
similarity index 100%
rename from packages/python-sdk/tests/sandbox/files/test_list.py
rename to packages/python-sdk/tests/sandbox/pty/test_stream_input.py
diff --git a/packages/python-sdk/tests/sandbox/test_create.py b/packages/python-sdk/tests/sandbox/test_create.py
index 8fbfdfe23..cf94b7b9f 100644
--- a/packages/python-sdk/tests/sandbox/test_create.py
+++ b/packages/python-sdk/tests/sandbox/test_create.py
@@ -7,3 +7,16 @@ from e2b.sandbox.main import Sandbox
def test_start(template):
sbx = Sandbox(template, timeout=5)
assert sbx.is_running()
+
+
+def test_metadata(template):
+ sbx = Sandbox(template, timeout=5, metadata={"test-key": "test-value"})
+ sbxs = Sandbox.list()
+
+ for sbx_info in sbxs:
+ if sbx.sandbox_id == sbx_info.sandbox_id:
+ assert sbx_info.metadata["test-key"] == "test-value"
+ break
+ else:
+ assert False, "Sandbox not found"
diff --git a/packages/python-sdk/tests/sandbox/test_host.py b/packages/python-sdk/tests/sandbox/test_host.py
index e69de29bb..fba71f8af 100644
--- a/packages/python-sdk/tests/sandbox/test_host.py
+++ b/packages/python-sdk/tests/sandbox/test_host.py
@@ -0,0 +1,17 @@
+from time import sleep
+
+import pytest
+import requests
+
+
+def test_ping_server(sandbox, debug):
+ cmd = sandbox.commands.run("python -m http.server 8000", background=True)
+
+ try:
+ sleep(1)
+ host = sandbox.get_host(8000)
+ res = requests.get(f"{'http' if debug else 'https'}://{host}")
+ assert res.status_code == 200
+
+ finally:
+ cmd.kill()
diff --git a/packages/python-sdk/tests/sandbox/test_timeout.py b/packages/python-sdk/tests/sandbox/test_timeout.py
index e69de29bb..37f3db1e9 100644
--- a/packages/python-sdk/tests/sandbox/test_timeout.py
+++ b/packages/python-sdk/tests/sandbox/test_timeout.py
@@ -0,0 +1,22 @@
+from time import sleep
+
+import pytest
+
+from e2b import NotFoundException
+
+
+def test_shorten_timeout(sandbox):
+ sandbox.set_timeout(5)
+ sleep(6)
+ with pytest.raises(NotFoundException):
+ sandbox.is_running()
+
+
+def test_shorten_then_lengthen_timeout(sandbox):
+ sandbox.set_timeout(5)
+ sleep(1)
+ sandbox.set_timeout(10)
+ sleep(6)
+ sandbox.is_running()
diff --git a/packages/python-sdk/tests/sandbox/test_upload_url.py b/packages/python-sdk/tests/sandbox/test_upload_url.py
index e69de29bb..9f7eab2f5 100644
--- a/packages/python-sdk/tests/sandbox/test_upload_url.py
+++ b/packages/python-sdk/tests/sandbox/test_upload_url.py
@@ -0,0 +1,17 @@
+import requests
+
+
+
+#TODO: Upload and check if the file is uploaded
+def test_upload_file_via_url(sandbox):
+ url = sandbox.upload_url()
+ res = requests.get(url)
+ assert res.status_code == 200
+
+
+def test_upload_file_via_url_to_specific_path(sandbox):
+ url = sandbox.upload_url("/test/test.txt")
+ assert "test.txt" in url
+
+ res = requests.get(url)
+ assert res.status_code == 200