blaxel 0.1.10rc38__py3-none-any.whl → 0.1.10rc40__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. blaxel/authentication/devicemode.py +0 -1
  2. blaxel/client/api/compute/create_sandbox_preview.py +179 -0
  3. blaxel/client/api/compute/create_sandbox_preview_token.py +192 -0
  4. blaxel/client/api/compute/delete_sandbox_preview.py +167 -0
  5. blaxel/client/api/compute/delete_sandbox_preview_token.py +180 -0
  6. blaxel/client/api/compute/get_sandbox_preview.py +167 -0
  7. blaxel/client/api/compute/list_sandbox_preview_tokens.py +172 -0
  8. blaxel/client/api/compute/list_sandbox_previews.py +159 -0
  9. blaxel/client/api/compute/update_sandbox_preview.py +192 -0
  10. blaxel/client/api/integrations/get_integration.py +64 -7
  11. blaxel/client/api/workspaces/check_workspace_availability.py +165 -0
  12. blaxel/client/models/__init__.py +32 -2
  13. blaxel/client/models/check_workspace_availability_body.py +60 -0
  14. blaxel/client/models/delete_sandbox_preview_token_response_200.py +60 -0
  15. blaxel/client/models/integration.py +197 -0
  16. blaxel/client/models/integration_additional_infos.py +45 -0
  17. blaxel/client/models/integration_endpoint.py +143 -0
  18. blaxel/client/models/integration_endpoint_token.py +79 -0
  19. blaxel/client/models/integration_endpoints.py +61 -0
  20. blaxel/client/models/integration_headers.py +45 -0
  21. blaxel/client/models/integration_organization.py +88 -0
  22. blaxel/client/models/integration_query_params.py +45 -0
  23. blaxel/client/models/metrics.py +9 -0
  24. blaxel/client/models/preview.py +96 -0
  25. blaxel/client/models/preview_metadata.py +133 -0
  26. blaxel/client/models/preview_spec.py +79 -0
  27. blaxel/client/models/preview_token.py +96 -0
  28. blaxel/client/models/preview_token_metadata.py +97 -0
  29. blaxel/client/models/preview_token_spec.py +88 -0
  30. blaxel/sandbox/client/api/process/get_process_identifier_logs.py +22 -1
  31. blaxel/sandbox/client/api/process/get_process_identifier_logs_stream.py +190 -0
  32. blaxel/sandbox/client/models/__init__.py +6 -0
  33. blaxel/sandbox/client/models/directory.py +5 -3
  34. blaxel/sandbox/client/models/file.py +1 -1
  35. blaxel/sandbox/client/models/file_with_content.py +1 -1
  36. blaxel/sandbox/client/models/get_process_identifier_logs_stream_response_200.py +45 -0
  37. blaxel/sandbox/client/models/subdirectory.py +60 -0
  38. blaxel/sandbox/filesystem.py +2 -0
  39. {blaxel-0.1.10rc38.dist-info → blaxel-0.1.10rc40.dist-info}/METADATA +1 -1
  40. {blaxel-0.1.10rc38.dist-info → blaxel-0.1.10rc40.dist-info}/RECORD +42 -15
  41. blaxel/client/models/sandboxes.py +0 -129
  42. {blaxel-0.1.10rc38.dist-info → blaxel-0.1.10rc40.dist-info}/WHEEL +0 -0
  43. {blaxel-0.1.10rc38.dist-info → blaxel-0.1.10rc40.dist-info}/licenses/LICENSE +0 -0
@@ -7,15 +7,24 @@ from ... import errors
7
7
  from ...client import Client
8
8
  from ...models.error_response import ErrorResponse
9
9
  from ...models.get_process_identifier_logs_response_200 import GetProcessIdentifierLogsResponse200
10
- from ...types import Response
10
+ from ...types import UNSET, Response, Unset
11
11
 
12
12
 
13
13
  def _get_kwargs(
14
14
  identifier: str,
15
+ *,
16
+ stream: Union[Unset, bool] = UNSET,
15
17
  ) -> dict[str, Any]:
