modAL 1.2.4.dev0__py3-none-any.whl → 1.2.4.dev1__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.
modal/_tunnel.py CHANGED
@@ -51,13 +51,17 @@ class Tunnel:
51
51
 
52
52
 
53
53
  @asynccontextmanager
54
- async def _forward(port: int, *, unencrypted: bool = False, client: Optional[_Client] = None) -> AsyncIterator[Tunnel]:
54
+ async def _forward(
55
+ port: int, *, unencrypted: bool = False, h2_enabled: bool = False, client: Optional[_Client] = None
56
+ ) -> AsyncIterator[Tunnel]:
55
57
  """Expose a port publicly from inside a running Modal container, with TLS.
56
58
 
57
59
  If `unencrypted` is set, this also exposes the TCP socket without encryption on a random port
58
60
  number. This can be used to SSH into a container (see example below). Note that it is on the public Internet, so
59
61
  make sure you are using a secure protocol over TCP.
60
62
 
63
+ If `h2_enabled` is set, the TLS server will advertise support for HTTP/2.
64
+
61
65
  **Important:** This is an experimental API which may change in the future.
62
66
 
63
67
  **Usage:**
@@ -168,6 +172,8 @@ async def _forward(port: int, *, unencrypted: bool = False, client: Optional[_Cl
168
172
  raise InvalidError(f"The port argument should be an int, not {port!r}")
169
173
  if port < 1 or port > 65535:
170
174
  raise InvalidError(f"Invalid port number {port}")
175
+ if h2_enabled and unencrypted:
176
+ raise InvalidError("H2 can only be used with encrypted ports")
171
177
 
172
178
  if not client:
173
179
  client = await _Client.from_env()
@@ -175,8 +181,11 @@ async def _forward(port: int, *, unencrypted: bool = False, client: Optional[_Cl
175
181
  if client.client_type != api_pb2.CLIENT_TYPE_CONTAINER:
176
182
  raise InvalidError("Forwarding ports only works inside a Modal container")
177
183
 
184
+ tunnel_type = api_pb2.TUNNEL_TYPE_H2 if h2_enabled else api_pb2.TUNNEL_TYPE_UNSPECIFIED
178
185
  try:
179
- response = await client.stub.TunnelStart(api_pb2.TunnelStartRequest(port=port, unencrypted=unencrypted))
186
+ response = await client.stub.TunnelStart(
187
+ api_pb2.TunnelStartRequest(port=port, unencrypted=unencrypted, tunnel_type=tunnel_type)
188
+ )
180
189
  except GRPCError as exc:
181
190
  if exc.status == Status.ALREADY_EXISTS:
182
191
  raise InvalidError(f"Port {port} is already forwarded")
modal/_tunnel.pyi CHANGED
@@ -54,7 +54,11 @@ class Tunnel:
54
54
  ...
55
55
 
56
56
  def _forward(
57
- port: int, *, unencrypted: bool = False, client: typing.Optional[modal.client._Client] = None
57
+ port: int,
58
+ *,
59
+ unencrypted: bool = False,
60
+ h2_enabled: bool = False,
61
+ client: typing.Optional[modal.client._Client] = None,
58
62
  ) -> typing.AsyncContextManager[Tunnel]:
59
63
  '''Expose a port publicly from inside a running Modal container, with TLS.
60
64
 
@@ -62,6 +66,8 @@ def _forward(
62
66
  number. This can be used to SSH into a container (see example below). Note that it is on the public Internet, so
63
67
  make sure you are using a secure protocol over TCP.
64
68
 
69
+ If `h2_enabled` is set, the TLS server will advertise support for HTTP/2.
70
+
65
71
  **Important:** This is an experimental API which may change in the future.
66
72
 
67
73
  **Usage:**
@@ -171,7 +177,13 @@ def _forward(
171
177
 
172
178
  class __forward_spec(typing_extensions.Protocol):
173
179
  def __call__(
174
- self, /, port: int, *, unencrypted: bool = False, client: typing.Optional[modal.client.Client] = None
180
+ self,
181
+ /,
182
+ port: int,
183
+ *,
184
+ unencrypted: bool = False,
185
+ h2_enabled: bool = False,
186
+ client: typing.Optional[modal.client.Client] = None,
175
187
  ) -> synchronicity.combined_types.AsyncAndBlockingContextManager[Tunnel]:
176
188
  '''Expose a port publicly from inside a running Modal container, with TLS.
177
189
 
@@ -179,6 +191,8 @@ class __forward_spec(typing_extensions.Protocol):
179
191
  number. This can be used to SSH into a container (see example below). Note that it is on the public Internet, so
180
192
  make sure you are using a secure protocol over TCP.
181
193
 
194
+ If `h2_enabled` is set, the TLS server will advertise support for HTTP/2.
195
+
182
196
  **Important:** This is an experimental API which may change in the future.
183
197
 
184
198
  **Usage:**
@@ -287,7 +301,13 @@ class __forward_spec(typing_extensions.Protocol):
287
301
  ...
288
302
 
289
303
  def aio(
290
- self, /, port: int, *, unencrypted: bool = False, client: typing.Optional[modal.client.Client] = None
304
+ self,
305
+ /,
306
+ port: int,
307
+ *,
308
+ unencrypted: bool = False,
309
+ h2_enabled: bool = False,
310
+ client: typing.Optional[modal.client.Client] = None,
291
311
  ) -> typing.AsyncContextManager[Tunnel]:
292
312
  '''Expose a port publicly from inside a running Modal container, with TLS.
293
313
 
@@ -295,6 +315,8 @@ class __forward_spec(typing_extensions.Protocol):
295
315
  number. This can be used to SSH into a container (see example below). Note that it is on the public Internet, so
296
316
  make sure you are using a secure protocol over TCP.
297
317
 
318
+ If `h2_enabled` is set, the TLS server will advertise support for HTTP/2.
319
+
298
320
  **Important:** This is an experimental API which may change in the future.
299
321
 
300
322
  **Usage:**
modal/client.pyi CHANGED
@@ -32,7 +32,7 @@ class _Client:
32
32
  server_url: str,
33
33
  client_type: int,
34
34
  credentials: typing.Optional[tuple[str, str]],
35
- version: str = "1.2.4.dev0",
35
+ version: str = "1.2.4.dev1",
36
36
  ):
37
37
  """mdmd:hidden
