modal 1.6.2.dev2__py3-none-any.whl → 1.6.2.dev3__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/_environments.py CHANGED
@@ -54,7 +54,7 @@ class _EnvironmentManager:
54
54
  modal.Environment.objects.create("my-environment")
55
55
  ```
56
56
  """
57
- check_environment_name(name)
57
+ check_environment_name(name, allow_periods=False)
58
58
 
59
59
  client = await _Client.from_env() if client is None else client
60
60
  request = api_pb2.EnvironmentCreateRequest(name=name, is_managed=restricted)
@@ -464,7 +464,7 @@ class _Environment(_Object, type_prefix="en"):
464
464
  client: _Client | None = None,
465
465
  ) -> "_Environment":
466
466
  """Look up an Environment object using its name."""
467
- check_environment_name(name)
467
+ check_environment_name(name, allow_periods=True)
468
468
  return _Environment._get_or_create(
469
469
  name=name,
470
470
  repr=f"Environment.from_name({name!r})",
@@ -27,13 +27,15 @@ def is_valid_object_name(name: str) -> bool:
27
27
  )
28
28
 
29
29
 
30
- def is_valid_environment_name(name: str) -> bool:
30
+ def is_valid_environment_name(name: str, *, allow_periods: bool) -> bool:
31
31
  # first char is alnum, the rest allows other chars
32
32
  # The "en-" prefix is reserved for environment IDs, so that references
33
33
  # to environments can be resolved by either name or ID unambiguously.
34
+ # New names cannot contain periods, but some existing Environments have them and must stay resolvable.
35
+ rest_chars = r"a-zA-Z0-9-_." if allow_periods else r"a-zA-Z0-9-_"
34
36
  return (
35
37
  len(name) <= 64
36
- and re.match(r"^[a-zA-Z0-9][a-zA-Z0-9-_.]+$", name) is not None
38
+ and re.match(rf"^[a-zA-Z0-9][{rest_chars}]*$", name) is not None
37
39
  and not name.lower().startswith("en-")
38
40
  )
39
41
 
@@ -67,12 +69,12 @@ def check_object_name(name: str, object_type: str) -> None:
67
69
  raise InvalidError(message)
68
70
 
69
71
 
70
- def check_environment_name(name: str) -> None:
72
+ def check_environment_name(name: str, *, allow_periods: bool) -> None:
71
73
  message = (
72
74
  f"Invalid Environment name: '{name}'."
73
- "\n\nEnvironment names can only start with alphanumeric characters,"
74
- " may contain only alphanumeric characters, dashes, periods, and underscores,"
75
- " must be shorter than 64 characters, and cannot start with 'en-'."
75
+ "\n\nEnvironment names must be 1-64 characters, can only start with alphanumeric characters,"
76
+ " may contain only alphanumeric characters, dashes, and underscores,"
77
+ " and cannot start with 'en-'."
76
78
  )
77
- if not is_valid_environment_name(name):
79
+ if not is_valid_environment_name(name, allow_periods=allow_periods):
78
80
  raise InvalidError(message)
modal/cli/endpoint.py CHANGED
@@ -260,7 +260,7 @@ async def list_(*, json: bool = False, env: Optional[str] = None):
260
260
  @click.option(
261
261
  "--name",
262
262
  default=None,
263
- help="Endpoint name. If not provided, a default will be derived from the model name.",
263
+ help="Endpoint name. Defaults to inference-{number} if not provided.",
264
264
  )
265
265
  @click.option(
266
266
  "--model",
@@ -410,6 +410,8 @@ async def create(
410
410
 
411
411
  output = OutputManager.get()
412
412
  output.print(f"[green]✓[/green] Endpoint '{resp.name}' ({resp.endpoint_id}) was created and started provisioning.")
413
+ if resp.model_name:
414
+ output.print(f' → Send [cyan]"model": "{resp.model_name}"[/cyan] in requests to the Endpoint.')
413
415
  if resp.endpoint_page_url:
414
416
  output.print(f" → View progress at [magenta]{resp.endpoint_page_url}[/magenta].")
415
417
  output.print(" → The Endpoint will also appear in [cyan]modal endpoint list[/cyan].")
@@ -517,6 +519,7 @@ async def info(
517
519
  {
518
520
  "name": endpoint_info.name,
519
521
  "endpoint_id": endpoint_id,
522
+ "model_name": endpoint_info.model_name or None,
520
523
  "repo_id": endpoint_info.repo_id,
521
524
  "revision": endpoint_info.revision or None,
522
525
  "volume_id": endpoint_info.volume_id or None,
@@ -547,6 +550,8 @@ async def info(
547
550
  header.add_row(Text("Endpoint:"), endpoint_text)
548
551
  header.add_row(Text("Endpoint ID:"), Text(endpoint_id))
549
552
  header.add_row(Text("State:"), Text(status))
553
+ if endpoint_info.model_name:
554
+ header.add_row(Text("Model name:"), Text(endpoint_info.model_name))
550
555
  model_text = Text(endpoint_info.repo_id)
551
556
  if endpoint_info.revision:
552
557
  model_text.append(f"@{endpoint_info.revision[:7]}")
modal/cli/environment.py CHANGED
@@ -87,7 +87,7 @@ def create(
87
87
  default_role: str | None = None,
88
88
  public: bool = False,
89
89
  ):
90
- check_environment_name(name)
90
+ check_environment_name(name, allow_periods=False)
91
91
  Environment.objects.create(
92
92
  name,
93
93
  restricted=restricted,
@@ -116,8 +116,8 @@ def update(
116
116
  if set_name is None and set_web_suffix is None:
117
117
  raise UsageError("You need to at least one new property (using --set-name or --set-web-suffix)")
118
118
 
119
- if set_name:
120
- check_environment_name(set_name)
119
+ if set_name and set_name != current_name:
120
+ check_environment_name(set_name, allow_periods=False)
121
121
 
122
122
  environments.update_environment(current_name, new_name=set_name, new_web_suffix=set_web_suffix)
123
123
  rich.print("[green]✓[/green] Environment updated")
modal/client.pyi CHANGED
@@ -80,7 +80,7 @@ class _Client:
80
80
  server_url: str,
81
81
  client_type: int,
82
82
  credentials: typing.Optional[tuple[str, str]],
83
- version: str = "1.6.2.dev2",
83
+ version: str = "1.6.2.dev3",
84
84
  *,
85
85
  oauth_credentials: typing.Optional[_OAuthCredentials] = None,
86
86
  ):
@@ -290,7 +290,7 @@ class Client:
290
290
  server_url: str,
291
291
  client_type: int,
292
292
  credentials: typing.Optional[tuple[str, str]],
293
- version: str = "1.6.2.dev2",
293
+ version: str = "1.6.2.dev3",
294
294
  *,
295
295
  oauth_credentials: typing.Optional[_OAuthCredentials] = None,
296
296
  ):
modal/functions.pyi CHANGED
@@ -613,7 +613,7 @@ class Function(
613
613
 
614
614
  _call_generator: ___call_generator_spec
615
615
 
616
- class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
616
+ class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
617
617
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
618
618
  """Calls the function remotely, executing it with the given arguments and returning the execution's result.
619
619
 
@@ -638,7 +638,7 @@ class Function(
638
638
  """
639
639
  ...
640
640
 
641
- remote: __remote_spec[modal._functions.ReturnType, modal._functions.P]
641
+ remote: __remote_spec[modal._functions.P, modal._functions.ReturnType]
642
642
 
643
643
  class __remote_gen_spec(typing_extensions.Protocol):
644
644
  def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
@@ -688,7 +688,7 @@ class Function(
688
688
  """
689
689
  ...
690
690
 
691
- class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
691
+ class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
692
692
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
693
693
  """[Experimental] Calls the function with the given arguments, without waiting for the results.
694
694
 
@@ -721,7 +721,7 @@ class Function(
721
721
  """
722
722
  ...
723
723
 
724
- _experimental_spawn: ___experimental_spawn_spec[modal._functions.ReturnType, modal._functions.P]
724
+ _experimental_spawn: ___experimental_spawn_spec[modal._functions.P, modal._functions.ReturnType]
725
725
 
726
726
  class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER]):
727
727
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> None: ...
@@ -729,7 +729,7 @@ class Function(
729
729
 
730
730
  _spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P]
731
731
 
732
- class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
732
+ class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
733
733
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
734
734
  """Calls the function with the given arguments, without waiting for the results.
735
735
 
@@ -762,7 +762,7 @@ class Function(
762
762
  """
763
763
  ...
764
764
 
765
- spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P]
765
+ spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType]
766
766
 
767
767
  @property
768
768
  def _raw_f_(self) -> collections.abc.Callable[..., typing.Any]: ...
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.6.2.dev2
3
+ Version: 1.6.2.dev3
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ modal/_billing.py,sha256=VEa-YKFsuKmRfWW1SPiXGiY84RzTTRvo8ILi0V10R28,3483
4
4
  modal/_cluster.py,sha256=aJJU4bIeosuSBDHoUpz6ckxLMqU8TbkS--h9LE2DMcY,7377
5
5
  modal/_cluster.pyi,sha256=ZEZ_ovUvhcE7F_BOwevwcHhc-sr68_2HKpxaqzZNeAA,3648
6
6
  modal/_container_entrypoint.py,sha256=mvKu0PceNUqCFgMk7eIx8_2lycMfRGPQJIgjQZbaOE8,22622
7
- modal/_environments.py,sha256=YOl2oSxvKmLrfc9DDT6KY4aLfIZ9gCOrssz07fXS7cg,27561
7
+ modal/_environments.py,sha256=O7YagqEUhmxEG5Q10Ch6FDSIsAKFbKXULLaeRw0uCio,27602
8
8
  modal/_function_variants.py,sha256=xF34OxGaZbmxe0chAJCQb9Uyc8TP78VG8MO55deBWLs,24398
9
9
  modal/_functions.py,sha256=hIP3RbIzk_njzVE1miC2hzObTbIa9-LQ1DHm3Whvpgw,112480
10
10
  modal/_grpc_client.py,sha256=ajCxTqhDk-rpWuYmUScRXwYMPVmvujo8ckvvv4l0czk,7088
@@ -37,7 +37,7 @@ modal/billing.py,sha256=E1-P_P8bJFLp-bTaggYd4BaaViImPB5UdtXiY8VeAZQ,390
37
37
  modal/billing.pyi,sha256=4m7VLYNS8IiJ2I3CJx0awvrOM6BILWRVLfdeqtAYr8M,7189
38
38
  modal/call_graph.py,sha256=XGALIDn1bLchWo_goyX23bcPjzCZcfqKUo8INIfDapo,1775
39
39
  modal/client.py,sha256=cstrL0wpXCZmcvRs7Sy3QRw9Vz8zkZy8NNk0tPe38sk,22852
40
- modal/client.pyi,sha256=08PWLhNyJyKvXkR-1C79kW5sO5AIb6KUOSS2yFRi0nw,23488
40
+ modal/client.pyi,sha256=-xShSANf8DRBMSBxDYj_3oWs90QMaQNrpvBkHhBf0Ic,23488
41
41
  modal/cloud_bucket_mount.py,sha256=ZOg69dhIFcJcwim4JP-6s1tqwOYAfgS9806jRpspifw,7511
42
42
  modal/cloud_bucket_mount.pyi,sha256=HoPe_NG5jYdVfmTNY-ZJ3-C8Eo_FzJovl9orJRjkGbE,10252
43
43
  modal/cls.py,sha256=sxKiVm8GQUuEnPx1KJfTHVdSqSmqnNj6U5CQbW37QsA,41771
@@ -54,7 +54,7 @@ modal/environments.pyi,sha256=drmg6yVLjpPhGJ4byOrdBEp2KRLburPrKT-FYtgNPoM,23628
54
54
  modal/exception.py,sha256=L-dUKust6feZzn5qhTVusSAr0IBa4Wa3qIA225IT_lY,12334
55
55
  modal/file_pattern_matcher.py,sha256=CpaNNj7oBlOSewX-AAUZCF8KDxH0_DmgwzfpVGbPYJ4,8138
56
56
  modal/functions.py,sha256=EZRcHFfnoYbvawUJnAHF5nIvoo9GX2Djy7mUmOCXmXc,258
57
- modal/functions.pyi,sha256=fT7lbQJT7vOuBj73ee7JPB0k06AyLitJIZgixlAWYd0,56311
57
+ modal/functions.pyi,sha256=RPXVlUgs9XxdjzBhgVvD_vBl6GQ4FjWxJxZqha6GITU,56311
58
58
  modal/image.py,sha256=c0lUSAoU-Ip3g5DGZ0uhdCzoWSQWh1g0i-7Rxo-Sz-I,160
59
59
  modal/image.pyi,sha256=R5rdY4P30IEm-F7A2S9CdXa6QYNk-pQwsEun9BKTyLw,61094
60
60
  modal/io_streams.py,sha256=fL1mJw3uvAtKtoKiAP-uB-cAG3JM8fnKV32r0SnhgcQ,32990
@@ -139,7 +139,7 @@ modal/_utils/idle_countdown.py,sha256=oh653Syrjvv--RzJCf4nPaS-U2FK0snmuG_lRJ5KB9
139
139
  modal/_utils/jwt_utils.py,sha256=KUoqGHMM4ewDyTsTKXPm1wrMu8Z6lp0l8VILHufm484,1354
140
140
  modal/_utils/logger.py,sha256=NgbMKFT9chYYt_TU01DdIior5ByYr2gZtrWIk1SFRLc,1782
141
141
  modal/_utils/mount_utils.py,sha256=-jXLNauPLLdj-7-PU280h8emA3ycqedYUEO-1tWk2Kw,4974
142
- modal/_utils/name_utils.py,sha256=k3BHNWjO1-zcUsUV_hF6U1s9yz0EhT4y20bJwiTb4OA,2762
142
+ modal/_utils/name_utils.py,sha256=FQJa4GL5ie1VCvByEv7AUx_LqKm8y3pL72xGHd8EQ4Q,2997
143
143
  modal/_utils/package_utils.py,sha256=jYE7WFVzYWIfO0ZJhno_BYHb6Skp48uupOiw1a3yWzw,2056
144
144
  modal/_utils/pattern_utils.py,sha256=Dtqh0jL07-RJYK2FMBKgkUzAXnN1CUtDAiKdpeJFGro,6736
145
145
  modal/_utils/proxy_support.py,sha256=hLA_XojYxzPysOiLqyUbB-SgMLmn_X8WtXTk92xh7g4,3162
@@ -175,9 +175,9 @@ modal/cli/container.py,sha256=NAOP7YonB8NfOLQX2IHTze7ApEE7S9I1N8Eb1Y2Xwjk,12386
175
175
  modal/cli/curl.py,sha256=FIT0wCwmpOt1AgGfKsSqWOnei-eDv-KMnt5hdg9_DUY,4524
176
176
  modal/cli/dashboard.py,sha256=6V8BLYIooToNRM83PRAWaw1imxED3AzmApYNNti-pJk,917
177
177
  modal/cli/dict.py,sha256=m6JL4QCcPjCidK-qonYvq97qzRRb-F5spUI5PvVCa3Y,5152
178
- modal/cli/endpoint.py,sha256=dVJHfrXhAxhmuQyZPD7BI4CiREArjYe2xQLNPozyniE,28350
178
+ modal/cli/endpoint.py,sha256=grS3cQCNw2qhnczirDoYCiBEnUXp3paPK_4MVSZk7gA,28642
179
179
  modal/cli/entry_point.py,sha256=Sy9w9C2RHG9XDalJ0Fjwr4yQc4dTEL9gVNQuDrj3woI,5050
180
- modal/cli/environment.py,sha256=cmASvzqkSofHQ7wKhVdKYKxrAFIKUvyc88rTpCE8AIc,18306
180
+ modal/cli/environment.py,sha256=rKnKQFsbcLXjBtYWLFRqhP1NeCjMnqvSPci7Md4ZjIM,18377
181
181
  modal/cli/function.py,sha256=kb_Q5wrlYp4vCftwT0OxlREKkEI_-yJg12npz11-EKA,42297
182
182
  modal/cli/image.py,sha256=Ve-PDT4XTH9KEQrZxvUc2ocAW4mLI5QfwQssaajK4MI,8073
183
183
  modal/cli/import_refs.py,sha256=gxoogHVixec1-qj_FUwhWQXqjy9yvqYCNuAYWCCFEWk,15994
@@ -203,7 +203,7 @@ modal/experimental/flash_server.py,sha256=iqxVoQij6aM58_h0la6Y_Vy3CCQj8iYmjzt79r
203
203
  modal/experimental/flash_server.pyi,sha256=LuIBqeOJ1NAapKWnJMRzzrwIHlIK2GcOLOI2r-z_QN0,1025
204
204
  modal/experimental/ipython.py,sha256=kJ6o9wkAY_MiSb7paewI7f1MJAeqdi8TX5pBdhr_mUI,2925
205
205
  modal/skills/modal/SKILL.md,sha256=Bm-0BPTYppJoeQzA-N-Re8L6-nKnV6gspJXMl4cD0P0,5490
206
- modal-1.6.2.dev2.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
206
+ modal-1.6.2.dev3.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
207
207
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
208
208
  modal_docs/gen_cli_docs.py,sha256=9-b8vl2EsLWD9zJqpCK8IUi5h44Bjn3i3rSdedZV4bA,6415
209
209
  modal_docs/gen_cli_docs_main.py,sha256=UPGr7O1DYTIRLwfINe2rbdh89J3cPVTU1OWL-SjxnOQ,198
@@ -216,8 +216,8 @@ modal_docs/mdmd/signatures.py,sha256=OASroKle763Kfumn4Ek4PABJXEGP56JMCTug44QoBx4
216
216
  modal_docs/mdmd/types.py,sha256=tv7fvziPr-MeDzOp4e2pK5h3d1DXTUOO74rPqDoBn6g,736
217
217
  modal_proto/__init__.py,sha256=Hkou4lcD5tArEkW_9v9KZhLY7fl0fA9-O28beKU55pg,396
218
218
  modal_proto/api_grpc.py,sha256=KxLECZV7ZaGXW49yYYW0TooRkgJ3KyijbtnRXlVfhB0,199086
219
- modal_proto/api_pb2.py,sha256=sAzmEm53sIm962aEXo06FOzd4DCS8sG720wwsOUE4AI,568956
220
- modal_proto/api_pb2.pyi,sha256=10brUOSW09-UoxKhvcVi_dZq15vn4UgHEH8Gk8WTWRc,786226
219
+ modal_proto/api_pb2.py,sha256=Cb7l4tkiaPwl6fMNcBVz2f4k0XwlDMnMQCr-rIN73yQ,569124
220
+ modal_proto/api_pb2.pyi,sha256=P5mqeNDHocrZr8QRAuwFJ0Y1_u3CK5vMrt_CMxJMv3E,787096
221
221
  modal_proto/api_pb2_grpc.py,sha256=Wf2QuVkC3XfKvH5aQKhwiqoEzAALTBV5KI9L77o7k08,426312
222
222
  modal_proto/api_pb2_grpc.pyi,sha256=b2tPpDPRLEu7ubhqS7pyHRjGh3ngeQhN1HUInJ6HMDA,100139
223
223
  modal_proto/modal_api_grpc.py,sha256=tHIPTopW9zSuAe_ECj4iOKob8Ce1YUihm00YJW5OYwE,31361
@@ -227,10 +227,10 @@ modal_proto/task_command_router_pb2.py,sha256=e_YIBjfDP2nDMZIvBYlHG49wosIGj3ruHh
227
227
  modal_proto/task_command_router_pb2.pyi,sha256=I8olEX3B6NqupcmIXB4Evq_Am1YScqHoIoB0xYnkAhA,50428
228
228
  modal_proto/task_command_router_pb2_grpc.py,sha256=XvHEJvi-Dd6gco-Wo8UtP1SiEEF8wOHvsWgZQ4VyXFc,44447
229
229
  modal_proto/task_command_router_pb2_grpc.pyi,sha256=3sNk2lY6EMk_GaYds-RwZ_tY6KbMCP-yimKAm2qDKVc,14837
230
- modal_version/__init__.py,sha256=79VB29W9wYlizhylLiwKty4Js4f0Qk5cKmymrPeQkEM,120
230
+ modal_version/__init__.py,sha256=ex8RYHAd7mw7X0AfdnO8IeO71ieP98r8v38rlsJBrr8,120
231
231
  modal_version/__main__.py,sha256=nLUbubxKx7GXNzJIkTB7M7_u8080LyLM0IS0rzFkC_c,119
232
- modal-1.6.2.dev2.dist-info/METADATA,sha256=B9hx-I84zcORTn2yjIlL0xmmz70ScH3Czb1jMA8Rx3w,2512
233
- modal-1.6.2.dev2.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
234
- modal-1.6.2.dev2.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
235
- modal-1.6.2.dev2.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
236
- modal-1.6.2.dev2.dist-info/RECORD,,
232
+ modal-1.6.2.dev3.dist-info/METADATA,sha256=l-0_uc2JoohUL45NgIR-b6FB1pIXMscLxSy08OQbwKc,2512
233
+ modal-1.6.2.dev3.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
234
+ modal-1.6.2.dev3.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
235
+ modal-1.6.2.dev3.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
236
+ modal-1.6.2.dev3.dist-info/RECORD,,