modal 1.2.1.dev4__py3-none-any.whl → 1.2.1.dev5__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.

Potentially problematic release.


This version of modal might be problematic. Click here for more details.

@@ -19,7 +19,7 @@ from ._functions import _Function
19
19
  from ._utils.async_utils import synchronizer
20
20
  from ._utils.deprecation import deprecation_warning
21
21
  from ._utils.function_utils import callable_has_non_self_params
22
- from .config import logger
22
+ from .config import config, logger
23
23
  from .exception import InvalidError
24
24
 
25
25
  MAX_MAX_BATCH_SIZE = 1000
@@ -378,6 +378,7 @@ def _fastapi_endpoint(
378
378
  method=method,
379
379
  web_endpoint_docs=docs,
380
380
  requested_suffix=label or "",
381
+ ephemeral_suffix=config.get("dev_suffix"),
381
382
  async_mode=api_pb2.WEBHOOK_ASYNC_MODE_AUTO,
382
383
  custom_domains=_parse_custom_domains(custom_domains),
383
384
  requires_proxy_auth=requires_proxy_auth,
@@ -446,6 +447,7 @@ def _web_endpoint(
446
447
  method=method,
447
448
  web_endpoint_docs=docs,
448
449
  requested_suffix=label or "",
450
+ ephemeral_suffix=config.get("dev_suffix"),
449
451
  async_mode=api_pb2.WEBHOOK_ASYNC_MODE_AUTO,
450
452
  custom_domains=_parse_custom_domains(custom_domains),
451
453
  requires_proxy_auth=requires_proxy_auth,
@@ -505,6 +507,7 @@ def _asgi_app(
505
507
  webhook_config = api_pb2.WebhookConfig(
506
508
  type=api_pb2.WEBHOOK_TYPE_ASGI_APP,
507
509
  requested_suffix=label or "",
510
+ ephemeral_suffix=config.get("dev_suffix"),
508
511
  async_mode=api_pb2.WEBHOOK_ASYNC_MODE_AUTO,
509
512
  custom_domains=_parse_custom_domains(custom_domains),
510
513
  requires_proxy_auth=requires_proxy_auth,
@@ -562,6 +565,7 @@ def _wsgi_app(
562
565
  webhook_config = api_pb2.WebhookConfig(
563
566
  type=api_pb2.WEBHOOK_TYPE_WSGI_APP,
564
567
  requested_suffix=label or "",
568
+ ephemeral_suffix=config.get("dev_suffix"),
565
569
  async_mode=api_pb2.WEBHOOK_ASYNC_MODE_AUTO,
566
570
  custom_domains=_parse_custom_domains(custom_domains),
567
571
  requires_proxy_auth=requires_proxy_auth,
@@ -623,6 +627,7 @@ def _web_server(
623
627
  webhook_config = api_pb2.WebhookConfig(
624
628
  type=api_pb2.WEBHOOK_TYPE_WEB_SERVER,
625
629
  requested_suffix=label or "",
630
+ ephemeral_suffix=config.get("dev_suffix"),
626
631
  async_mode=api_pb2.WEBHOOK_ASYNC_MODE_AUTO,
627
632
  custom_domains=_parse_custom_domains(custom_domains),
628
633
  web_server_port=port,
modal/cli/run.py CHANGED
@@ -496,6 +496,12 @@ def serve(
496
496
  ```
497
497
  modal serve hello_world.py
498
498
  ```
499
+
500
+ Modal-generated URLs will have a `-dev` suffix appended to them when running with `modal serve`.
501
+ To customize this suffix (i.e., to avoid collisions with other users in your workspace who are
502
+ concurrently serving the App), you can set the `dev_suffix` in your `.modal.toml` file or the
503
+ `MODAL_DEV_SUFFIX` environment variable.
504
+
499
505
  """
500
506
  env = ensure_env(env)
501
507
  import_ref = parse_import_ref(app_ref, use_module_mode=use_module_mode)
modal/client.pyi CHANGED
@@ -33,7 +33,7 @@ class _Client:
33
33
  server_url: str,
34
34
  client_type: int,
35
35
  credentials: typing.Optional[tuple[str, str]],
36
- version: str = "1.2.1.dev4",
36
+ version: str = "1.2.1.dev5",
37
37
  ):
38
38
  """mdmd:hidden
39
39
  The Modal client object is not intended to be instantiated directly by users.
@@ -164,7 +164,7 @@ class Client:
164
164
  server_url: str,
165
165
  client_type: int,
166
166
  credentials: typing.Optional[tuple[str, str]],
167
- version: str = "1.2.1.dev4",
167
+ version: str = "1.2.1.dev5",
168
168
  ):
169
169
  """mdmd:hidden
170
170
  The Modal client object is not intended to be instantiated directly by users.
modal/config.py CHANGED
@@ -71,6 +71,10 @@ Other possible configuration options are:
71
71
  The log formatting pattern that will be used by the modal client itself.
72
72
  See https://docs.python.org/3/library/logging.html#logrecord-attributes for available
73
73
  log attributes.
74
+ * `dev_suffix` (in the .toml file) / `MODAL_DEV_SUFFIX` (as an env var).
75
+ Overrides the default `-dev` suffix added to URLs generated for web endpoints
76
+ when the App is ephemeral (i.e., created via `modal serve`). Must be a short
77
+ alphanumeric string.
74
78
 
75
79
  Meta-configuration
76
80
  ------------------
@@ -85,6 +89,7 @@ Some "meta-options" are set using environment variables only:
85
89
 
86
90
  import logging
87
91
  import os
92
+ import re
88
93
  import typing
89
94
  import warnings
90
95
  from typing import Any, Callable, Optional
@@ -206,6 +211,12 @@ def _check_value(options: list[str]) -> Callable[[str], str]:
206
211
  return checker
207
212
 
208
213
 
214
+ def _enforce_suffix_rules(x: str) -> str:
215
+ if x and not re.match(r"^[a-zA-Z0-9]{1,8}$", x):
216
+ raise ValueError("Suffix must be an alphanumeric string of no more than 8 characters.")
217
+ return x
218
+
219
+
209
220
  class _Setting(typing.NamedTuple):
210
221
  default: typing.Any = None
211
222
  transform: typing.Callable[[str], typing.Any] = lambda x: x # noqa: E731
@@ -244,6 +255,7 @@ _SETTINGS = {
244
255
  "pickle",
245
256
  transform=lambda s: _check_value(["pickle", "cbor"])(s.lower()),
246
257
  ),
258
+ "dev_suffix": _Setting("", transform=_enforce_suffix_rules),
247
259
  }
248
260
 
249
261
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.2.1.dev4
3
+ Version: 1.2.1.dev5
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License: Apache-2.0
@@ -9,7 +9,7 @@ modal/_ipython.py,sha256=TW1fkVOmZL3YYqdS2YlM1hqpf654Yf8ZyybHdBnlhSw,301
9
9
  modal/_location.py,sha256=joiX-0ZeutEUDTrrqLF1GHXCdVLF-rHzstocbMcd_-k,366
10
10
  modal/_object.py,sha256=gwsLdXb-Ecd8nH8LVCo8oVZPzzdyo9BrN1DjgQmsSuM,11967
11
11
  modal/_output.py,sha256=sdQqEuWVknHwLPzuz_7eUYqF9TvmQkSfEjm1E__bzbY,26892
12
- modal/_partial_function.py,sha256=Yqk97hLS6vi8nWWVpzS5TSWbndWMdCtkhccdnyDJgBk,37302
12
+ modal/_partial_function.py,sha256=mjCt3OdBvcbvLiz90kG1TSFC174XvFkrPXIRAMx-L5Y,37565
13
13
  modal/_pty.py,sha256=E58MQ8d5-wkbMatRKpQR-G9FdbCRcZGiZxOpGy__VuY,1481
14
14
  modal/_resolver.py,sha256=2RWvm34cNSnbv1v7izJMNZgfvpLDD6LzaBlr0lIrLnY,7364
15
15
  modal/_resources.py,sha256=NMAp0GCLutiZI4GuKSIVnRHVlstoD3hNGUabjTUtzf4,1794
@@ -24,12 +24,12 @@ modal/app.pyi,sha256=6wlYK9nNp0GuHXyUxGmcZ6J92EjsWS-KK6KRuejqXEY,49718
24
24
  modal/billing.py,sha256=zmQ3bcCJlwa4KD1IA_QgdWpm1pn13c-7qfy79iEauYI,195
25
25
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
26
26
  modal/client.py,sha256=kyAIVB3Ay-XKJizQ_1ufUFB__EagV0MLmHJpyYyJ7J0,18636
27
- modal/client.pyi,sha256=-3nsLkt-J4sZ_qRFJW1Q8BQNWN2Ony0R4iCEN0gH2Ms,15829
27
+ modal/client.pyi,sha256=jEOYIBu7k8RylJM1h0azhNPPiLD88XZ2PXZpznSqcDw,15829
28
28
  modal/cloud_bucket_mount.py,sha256=I2GRXYhOWLIz2kJZjXu75jAm9EJkBNcutGc6jR2ReUw,5928
29
29
  modal/cloud_bucket_mount.pyi,sha256=VuUOipMIHqFXMkD-3g2bsoqpSxV5qswlFHDOqPQzYAo,7405
30
30
  modal/cls.py,sha256=_Dzu8Tjjp_XukJxfBioAeHf03egKQYuKj7SrHJiK6CE,40676
31
31
  modal/cls.pyi,sha256=jJsDPFoqzM4ht-V-e-xEJKJ5TINLF0fYtoBm_UeAW5Y,27281
32
- modal/config.py,sha256=OLxJU1K7ijiV_65g700QcHX8hIPH-dgzuybyQAOf6cg,12333
32
+ modal/config.py,sha256=ZvQtKR4vACdvV-sDI-CtGepUGNMpQucwhgkGZ3k6gc0,12869
33
33
  modal/container_process.py,sha256=Mutkl7sg_WR5zP4oJiWSC-3UdYRqp0zdKi1shZbi-bk,6996
34
34
  modal/container_process.pyi,sha256=9m-st3hCUlNN1GOTctfPPvIvoLtEl7FbuGWwif5-7YU,6037
35
35
  modal/dict.py,sha256=XkaxuojMVtcc4bZvCjJcd6DedU5xxfF8H4w-mDzFPCo,21580
@@ -141,7 +141,7 @@ modal/cli/launch.py,sha256=VARim2SCzgtI1ZuxQ6JgTTtvFwGA5czCwQZQHWC8Zcc,6498
141
141
  modal/cli/network_file_system.py,sha256=I9IqTpVfk32uKYwGd8LTldkQx6UKYrQYNZ26q7Ab5Oo,8126
142
142
  modal/cli/profile.py,sha256=g8X6tFFK9ccKyu2he9Yu19WLSLNdztzECgmIV__XJFs,3257
143
143
  modal/cli/queues.py,sha256=5vKtKQ7YExdaxNPYZ0g5suU9sX0-F5h0zy0qBV-hN80,6140
144
- modal/cli/run.py,sha256=PHqAt2H_NTAK5FjwNovNqfCaYmTYvxFDqty7Ar8EEA0,25438
144
+ modal/cli/run.py,sha256=3_UF2Vdye_KEgY8JzBBomt0i944cCJx96RfNbeAEPDo,25783
145
145
  modal/cli/secret.py,sha256=-Nnk3fq1IEzMtC9VUn61AKmdvZzZ9XQyiKVgQYRpajo,8127
146
146
  modal/cli/token.py,sha256=NAmQzKBfEHkcldWKeFxAVIqQBoo1RTp7_A4yc7-8qM0,1911
147
147
  modal/cli/utils.py,sha256=aUXDU9_VgcJrGaGRy4bGf4dqwKYXHCpoO27x4m_bpuo,3293
@@ -155,7 +155,7 @@ modal/experimental/__init__.py,sha256=9gkVuDmu3m4TlKoU3MzEtTOemUSs8EEOWba40s7Aa0
155
155
  modal/experimental/flash.py,sha256=C4sef08rARYFllsgtqukFmYL18SZW0_JpMS0BejDcUs,28552
156
156
  modal/experimental/flash.pyi,sha256=vV_OQhtdrPn8SW0XrBK-aLLHHIvxAzLzwFbWrke-m74,15463
157
157
  modal/experimental/ipython.py,sha256=TrCfmol9LGsRZMeDoeMPx3Hv3BFqQhYnmD_iH0pqdhk,2904
158
- modal-1.2.1.dev4.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
158
+ modal-1.2.1.dev5.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
159
159
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
160
160
  modal_docs/gen_cli_docs.py,sha256=c1yfBS_x--gL5bs0N4ihMwqwX8l3IBWSkBAKNNIi6bQ,3801
161
161
  modal_docs/gen_reference_docs.py,sha256=d_CQUGQ0rfw28u75I2mov9AlS773z9rG40-yq5o7g2U,6359
@@ -163,7 +163,7 @@ modal_docs/mdmd/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,2
163
163
  modal_docs/mdmd/mdmd.py,sha256=tUTImNd4UMFk1opkaw8J672gX8AkBO5gbY2S_NMxsxs,7140
164
164
  modal_docs/mdmd/signatures.py,sha256=XJaZrK7Mdepk5fdX51A8uENiLFNil85Ud0d4MH8H5f0,3218
165
165
  modal_proto/__init__.py,sha256=MIEP8jhXUeGq_eCjYFcqN5b1bxBM4fdk0VESpjWR0fc,28
166
- modal_proto/api.proto,sha256=rG3M5gm-a6pjqXktAfpkSOEAa9BwhqyIzaTKZFoWhMc,109532
166
+ modal_proto/api.proto,sha256=cq6aCHQ0P2oP4zMBytzc95n_l3W4ahysMd3OSgPuHhk,109531
167
167
  modal_proto/api_grpc.py,sha256=Kgv6E88imUNNWyOA0foC1NEzgPWTXW4mJ3IKg_f0Dek,136233
168
168
  modal_proto/api_pb2.py,sha256=5pHQKBLPP8yFHffqeYBwRrF1y9bB4G5M07HDQtpVPps,382801
169
169
  modal_proto/api_pb2.pyi,sha256=n09823GzmM3S8SWjWCmXMPgoqfXPRNOSTpIujVwNznc,533697
@@ -183,10 +183,10 @@ modal_proto/task_command_router_pb2.py,sha256=_pD2ZpU0bNzhwBdzmLoLyLtAtftI_Agxwn
183
183
  modal_proto/task_command_router_pb2.pyi,sha256=EyDgXPLr7alqjXYERV8w_MPuO404x0uCppmSkrfE9IE,14589
184
184
  modal_proto/task_command_router_pb2_grpc.py,sha256=uEQ0HdrCp8v-9bB5yIic9muA8spCShLHY6Bz9cCgOUE,10114
185
185
  modal_proto/task_command_router_pb2_grpc.pyi,sha256=s3Yxsrawdj4nr8vqQqsAxyX6ilWaGbdECy425KKbLIA,3301
186
- modal_version/__init__.py,sha256=FdZAMMLzv11Sj-WqJhCyRg2LEgcG4nMiHc45XvnqiOw,120
186
+ modal_version/__init__.py,sha256=7UlnXu54imxCFuqMRYfAvi2QWP_63FRHLnTsGSJJpPA,120
187
187
  modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
188
- modal-1.2.1.dev4.dist-info/METADATA,sha256=b-q4WuOIq58JT-nZP2iF9QXZ2lAv5azlNF_3W1R4Zf8,2483
189
- modal-1.2.1.dev4.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
190
- modal-1.2.1.dev4.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
191
- modal-1.2.1.dev4.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
192
- modal-1.2.1.dev4.dist-info/RECORD,,
188
+ modal-1.2.1.dev5.dist-info/METADATA,sha256=vQiClNCSghoVAGp5PJLQ9QpUrXrDgwrcNXJC9rkq5L4,2483
189
+ modal-1.2.1.dev5.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
190
+ modal-1.2.1.dev5.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
191
+ modal-1.2.1.dev5.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
192
+ modal-1.2.1.dev5.dist-info/RECORD,,
modal_proto/api.proto CHANGED
@@ -3575,7 +3575,6 @@ message WebhookConfig {
3575
3575
  string ephemeral_suffix = 11; // Additional URL suffix added for ephemeral Apps
3576
3576
  }
3577
3577
 
3578
-
3579
3578
  message WorkspaceBillingReportItem {
3580
3579
  string object_id = 1;
3581
3580
  string description = 2;
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.1.dev4"
4
+ __version__ = "1.2.1.dev5"