38
38
  The Modal client object is not intended to be instantiated directly by users.
@@ -163,7 +163,7 @@ class Client:
163
163
  server_url: str,
164
164
  client_type: int,
165
165
  credentials: typing.Optional[tuple[str, str]],
166
- version: str = "1.2.4.dev0",
166
+ version: str = "1.2.4.dev1",
167
167
  ):
168
168
  """mdmd:hidden
169
169
  The Modal client object is not intended to be instantiated directly by users.
@@ -30,13 +30,14 @@ class _FlashManager:
30
30
  port: int,
31
31
  process: Optional[subprocess.Popen] = None,
32
32
  health_check_url: Optional[str] = None,
33
+ h2_enabled: bool = False,
33
34
  ):
34
35
  self.client = client
35
36
  self.port = port
36
37
  # Health check is not currently being used
37
38
  self.health_check_url = health_check_url
38
39
  self.process = process
39
- self.tunnel_manager = _forward_tunnel(port, client=client)
40
+ self.tunnel_manager = _forward_tunnel(port, h2_enabled=h2_enabled, client=client)
40
41
  self.stopped = False
41
42
  self.num_failures = 0
42
43
  self.task_id = os.environ["MODAL_TASK_ID"]
@@ -170,6 +171,7 @@ async def flash_forward(
170
171
  port: int,
171
172
  process: Optional[subprocess.Popen] = None,
172
173
  health_check_url: Optional[str] = None,
174
+ h2_enabled: bool = False,
173
175
  ) -> _FlashManager:
174
176
  """
175
177
  Forward a port to the Modal Flash service, exposing that port as a stable web endpoint.