18
+ params: dict[str, Any] = {}
19
+
20
+ params["stream"] = stream
21
+
22
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
23
+
16
24
  _kwargs: dict[str, Any] = {
17
25
  "method": "get",
18
26
  "url": f"/process/{identifier}/logs",
27
+ "params": params,
19
28
  }
20
29
 
21
30
  return _kwargs
@@ -57,6 +66,7 @@ def sync_detailed(
57
66
  identifier: str,
58
67
  *,
59
68
  client: Union[Client],
69
+ stream: Union[Unset, bool] = UNSET,
60
70
  ) -> Response[Union[ErrorResponse, GetProcessIdentifierLogsResponse200]]:
61
71
  """Get process logs
62
72
 
@@ -64,6 +74,7 @@ def sync_detailed(
64
74
 
65
75
  Args:
66
76
  identifier (str):
77
+ stream (Union[Unset, bool]):
67
78
 
68
79
  Raises:
69
80
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -75,6 +86,7 @@ def sync_detailed(
75
86
 
76
87
  kwargs = _get_kwargs(
77
88
  identifier=identifier,
89
+ stream=stream,
78
90
  )
79
91
 
80
92
  response = client.get_httpx_client().request(
@@ -88,6 +100,7 @@ def sync(
88
100
  identifier: str,
89
101
  *,
90
102
  client: Union[Client],
103
+ stream: Union[Unset, bool] = UNSET,
91
104
  ) -> Optional[Union[ErrorResponse, GetProcessIdentifierLogsResponse200]]:
92
105
  """Get process logs
93
106
 