@@ -178,7 +180,7 @@ async def flash_forward(
178
180
  """
179
181
  client = await _Client.from_env()
180
182
 
181
- manager = _FlashManager(client, port, process=process, health_check_url=health_check_url)
183
+ manager = _FlashManager(client, port, process=process, health_check_url=health_check_url, h2_enabled=h2_enabled)
182
184
  await manager._start()
183
185
  return manager
184
186
 
@@ -10,6 +10,7 @@ class _FlashManager:
10
10
  port: int,
11
11
  process: typing.Optional[subprocess.Popen] = None,
12
12
  health_check_url: typing.Optional[str] = None,
13
+ h2_enabled: bool = False,
13
14
  ):
14
15
  """Initialize self. See help(type(self)) for accurate signature."""
15
16
  ...
@@ -36,6 +37,7 @@ class FlashManager:
36
37
  port: int,
37
38
  process: typing.Optional[subprocess.Popen] = None,
38
39
  health_check_url: typing.Optional[str] = None,
40
+ h2_enabled: bool = False,
39
41
  ): ...
40
42
 
41
43
  class __is_port_connection_healthy_spec(typing_extensions.Protocol[SUPERSELF]):
@@ -92,6 +94,7 @@ class __flash_forward_spec(typing_extensions.Protocol):
92
94
  port: int,
93
95
  process: typing.Optional[subprocess.Popen] = None,
94
96
  health_check_url: typing.Optional[str] = None,
97
+ h2_enabled: bool = False,
95
98
  ) -> FlashManager:
96
99
  """Forward a port to the Modal Flash service, exposing that port as a stable web endpoint.
97
100
  This is a highly experimental method that can break or be removed at any time without warning.
@@ -105,6 +108,7 @@ class __flash_forward_spec(typing_extensions.Protocol):
105
108
  port: int,
106
109
  process: typing.Optional[subprocess.Popen] = None,
107
110
  health_check_url: typing.Optional[str] = None,
111
+ h2_enabled: bool = False,
108
112
  ) -> FlashManager:
109
113
  """Forward a port to the Modal Flash service, exposing that port as a stable web endpoint.
110
114
  This is a highly experimental method that can break or be removed at any time without warning.
modal/functions.pyi CHANGED
@@ -408,7 +408,7 @@ class Function(
408
408
 
409
409
  _call_generator: ___call_generator_spec[typing_extensions.Self]
410
410
 
411
- class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
411
+ class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
412
412
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
413
413
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
414
414
  ...
@@ -417,7 +417,7 @@ class Function(
417
417
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
418
418
  ...
419
419
 
420
- remote: __remote_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
420
+ remote: __remote_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
421
421
 
422
422
  class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
423
423
  def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
@@ -444,7 +444,7 @@ class Function(
444
444
  """
445
445
  ...
446
446
 
447
- class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
447
+ class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
448
448
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
449
449
  """[Experimental] Calls the function with the given arguments, without waiting for the results.
450
450
 
@@ -468,7 +468,7 @@ class Function(
468
468
  ...
469
469
 
470
470
  _experimental_spawn: ___experimental_spawn_spec[
471
- modal._functions.P, modal._functions.ReturnType, typing_extensions.Self
471
+ modal._functions.ReturnType, modal._functions.P, typing_extensions.Self
472
472
  ]
473
473
 
474
474
  class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER, SUPERSELF]):
@@ -477,7 +477,7 @@ class Function(
477
477
 
478
478
  _spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P, typing_extensions.Self]
479
479
 
480
- class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
480
+ class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
481
481
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
482
482
  """Calls the function with the given arguments, without waiting for the results.
483
483
 
@@ -498,7 +498,7 @@ class Function(
498
498
  """
499
499
  ...
500
500
 
501
- spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
501
+ spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
502
502
 
503
503
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
504
504
  """Return the inner Python object wrapped by this Modal Function."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.2.4.dev0
3
+ Version: 1.2.4.dev1
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License: Apache-2.0
@@ -17,8 +17,8 @@ modal/_resolver.py,sha256=j_nhDXxT2gbmNEx5b0B8An4ZEt4EKdVLncIj8zF9-nU,7241
17
17
  modal/_resources.py,sha256=NMAp0GCLutiZI4GuKSIVnRHVlstoD3hNGUabjTUtzf4,1794
18
18
  modal/_serialization.py,sha256=_3-Z9jSoleDnv2HghH2kfo0m_WG8Iajs1wop1Iqnam8,26341
19
19
  modal/_traceback.py,sha256=muKP7RbAXq74UGwkaVIdOxDdfDug0UcDKr9fe4LL3m8,6503
20
- modal/_tunnel.py,sha256=zTBxBiuH1O22tS1OliAJdIsSmaZS8PlnifS_6S5z-mk,6320
21
- modal/_tunnel.pyi,sha256=rvC7USR2BcKkbZIeCJXwf7-UfGE-LPLjKsGNiK7Lxa4,13366
20
+ modal/_tunnel.py,sha256=hWTfAwrepjAEDjfsYvTWBpucVRZt78NJjwWDZBwyk_Y,6676
21
+ modal/_tunnel.pyi,sha256=FoedJzHymbPk4Bmnbszm6uhay2rMq1JS9mIiHELYf3k,13804
22
22
  modal/_type_manager.py,sha256=DWjgmjYJuOagw2erin506UUbG2H5UzZCFEekS-7hmfA,9087
23
23
  modal/_watcher.py,sha256=K6LYnlmSGQB4tWWI9JADv-tvSvQ1j522FwT71B51CX8,3584
24
24
  modal/app.py,sha256=OXE8YBC8Xce3MxjcNu1uzJ9MUfwdYQRLV7TWSdpWSrU,56704
@@ -26,7 +26,7 @@ modal/app.pyi,sha256=nI_Tibj-rI5I7dJFJnczbHvcmVzCvvCih0tMzoQlr_Y,50835
26
26
  modal/billing.py,sha256=zmQ3bcCJlwa4KD1IA_QgdWpm1pn13c-7qfy79iEauYI,195
27
27
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
28
28
  modal/client.py,sha256=k1CqQ_0t4-vHylkqYZgYCnClg-FT0QrTPAKivL01A_k,14354
29
- modal/client.pyi,sha256=W9FJTO4f1IvFl-dXp1SF7-fLSpYxukK85DWNJZqOgL4,13146
29
+ modal/client.pyi,sha256=7y7KPRsh7TU76NsiKpR0mcuFSMfB8wwxpQgiCSfZGJg,13146
30
30
  modal/cloud_bucket_mount.py,sha256=cvVj5Rt4nDHoQbTneoJPTaAcnl_Ab_mrsjnnzd0v9OI,6013
31
31
  modal/cloud_bucket_mount.pyi,sha256=vXusGMOUk9HjCs4lhxteuCK4xLQclPfugGWKo7LECEA,7539
32
32
  modal/cls.py,sha256=4T__mtYlQUnkatif1Wnr8Ld9DN_ySydHj2UwhRg89ok,41984
@@ -43,7 +43,7 @@ modal/file_io.py,sha256=Whs3QSl3pQbSoLzSRIIWfK4XyP-kwgyZmWgx3bhJ9u0,20933
43
43
  modal/file_io.pyi,sha256=xtO6Glf_BFwDE7QiQQo24QqcMf_Vv-iz7WojcGVlLBU,15932
44
44
  modal/file_pattern_matcher.py,sha256=A_Kdkej6q7YQyhM_2-BvpFmPqJ0oHb54B6yf9VqvPVE,8116
45
45
  modal/functions.py,sha256=kcNHvqeGBxPI7Cgd57NIBBghkfbeFJzXO44WW0jSmao,325
46
- modal/functions.pyi,sha256=FzDOtv5YX3NbqQ3s2BIizDWmSlzdZiWtN9qsUNQCxiY,38034
46
+ modal/functions.pyi,sha256=ZrK759InbJvVMlczRpU4iOczGvf43Nkn_L0VsWR6Hxo,38034
47
47
  modal/gpu.py,sha256=Fe5ORvVPDIstSq1xjmM6OoNgLYFWvogP9r5BgmD3hYg,6769
48
48
  modal/image.py,sha256=Pi1tpi41rklU-7PvXyJxPBYKdG3FcW-H_2pWjjeLYzs,108165
49
49
  modal/image.pyi,sha256=grkqK9BfyKDXmJYNme-lGa0O3u7pOU5GifyLOAhG3sc,78202
@@ -155,10 +155,10 @@ modal/cli/programs/run_jupyter.py,sha256=IJw8nds8Cjl9j4dxBqMGxhz-bIyVX0kle7jbt8H
155
155
  modal/cli/programs/run_marimo.py,sha256=QlCGPkwQ0XLajt2LtujR_BGsRV1AZ3OCUgZxkkM1lug,2893
156
156
  modal/cli/programs/vscode.py,sha256=E1aJPU7b8RWWj-JX71DifsCoLYsCAnre7lATiBJjUms,3386
157
157
  modal/experimental/__init__.py,sha256=sCwNbBLcR2t-jhrpwtMAPGKt2WNqXBg0xkNZdyB-6CE,13940
158
- modal/experimental/flash.py,sha256=RKS3X3h4tY_mOLcMzbRs5tNCLPFL01dBAhCZSqCeBgA,26675
159
- modal/experimental/flash.pyi,sha256=uwinKAYxpunNNfBj58FP88DXb535Qik4F6tnJKPAIwQ,14696
158
+ modal/experimental/flash.py,sha256=0afbNEg8SLBdUbvFpT3R9FE1mfHAV_Iual8x2hqfPMY,26785
159
+ modal/experimental/flash.pyi,sha256=BU7v9gFLWX1OanZ3HpRoVGp4qFfHo93lM9UkzcNFZUY,14832
160
160
  modal/experimental/ipython.py,sha256=TrCfmol9LGsRZMeDoeMPx3Hv3BFqQhYnmD_iH0pqdhk,2904
161
- modal-1.2.4.dev0.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
161
+ modal-1.2.4.dev1.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
162
162
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
163
163
  modal_docs/gen_cli_docs.py,sha256=c1yfBS_x--gL5bs0N4ihMwqwX8l3IBWSkBAKNNIi6bQ,3801
164
164
  modal_docs/gen_reference_docs.py,sha256=d_CQUGQ0rfw28u75I2mov9AlS773z9rG40-yq5o7g2U,6359
@@ -186,10 +186,10 @@ modal_proto/task_command_router_pb2.py,sha256=_pD2ZpU0bNzhwBdzmLoLyLtAtftI_Agxwn
186
186
  modal_proto/task_command_router_pb2.pyi,sha256=EyDgXPLr7alqjXYERV8w_MPuO404x0uCppmSkrfE9IE,14589
187
187
  modal_proto/task_command_router_pb2_grpc.py,sha256=uEQ0HdrCp8v-9bB5yIic9muA8spCShLHY6Bz9cCgOUE,10114
188
188
  modal_proto/task_command_router_pb2_grpc.pyi,sha256=s3Yxsrawdj4nr8vqQqsAxyX6ilWaGbdECy425KKbLIA,3301
189
- modal_version/__init__.py,sha256=imK_0gJ5IHJQbSKC5tnh--LQu4rPz9jMsl2mA37Gsmk,120
189
+ modal_version/__init__.py,sha256=u5-QEWNgLAG59_PTZZX6NQ2-_aCo6X4oALjY1Ir_ekE,120
190
190
  modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
191
- modal-1.2.4.dev0.dist-info/METADATA,sha256=Cc96KeEsZNNPrznlhLdu0ZYKonwSLDSUBHlcAl0AGwE,2489
192
- modal-1.2.4.dev0.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
193
- modal-1.2.4.dev0.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
194
- modal-1.2.4.dev0.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
195
- modal-1.2.4.dev0.dist-info/RECORD,,
191
+ modal-1.2.4.dev1.dist-info/METADATA,sha256=KKNyRVaO68uRgGRHoWGN8JjUDV2M5j9WzcsbgwTWXmw,2489
192
+ modal-1.2.4.dev1.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
193
+ modal-1.2.4.dev1.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
194
+ modal-1.2.4.dev1.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
195
+ modal-1.2.4.dev1.dist-info/RECORD,,
modal_version/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # Copyright Modal Labs 2025
2
2
  """Supplies the current version of the modal client library."""
3
3
 
4
- __version__ = "1.2.4.dev0"
4
+ __version__ = "1.2.4.dev1"