@@ -95,6 +108,7 @@ def sync(
95
108
 
96
109
  Args:
97
110
  identifier (str):
111
+ stream (Union[Unset, bool]):
98
112
 
99
113
  Raises:
100
114
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -107,6 +121,7 @@ def sync(
107
121
  return sync_detailed(
108
122
  identifier=identifier,
109
123
  client=client,
124
+ stream=stream,
110
125
  ).parsed
111
126
 
112
127
 
@@ -114,6 +129,7 @@ async def asyncio_detailed(
114
129
  identifier: str,
115
130
  *,
116
131
  client: Union[Client],
132
+ stream: Union[Unset, bool] = UNSET,
117
133
  ) -> Response[Union[ErrorResponse, GetProcessIdentifierLogsResponse200]]:
118
134
  """Get process logs
119
135
 
@@ -121,6 +137,7 @@ async def asyncio_detailed(
121
137
 
122
138
  Args:
123
139
  identifier (str):
140
+ stream (Union[Unset, bool]):
124
141
 
125
142
  Raises:
126
143
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -132,6 +149,7 @@ async def asyncio_detailed(
132
149
 
133
150
  kwargs = _get_kwargs(
134
151
  identifier=identifier,
152
+ stream=stream,
135
153
  )
136
154
 
137
155
  response = await client.get_async_httpx_client().request(**kwargs)
@@ -143,6 +161,7 @@ async def asyncio(
143
161
  identifier: str,
144
162
  *,
145
163
  client: Union[Client],
164
+ stream: Union[Unset, bool] = UNSET,
146
165
  ) -> Optional[Union[ErrorResponse, GetProcessIdentifierLogsResponse200]]:
147
166
  """Get process logs
148
167
 
@@ -150,6 +169,7 @@ async def asyncio(
150
169
 
151
170
  Args:
152
171
  identifier (str):
172
+ stream (Union[Unset, bool]):
153
173
 
154
174
  Raises:
155
175
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -163,5 +183,6 @@ async def asyncio(
163
183
  await asyncio_detailed(
164
184
  identifier=identifier,
165
185
  client=client,
186
+ stream=stream,
166
187
  )
167
188
  ).parsed
@@ -0,0 +1,190 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import Client
8
+ from ...models.error_response import ErrorResponse
9
+ from ...models.get_process_identifier_logs_stream_response_200 import (
10
+ GetProcessIdentifierLogsStreamResponse200,
11
+ )
12
+ from ...types import UNSET, Response, Unset
13
+
14
+
15
+ def _get_kwargs(
16
+ identifier: str,
17
+ *,
18
+ stream: Union[Unset, bool] = UNSET,
19
+ ) -> dict[str, Any]:
20
+ params: dict[str, Any] = {}
21
+
22
+ params["stream"] = stream
23
+
24
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
25
+
26
+ _kwargs: dict[str, Any] = {
27
+ "method": "get",
28
+ "url": f"/process/{identifier}/logs/stream",
29
+ "params": params,
30
+ }
31
+
32
+ return _kwargs
33
+
34
+
35
+ def _parse_response(
36
+ *, client: Client, response: httpx.Response
37
+ ) -> Optional[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]:
38
+ if response.status_code == 200:
39
+ response_200 = GetProcessIdentifierLogsStreamResponse200.from_dict(response.json())
40
+
41
+ return response_200
42
+ if response.status_code == 404:
43
+ response_404 = ErrorResponse.from_dict(response.json())
44
+
45
+ return response_404
46
+ if response.status_code == 500:
47
+ response_500 = ErrorResponse.from_dict(response.json())
48
+
49
+ return response_500
50
+ if client.raise_on_unexpected_status:
51
+ raise errors.UnexpectedStatus(response.status_code, response.content)
52
+ else:
53
+ return None
54
+
55
+
56
+ def _build_response(
57
+ *, client: Client, response: httpx.Response
58
+ ) -> Response[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]:
59
+ return Response(
60
+ status_code=HTTPStatus(response.status_code),
61
+ content=response.content,
62
+ headers=response.headers,
63
+ parsed=_parse_response(client=client, response=response),
64
+ )
65
+
66
+
67
+ def sync_detailed(
68
+ identifier: str,
69
+ *,
70
+ client: Union[Client],
71
+ stream: Union[Unset, bool] = UNSET,
72
+ ) -> Response[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]:
73
+ """Get process logs in realtime
74
+
75
+ Get the stdout and stderr output of a process in realtime
76
+
77
+ Args:
78
+ identifier (str):
79
+ stream (Union[Unset, bool]):
80
+
81
+ Raises:
82
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
83
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
84
+
85
+ Returns:
86
+ Response[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]
87
+ """
88
+
89
+ kwargs = _get_kwargs(
90
+ identifier=identifier,
91
+ stream=stream,
92
+ )
93
+
94
+ response = client.get_httpx_client().request(
95
+ **kwargs,
96
+ )
97
+
98
+ return _build_response(client=client, response=response)
99
+
100
+
101
+ def sync(
102
+ identifier: str,
103
+ *,
104
+ client: Union[Client],
105
+ stream: Union[Unset, bool] = UNSET,
106
+ ) -> Optional[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]:
107
+ """Get process logs in realtime
108
+
109
+ Get the stdout and stderr output of a process in realtime
110
+
111
+ Args:
112
+ identifier (str):
113
+ stream (Union[Unset, bool]):
114
+
115
+ Raises:
116
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
117
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
118
+
119
+ Returns:
120
+ Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]
121
+ """
122
+
123
+ return sync_detailed(
124
+ identifier=identifier,
125
+ client=client,
126
+ stream=stream,
127
+ ).parsed
128
+
129
+
130
+ async def asyncio_detailed(
131
+ identifier: str,
132
+ *,
133
+ client: Union[Client],
134
+ stream: Union[Unset, bool] = UNSET,
135
+ ) -> Response[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]:
136
+ """Get process logs in realtime
137
+
138
+ Get the stdout and stderr output of a process in realtime
139
+
140
+ Args:
141
+ identifier (str):
142
+ stream (Union[Unset, bool]):
143
+
144
+ Raises:
145
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
146
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
147
+
148
+ Returns:
149
+ Response[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]
150
+ """
151
+
152
+ kwargs = _get_kwargs(
153
+ identifier=identifier,
154
+ stream=stream,
155
+ )
156
+
157
+ response = await client.get_async_httpx_client().request(**kwargs)
158
+
159
+ return _build_response(client=client, response=response)
160
+
161
+
162
+ async def asyncio(
163
+ identifier: str,
164
+ *,
165
+ client: Union[Client],
166
+ stream: Union[Unset, bool] = UNSET,
167
+ ) -> Optional[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]:
168
+ """Get process logs in realtime
169
+
170
+ Get the stdout and stderr output of a process in realtime
171
+
172
+ Args:
173
+ identifier (str):
174
+ stream (Union[Unset, bool]):
175
+
176
+ Raises:
177
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
178
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
179
+
180
+ Returns:
181
+ Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]
182
+ """
183
+
184
+ return (
185
+ await asyncio_detailed(
186
+ identifier=identifier,
187
+ client=client,
188
+ stream=stream,
189
+ )
190
+ ).parsed
@@ -10,11 +10,15 @@ from .file_request import FileRequest
10
10
  from .file_with_content import FileWithContent
11
11
  from .get_network_process_pid_ports_response_200 import GetNetworkProcessPidPortsResponse200
12
12
  from .get_process_identifier_logs_response_200 import GetProcessIdentifierLogsResponse200
13
+ from .get_process_identifier_logs_stream_response_200 import (
14
+ GetProcessIdentifierLogsStreamResponse200,
15
+ )
13
16
  from .port_monitor_request import PortMonitorRequest
14
17
  from .post_network_process_pid_monitor_response_200 import PostNetworkProcessPidMonitorResponse200
15
18
  from .process_kill_request import ProcessKillRequest
16
19
  from .process_request import ProcessRequest
17
20
  from .process_response import ProcessResponse
21
+ from .subdirectory import Subdirectory
18
22
  from .success_response import SuccessResponse
19
23
 
20
24
  __all__ = (
@@ -26,10 +30,12 @@ __all__ = (
26
30
  "FileWithContent",
27
31
  "GetNetworkProcessPidPortsResponse200",
28
32
  "GetProcessIdentifierLogsResponse200",
33
+ "GetProcessIdentifierLogsStreamResponse200",
29
34
  "PortMonitorRequest",
30
35
  "PostNetworkProcessPidMonitorResponse200",
31
36
  "ProcessKillRequest",
32
37
  "ProcessRequest",
33
38
  "ProcessResponse",
39
+ "Subdirectory",
34
40
  "SuccessResponse",
35
41
  )
@@ -7,6 +7,7 @@ from ..types import UNSET, Unset
7
7
 
8
8
  if TYPE_CHECKING:
9
9
  from ..models.file import File
10
+ from ..models.subdirectory import Subdirectory
10
11
 
11
12
 
12
13
  T = TypeVar("T", bound="Directory")
@@ -18,12 +19,12 @@ class Directory:
18
19
  Attributes:
19
20
  files (Union[Unset, list['File']]):
20
21
  path (Union[Unset, str]):
21
- subdirectories (Union[Unset, list['Directory']]): @name Subdirectories
22
+ subdirectories (Union[Unset, list['Subdirectory']]): @name Subdirectories
22
23
  """
23
24
 
24
25
  files: Union[Unset, list["File"]] = UNSET
25
26
  path: Union[Unset, str] = UNSET
26
- subdirectories: Union[Unset, list["Directory"]] = UNSET
27
+ subdirectories: Union[Unset, list["Subdirectory"]] = UNSET
27
28
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
28
29
 
29
30
  def to_dict(self) -> dict[str, Any]:
@@ -64,6 +65,7 @@ class Directory:
64
65
  @classmethod
65
66
  def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
66
67
  from ..models.file import File
68
+ from ..models.subdirectory import Subdirectory
67
69
 
68
70
  if not src_dict:
69
71
  return None
@@ -80,7 +82,7 @@ class Directory:
80
82
  subdirectories = []
81
83
  _subdirectories = d.pop("subdirectories", UNSET)
82
84
  for subdirectories_item_data in _subdirectories or []:
83
- subdirectories_item = Directory.from_dict(subdirectories_item_data)
85
+ subdirectories_item = Subdirectory.from_dict(subdirectories_item_data)
84
86
 
85
87
  subdirectories.append(subdirectories_item)
86
88
 
@@ -16,7 +16,7 @@ class File:
16
16
  last_modified (Union[Unset, str]):
17
17
  owner (Union[Unset, str]):
18
18
  path (Union[Unset, str]):
19
- permissions (Union[Unset, str]): swagger:strfmt string
19
+ permissions (Union[Unset, str]):
20
20
  size (Union[Unset, int]):
21
21
  """
22
22
 
@@ -17,7 +17,7 @@ class FileWithContent:
17
17
  last_modified (Union[Unset, str]):
18
18
  owner (Union[Unset, str]):
19
19
  path (Union[Unset, str]):
20
- permissions (Union[Unset, str]): swagger:strfmt string
20
+ permissions (Union[Unset, str]):
21
21
  size (Union[Unset, int]):
22
22
  """
23
23
 
@@ -0,0 +1,45 @@
1
+ from typing import Any, TypeVar
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ T = TypeVar("T", bound="GetProcessIdentifierLogsStreamResponse200")
7
+
8
+
9
+ @_attrs_define
10
+ class GetProcessIdentifierLogsStreamResponse200:
11
+ """ """
12
+
13
+ additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict)
14
+
15
+ def to_dict(self) -> dict[str, Any]:
16
+ field_dict: dict[str, Any] = {}
17
+ field_dict.update(self.additional_properties)
18
+
19
+ return field_dict
20
+
21
+ @classmethod
22
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
23
+ if not src_dict:
24
+ return None
25
+ d = src_dict.copy()
26
+ get_process_identifier_logs_stream_response_200 = cls()
27
+
28
+ get_process_identifier_logs_stream_response_200.additional_properties = d
29
+ return get_process_identifier_logs_stream_response_200
30
+
31
+ @property
32
+ def additional_keys(self) -> list[str]:
33
+ return list(self.additional_properties.keys())
34
+
35
+ def __getitem__(self, key: str) -> str:
36
+ return self.additional_properties[key]
37
+
38
+ def __setitem__(self, key: str, value: str) -> None:
39
+ self.additional_properties[key] = value
40
+
41
+ def __delitem__(self, key: str) -> None:
42
+ del self.additional_properties[key]
43
+
44
+ def __contains__(self, key: str) -> bool:
45
+ return key in self.additional_properties
@@ -0,0 +1,60 @@
1
+ from typing import Any, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ T = TypeVar("T", bound="Subdirectory")
9
+
10
+
11
+ @_attrs_define
12
+ class Subdirectory:
13
+ """
14
+ Attributes:
15
+ path (Union[Unset, str]):
16
+ """
17
+
18
+ path: Union[Unset, str] = UNSET
19
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
20
+
21
+ def to_dict(self) -> dict[str, Any]:
22
+ path = self.path
23
+
24
+ field_dict: dict[str, Any] = {}
25
+ field_dict.update(self.additional_properties)
26
+ field_dict.update({})
27
+ if path is not UNSET:
28
+ field_dict["path"] = path
29
+
30
+ return field_dict
31
+
32
+ @classmethod
33
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
34
+ if not src_dict:
35
+ return None
36
+ d = src_dict.copy()
37
+ path = d.pop("path", UNSET)
38
+
39
+ subdirectory = cls(
40
+ path=path,
41
+ )
42
+
43
+ subdirectory.additional_properties = d
44
+ return subdirectory
45
+
46
+ @property
47
+ def additional_keys(self) -> list[str]:
48
+ return list(self.additional_properties.keys())
49
+
50
+ def __getitem__(self, key: str) -> Any:
51
+ return self.additional_properties[key]
52
+
53
+ def __setitem__(self, key: str, value: Any) -> None:
54
+ self.additional_properties[key] = value
55
+
56
+ def __delitem__(self, key: str) -> None:
57
+ del self.additional_properties[key]
58
+
59
+ def __contains__(self, key: str) -> bool:
60
+ return key in self.additional_properties
@@ -97,6 +97,8 @@ class SandboxFileSystem(SandboxHandleBase):
97
97
  raise Exception("Unsupported file type")
98
98
 
99
99
  def format_path(self, path: str) -> str:
100
+ if path == "/":
101
+ return "%2F"
100
102
  if path.startswith("/"):
101
103
  path = path[1:]
102
104
  return path
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: blaxel
3
- Version: 0.1.10rc38
3
+ Version: 0.1.10rc40
4
4
  Summary: Add your description here
5
5
  Author-email: cploujoux <cploujoux@blaxel.ai>
6
6
  License-File: LICENSE