modal 0.67.7__py3-none-any.whl → 0.67.8__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 (102) hide show
  1. modal/_clustered_functions.py +2 -2
  2. modal/_clustered_functions.pyi +2 -2
  3. modal/_container_entrypoint.py +5 -4
  4. modal/_output.py +29 -28
  5. modal/_pty.py +2 -2
  6. modal/_resolver.py +6 -5
  7. modal/_resources.py +3 -3
  8. modal/_runtime/asgi.py +7 -6
  9. modal/_runtime/container_io_manager.py +22 -26
  10. modal/_runtime/execution_context.py +2 -2
  11. modal/_runtime/telemetry.py +1 -2
  12. modal/_runtime/user_code_imports.py +11 -13
  13. modal/_serialization.py +3 -7
  14. modal/_traceback.py +5 -5
  15. modal/_tunnel.py +4 -3
  16. modal/_tunnel.pyi +2 -2
  17. modal/_utils/async_utils.py +8 -15
  18. modal/_utils/blob_utils.py +4 -3
  19. modal/_utils/function_utils.py +11 -10
  20. modal/_utils/grpc_testing.py +7 -6
  21. modal/_utils/grpc_utils.py +2 -3
  22. modal/_utils/hash_utils.py +2 -2
  23. modal/_utils/mount_utils.py +5 -4
  24. modal/_utils/package_utils.py +2 -3
  25. modal/_utils/pattern_matcher.py +6 -6
  26. modal/_utils/rand_pb_testing.py +3 -3
  27. modal/_utils/shell_utils.py +2 -1
  28. modal/_vendor/a2wsgi_wsgi.py +62 -72
  29. modal/_vendor/cloudpickle.py +1 -1
  30. modal/_watcher.py +8 -7
  31. modal/app.py +29 -34
  32. modal/app.pyi +102 -97
  33. modal/call_graph.py +6 -6
  34. modal/cli/_download.py +3 -2
  35. modal/cli/_traceback.py +4 -4
  36. modal/cli/app.py +4 -4
  37. modal/cli/container.py +4 -4
  38. modal/cli/dict.py +1 -1
  39. modal/cli/environment.py +2 -3
  40. modal/cli/launch.py +2 -2
  41. modal/cli/network_file_system.py +1 -1
  42. modal/cli/profile.py +1 -1
  43. modal/cli/programs/run_jupyter.py +2 -2
  44. modal/cli/programs/vscode.py +3 -3
  45. modal/cli/queues.py +1 -1
  46. modal/cli/run.py +6 -6
  47. modal/cli/secret.py +3 -3
  48. modal/cli/utils.py +2 -1
  49. modal/cli/volume.py +3 -3
  50. modal/client.py +6 -11
  51. modal/client.pyi +18 -27
  52. modal/cloud_bucket_mount.py +3 -3
  53. modal/cloud_bucket_mount.pyi +2 -2
  54. modal/cls.py +16 -15
  55. modal/cls.pyi +23 -22
  56. modal/config.py +2 -2
  57. modal/dict.py +4 -3
  58. modal/dict.pyi +10 -9
  59. modal/environments.py +3 -3
  60. modal/environments.pyi +3 -3
  61. modal/exception.py +2 -3
  62. modal/functions.py +20 -27
  63. modal/functions.pyi +44 -47
  64. modal/image.py +45 -48
  65. modal/image.pyi +102 -101
  66. modal/io_streams.py +4 -7
  67. modal/io_streams.pyi +14 -13
  68. modal/mount.py +23 -22
  69. modal/mount.pyi +28 -29
  70. modal/network_file_system.py +7 -6
  71. modal/network_file_system.pyi +12 -11
  72. modal/object.py +9 -8
  73. modal/object.pyi +47 -34
  74. modal/output.py +2 -1
  75. modal/parallel_map.py +4 -4
  76. modal/partial_function.py +9 -13
  77. modal/partial_function.pyi +17 -18
  78. modal/queue.py +9 -8
  79. modal/queue.pyi +23 -22
  80. modal/runner.py +8 -7
  81. modal/runner.pyi +8 -14
  82. modal/running_app.py +3 -3
  83. modal/sandbox.py +14 -13
  84. modal/sandbox.pyi +67 -72
  85. modal/scheduler_placement.py +2 -1
  86. modal/secret.py +7 -7
  87. modal/secret.pyi +12 -12
  88. modal/serving.py +4 -3
  89. modal/serving.pyi +5 -4
  90. modal/token_flow.py +3 -2
  91. modal/token_flow.pyi +3 -3
  92. modal/volume.py +7 -12
  93. modal/volume.pyi +17 -16
  94. {modal-0.67.7.dist-info → modal-0.67.8.dist-info}/METADATA +1 -1
  95. modal-0.67.8.dist-info/RECORD +168 -0
  96. modal_docs/mdmd/signatures.py +1 -2
  97. modal_version/_version_generated.py +1 -1
  98. modal-0.67.7.dist-info/RECORD +0 -168
  99. {modal-0.67.7.dist-info → modal-0.67.8.dist-info}/LICENSE +0 -0
  100. {modal-0.67.7.dist-info → modal-0.67.8.dist-info}/WHEEL +0 -0
  101. {modal-0.67.7.dist-info → modal-0.67.8.dist-info}/entry_points.txt +0 -0
  102. {modal-0.67.7.dist-info → modal-0.67.8.dist-info}/top_level.txt +0 -0
modal/dict.py CHANGED
@@ -1,5 +1,6 @@
1
1
  # Copyright Modal Labs 2022
2
- from typing import Any, AsyncIterator, Optional, Tuple, Type
2
+ from collections.abc import AsyncIterator
3
+ from typing import Any, Optional
3
4
 
4
5
  from grpclib import GRPCError
5
6
  from synchronicity.async_wrap import asynccontextmanager
@@ -74,7 +75,7 @@ class _Dict(_Object, type_prefix="di"):
74
75
  @classmethod
75
76
  @asynccontextmanager
76
77
  async def ephemeral(
77
- cls: Type["_Dict"],
78
+ cls: type["_Dict"],
78
79
  data: Optional[dict] = None,
79
80
  client: Optional[_Client] = None,
80
81
  environment_name: Optional[str] = None,
@@ -316,7 +317,7 @@ class _Dict(_Object, type_prefix="di"):
316
317
  yield deserialize(resp.value, self._client)
317
318
 
318
319
  @live_method_gen
319
- async def items(self) -> AsyncIterator[Tuple[Any, Any]]:
320
+ async def items(self) -> AsyncIterator[tuple[Any, Any]]:
320
321
  """Return an iterator over the (key, value) tuples in this dictionary.
321
322
 
322
323
  Note that (unlike with Python dicts) the return value is a simple iterator,
modal/dict.pyi CHANGED
@@ -1,3 +1,4 @@
1
+ import collections.abc
1
2
  import modal.client
2
3
  import modal.object
3
4
  import synchronicity.combined_types
@@ -12,7 +13,7 @@ class _Dict(modal.object._Object):
12
13
  def __init__(self, data={}): ...
13
14
  @classmethod
14
15
  def ephemeral(
15
- cls: typing.Type[_Dict],
16
+ cls: type[_Dict],
16
17
  data: typing.Optional[dict] = None,
17
18
  client: typing.Optional[modal.client._Client] = None,
18
19
  environment_name: typing.Optional[str] = None,
@@ -53,9 +54,9 @@ class _Dict(modal.object._Object):
53
54
  async def pop(self, key: typing.Any) -> typing.Any: ...
54
55
  async def __delitem__(self, key: typing.Any) -> typing.Any: ...
55
56
  async def __contains__(self, key: typing.Any) -> bool: ...
56
- def keys(self) -> typing.AsyncIterator[typing.Any]: ...
57
- def values(self) -> typing.AsyncIterator[typing.Any]: ...
58
- def items(self) -> typing.AsyncIterator[typing.Tuple[typing.Any, typing.Any]]: ...
57
+ def keys(self) -> collections.abc.AsyncIterator[typing.Any]: ...
58
+ def values(self) -> collections.abc.AsyncIterator[typing.Any]: ...
59
+ def items(self) -> collections.abc.AsyncIterator[tuple[typing.Any, typing.Any]]: ...
59
60
 
60
61
  class Dict(modal.object.Object):
61
62
  def __init__(self, data={}): ...
@@ -63,7 +64,7 @@ class Dict(modal.object.Object):
63
64
  def new(data: typing.Optional[dict] = None): ...
64
65
  @classmethod
65
66
  def ephemeral(
66
- cls: typing.Type[Dict],
67
+ cls: type[Dict],
67
68
  data: typing.Optional[dict] = None,
68
69
  client: typing.Optional[modal.client.Client] = None,
69
70
  environment_name: typing.Optional[str] = None,
@@ -186,18 +187,18 @@ class Dict(modal.object.Object):
186
187
 
187
188
  class __keys_spec(typing_extensions.Protocol):
188
189
  def __call__(self) -> typing.Iterator[typing.Any]: ...
189
- def aio(self) -> typing.AsyncIterator[typing.Any]: ...
190
+ def aio(self) -> collections.abc.AsyncIterator[typing.Any]: ...
190
191
 
191
192
  keys: __keys_spec
192
193
 
193
194
  class __values_spec(typing_extensions.Protocol):
194
195
  def __call__(self) -> typing.Iterator[typing.Any]: ...
195
- def aio(self) -> typing.AsyncIterator[typing.Any]: ...
196
+ def aio(self) -> collections.abc.AsyncIterator[typing.Any]: ...
196
197
 
197
198
  values: __values_spec
198
199
 
199
200
  class __items_spec(typing_extensions.Protocol):
200
- def __call__(self) -> typing.Iterator[typing.Tuple[typing.Any, typing.Any]]: ...
201
- def aio(self) -> typing.AsyncIterator[typing.Tuple[typing.Any, typing.Any]]: ...
201
+ def __call__(self) -> typing.Iterator[tuple[typing.Any, typing.Any]]: ...
202
+ def aio(self) -> collections.abc.AsyncIterator[tuple[typing.Any, typing.Any]]: ...
202
203
 
203
204
  items: __items_spec
modal/environments.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # Copyright Modal Labs 2023
2
2
  from dataclasses import dataclass
3
- from typing import Dict, List, Optional
3
+ from typing import Optional
4
4
 
5
5
  from google.protobuf.empty_pb2 import Empty
6
6
  from google.protobuf.message import Message
@@ -98,7 +98,7 @@ Environment = synchronize_api(_Environment)
98
98
 
99
99
 
100
100
  # Needs to be after definition; synchronicity interferes with forward references?
101
- ENVIRONMENT_CACHE: Dict[str, _Environment] = {}
101
+ ENVIRONMENT_CACHE: dict[str, _Environment] = {}
102
102
 
103
103
 
104
104
  async def _get_environment_cached(name: str, client: _Client) -> _Environment:
@@ -151,7 +151,7 @@ async def create_environment(name: str, client: Optional[_Client] = None):
151
151
 
152
152
 
153
153
  @synchronizer.create_blocking
154
- async def list_environments(client: Optional[_Client] = None) -> List[api_pb2.EnvironmentListItem]:
154
+ async def list_environments(client: Optional[_Client] = None) -> list[api_pb2.EnvironmentListItem]:
155
155
  if client is None:
156
156
  client = await _Client.from_env()
157
157
  resp = await client.stub.EnvironmentList(Empty())
modal/environments.pyi CHANGED
@@ -87,13 +87,13 @@ create_environment: __create_environment_spec
87
87
  class __list_environments_spec(typing_extensions.Protocol):
88
88
  def __call__(
89
89
  self, client: typing.Optional[modal.client.Client] = None
90
- ) -> typing.List[modal_proto.api_pb2.EnvironmentListItem]: ...
90
+ ) -> list[modal_proto.api_pb2.EnvironmentListItem]: ...
91
91
  async def aio(
92
92
  self, client: typing.Optional[modal.client.Client] = None
93
- ) -> typing.List[modal_proto.api_pb2.EnvironmentListItem]: ...
93
+ ) -> list[modal_proto.api_pb2.EnvironmentListItem]: ...
94
94
 
95
95
  list_environments: __list_environments_spec
96
96
 
97
97
  def ensure_env(environment_name: typing.Optional[str] = None) -> str: ...
98
98
 
99
- ENVIRONMENT_CACHE: typing.Dict[str, _Environment]
99
+ ENVIRONMENT_CACHE: dict[str, _Environment]
modal/exception.py CHANGED
@@ -4,7 +4,6 @@ import signal
4
4
  import sys
5
5
  import warnings
6
6
  from datetime import date
7
- from typing import Tuple
8
7
 
9
8
 
10
9
  class Error(Exception):
@@ -132,12 +131,12 @@ def _is_internal_frame(frame):
132
131
  return module in _INTERNAL_MODULES
133
132
 
134
133
 
135
- def deprecation_error(deprecated_on: Tuple[int, int, int], msg: str):
134
+ def deprecation_error(deprecated_on: tuple[int, int, int], msg: str):
136
135
  raise DeprecationError(f"Deprecated on {date(*deprecated_on)}: {msg}")
137
136
 
138
137
 
139
138
  def deprecation_warning(
140
- deprecated_on: Tuple[int, int, int], msg: str, *, pending: bool = False, show_source: bool = True
139
+ deprecated_on: tuple[int, int, int], msg: str, *, pending: bool = False, show_source: bool = True
141
140
  ) -> None:
142
141
  """Utility for getting the proper stack entry.
143
142
 
modal/functions.py CHANGED
@@ -4,21 +4,14 @@ import textwrap
4
4
  import time
5
5
  import typing
6
6
  import warnings
7
+ from collections.abc import AsyncGenerator, Collection, Sequence, Sized
7
8
  from dataclasses import dataclass
8
9
  from pathlib import PurePosixPath
9
10
  from typing import (
10
11
  TYPE_CHECKING,
11
12
  Any,
12
- AsyncGenerator,
13
13
  Callable,
14
- Collection,
15
- Dict,
16
- List,
17
14
  Optional,
18
- Sequence,
19
- Sized,
20
- Tuple,
21
- Type,
22
15
  Union,
23
16
  )
24
17
 
@@ -278,12 +271,12 @@ class _FunctionSpec:
278
271
  image: Optional[_Image]
279
272
  mounts: Sequence[_Mount]
280
273
  secrets: Sequence[_Secret]
281
- network_file_systems: Dict[Union[str, PurePosixPath], _NetworkFileSystem]
282
- volumes: Dict[Union[str, PurePosixPath], Union[_Volume, _CloudBucketMount]]
283
- gpus: Union[GPU_T, List[GPU_T]] # TODO(irfansharif): Somehow assert that it's the first kind, in sandboxes
274
+ network_file_systems: dict[Union[str, PurePosixPath], _NetworkFileSystem]
275
+ volumes: dict[Union[str, PurePosixPath], Union[_Volume, _CloudBucketMount]]
276
+ gpus: Union[GPU_T, list[GPU_T]] # TODO(irfansharif): Somehow assert that it's the first kind, in sandboxes
284
277
  cloud: Optional[str]
285
278
  cpu: Optional[float]
286
- memory: Optional[Union[int, Tuple[int, int]]]
279
+ memory: Optional[Union[int, tuple[int, int]]]
287
280
  ephemeral_disk: Optional[int]
288
281
  scheduler_placement: Optional[SchedulerPlacement]
289
282
 
@@ -304,7 +297,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
304
297
 
305
298
  # TODO: more type annotations
306
299
  _info: Optional[FunctionInfo]
307
- _serve_mounts: typing.FrozenSet[_Mount] # set at load time, only by loader
300
+ _serve_mounts: frozenset[_Mount] # set at load time, only by loader
308
301
  _app: Optional["modal.app._App"] = None
309
302
  _obj: Optional["modal.cls._Obj"] = None # only set for InstanceServiceFunctions and bound instance methods
310
303
  _web_url: Optional[str]
@@ -323,7 +316,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
323
316
  _use_method_name: str = ""
324
317
 
325
318
  _class_parameter_info: Optional["api_pb2.ClassParameterInfo"] = None
326
- _method_handle_metadata: Optional[Dict[str, "api_pb2.FunctionHandleMetadata"]] = None
319
+ _method_handle_metadata: Optional[dict[str, "api_pb2.FunctionHandleMetadata"]] = None
327
320
 
328
321
  def _bind_method(
329
322
  self,
@@ -429,14 +422,14 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
429
422
  secrets: Sequence[_Secret] = (),
430
423
  schedule: Optional[Schedule] = None,
431
424
  is_generator=False,
432
- gpu: Union[GPU_T, List[GPU_T]] = None,
425
+ gpu: Union[GPU_T, list[GPU_T]] = None,
433
426
  # TODO: maybe break this out into a separate decorator for notebooks.
434
427
  mounts: Collection[_Mount] = (),
435
- network_file_systems: Dict[Union[str, PurePosixPath], _NetworkFileSystem] = {},
428
+ network_file_systems: dict[Union[str, PurePosixPath], _NetworkFileSystem] = {},
436
429
  allow_cross_region_volumes: bool = False,
437
- volumes: Dict[Union[str, PurePosixPath], Union[_Volume, _CloudBucketMount]] = {},
430
+ volumes: dict[Union[str, PurePosixPath], Union[_Volume, _CloudBucketMount]] = {},
438
431
  webhook_config: Optional[api_pb2.WebhookConfig] = None,
439
- memory: Optional[Union[int, Tuple[int, int]]] = None,
432
+ memory: Optional[Union[int, tuple[int, int]]] = None,
440
433
  proxy: Optional[_Proxy] = None,
441
434
  retries: Optional[Union[int, Retries]] = None,
442
435
  timeout: Optional[int] = None,
@@ -623,8 +616,8 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
623
616
  if image is not None and not isinstance(image, _Image):
624
617
  raise InvalidError(f"Expected modal.Image object. Got {type(image)}.")
625
618
 
626
- method_definitions: Optional[Dict[str, api_pb2.MethodDefinition]] = None
627
- partial_functions: Dict[str, "modal.partial_function._PartialFunction"] = {}
619
+ method_definitions: Optional[dict[str, api_pb2.MethodDefinition]] = None
620
+ partial_functions: dict[str, "modal.partial_function._PartialFunction"] = {}
628
621
  if info.user_cls:
629
622
  method_definitions = {}
630
623
  partial_functions = _find_partial_methods_for_user_cls(info.user_cls, _PartialFunctionFlags.FUNCTION)
@@ -640,8 +633,8 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
640
633
 
641
634
  function_type = get_function_type(is_generator)
642
635
 
643
- def _deps(only_explicit_mounts=False) -> List[_Object]:
644
- deps: List[_Object] = list(secrets)
636
+ def _deps(only_explicit_mounts=False) -> list[_Object]:
637
+ deps: list[_Object] = list(secrets)
645
638
  if only_explicit_mounts:
646
639
  # TODO: this is a bit hacky, but all_mounts may differ in the container vs locally
647
640
  # We don't want the function dependencies to change, so we have this way to force it to
@@ -878,7 +871,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
878
871
  raise InvalidError(f"Function {info.function_name} is too large to deploy.")
879
872
  raise
880
873
  function_creation_status.set_response(response)
881
- serve_mounts = set(m for m in all_mounts if m.is_local()) # needed for modal.serve file watching
874
+ serve_mounts = {m for m in all_mounts if m.is_local()} # needed for modal.serve file watching
882
875
  serve_mounts |= image._serve_mounts
883
876
  obj._serve_mounts = frozenset(serve_mounts)
884
877
  self._hydrate(response.function_id, resolver.client, response.handle_metadata)
@@ -897,7 +890,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
897
890
  obj._spec = function_spec # needed for modal shell
898
891
 
899
892
  # Used to check whether we should rebuild a modal.Image which uses `run_function`.
900
- gpus: List[GPU_T] = gpu if isinstance(gpu, list) else [gpu]
893
+ gpus: list[GPU_T] = gpu if isinstance(gpu, list) else [gpu]
901
894
  obj._build_args = dict( # See get_build_def
902
895
  secrets=repr(secrets),
903
896
  gpu_config=repr([parse_gpu_config(_gpu) for _gpu in gpus]),
@@ -919,7 +912,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
919
912
  from_other_workspace: bool,
920
913
  options: Optional[api_pb2.FunctionOptions],
921
914
  args: Sized,
922
- kwargs: Dict[str, Any],
915
+ kwargs: dict[str, Any],
923
916
  ) -> "_Function":
924
917
  """mdmd:hidden
925
918
 
@@ -1025,7 +1018,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
1025
1018
 
1026
1019
  @classmethod
1027
1020
  def from_name(
1028
- cls: Type["_Function"],
1021
+ cls: type["_Function"],
1029
1022
  app_name: str,
1030
1023
  tag: str,
1031
1024
  namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
@@ -1476,7 +1469,7 @@ class _FunctionCall(typing.Generic[ReturnType], _Object, type_prefix="fc"):
1476
1469
  async for res in self._invocation().run_generator():
1477
1470
  yield res
1478
1471
 
1479
- async def get_call_graph(self) -> List[InputInfo]:
1472
+ async def get_call_graph(self) -> list[InputInfo]:
1480
1473
  """Returns a structure representing the call graph from a given root
1481
1474
  call ID, along with the status of execution for each node.
1482
1475
 
modal/functions.pyi CHANGED
@@ -1,3 +1,4 @@
1
+ import collections.abc
1
2
  import google.protobuf.message
2
3
  import modal._utils.async_utils
3
4
  import modal._utils.function_utils
@@ -60,42 +61,38 @@ def _parse_retries(
60
61
 
61
62
  class _FunctionSpec:
62
63
  image: typing.Optional[modal.image._Image]
63
- mounts: typing.Sequence[modal.mount._Mount]
64
- secrets: typing.Sequence[modal.secret._Secret]
65
- network_file_systems: typing.Dict[
66
- typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem
67
- ]
68
- volumes: typing.Dict[
64
+ mounts: collections.abc.Sequence[modal.mount._Mount]
65
+ secrets: collections.abc.Sequence[modal.secret._Secret]
66
+ network_file_systems: dict[typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem]
67
+ volumes: dict[
69
68
  typing.Union[str, pathlib.PurePosixPath],
70
69
  typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount],
71
70
  ]
72
- gpus: typing.Union[
73
- None, bool, str, modal.gpu._GPUConfig, typing.List[typing.Union[None, bool, str, modal.gpu._GPUConfig]]
74
- ]
71
+ gpus: typing.Union[None, bool, str, modal.gpu._GPUConfig, list[typing.Union[None, bool, str, modal.gpu._GPUConfig]]]
75
72
  cloud: typing.Optional[str]
76
73
  cpu: typing.Optional[float]
77
- memory: typing.Union[int, typing.Tuple[int, int], None]
74
+ memory: typing.Union[int, tuple[int, int], None]
78
75
  ephemeral_disk: typing.Optional[int]
79
76
  scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement]
80
77
 
81
78
  def __init__(
82
79
  self,
83
80
  image: typing.Optional[modal.image._Image],
84
- mounts: typing.Sequence[modal.mount._Mount],
85
- secrets: typing.Sequence[modal.secret._Secret],
86
- network_file_systems: typing.Dict[
81
+ mounts: collections.abc.Sequence[modal.mount._Mount],
82
+ secrets: collections.abc.Sequence[modal.secret._Secret],
83
+ network_file_systems: dict[
87
84
  typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem
88
85
  ],
89
- volumes: typing.Dict[
86
+ volumes: dict[
90
87
  typing.Union[str, pathlib.PurePosixPath],
91
88
  typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount],
92
89
  ],
93
90
  gpus: typing.Union[
94
- None, bool, str, modal.gpu._GPUConfig, typing.List[typing.Union[None, bool, str, modal.gpu._GPUConfig]]
91
+ None, bool, str, modal.gpu._GPUConfig, list[typing.Union[None, bool, str, modal.gpu._GPUConfig]]
95
92
  ],
96
93
  cloud: typing.Optional[str],
97
94
  cpu: typing.Optional[float],
98
- memory: typing.Union[int, typing.Tuple[int, int], None],
95
+ memory: typing.Union[int, tuple[int, int], None],
99
96
  ephemeral_disk: typing.Optional[int],
100
97
  scheduler_placement: typing.Optional[modal.scheduler_placement.SchedulerPlacement],
101
98
  ) -> None: ...
@@ -110,7 +107,7 @@ OriginalReturnType = typing.TypeVar("OriginalReturnType", covariant=True)
110
107
 
111
108
  class _Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object._Object):
112
109
  _info: typing.Optional[modal._utils.function_utils.FunctionInfo]
113
- _serve_mounts: typing.FrozenSet[modal.mount._Mount]
110
+ _serve_mounts: frozenset[modal.mount._Mount]
114
111
  _app: typing.Optional[modal.app._App]
115
112
  _obj: typing.Optional[modal.cls._Obj]
116
113
  _web_url: typing.Optional[str]
@@ -124,7 +121,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.
124
121
  _cluster_size: typing.Optional[int]
125
122
  _use_method_name: str
126
123
  _class_parameter_info: typing.Optional[modal_proto.api_pb2.ClassParameterInfo]
127
- _method_handle_metadata: typing.Optional[typing.Dict[str, modal_proto.api_pb2.FunctionHandleMetadata]]
124
+ _method_handle_metadata: typing.Optional[dict[str, modal_proto.api_pb2.FunctionHandleMetadata]]
128
125
 
129
126
  def _bind_method(self, user_cls, method_name: str, partial_function: modal.partial_function._PartialFunction): ...
130
127
  def _bind_instance_method(self, class_bound_method: _Function): ...
@@ -133,23 +130,23 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.
133
130
  info: modal._utils.function_utils.FunctionInfo,
134
131
  app,
135
132
  image: modal.image._Image,
136
- secrets: typing.Sequence[modal.secret._Secret] = (),
133
+ secrets: collections.abc.Sequence[modal.secret._Secret] = (),
137
134
  schedule: typing.Optional[modal.schedule.Schedule] = None,
138
135
  is_generator=False,
139
136
  gpu: typing.Union[
140
- None, bool, str, modal.gpu._GPUConfig, typing.List[typing.Union[None, bool, str, modal.gpu._GPUConfig]]
137
+ None, bool, str, modal.gpu._GPUConfig, list[typing.Union[None, bool, str, modal.gpu._GPUConfig]]
141
138
  ] = None,
142
- mounts: typing.Collection[modal.mount._Mount] = (),
143
- network_file_systems: typing.Dict[
139
+ mounts: collections.abc.Collection[modal.mount._Mount] = (),
140
+ network_file_systems: dict[
144
141
  typing.Union[str, pathlib.PurePosixPath], modal.network_file_system._NetworkFileSystem
145
142
  ] = {},
146
143
  allow_cross_region_volumes: bool = False,
147
- volumes: typing.Dict[
144
+ volumes: dict[
148
145
  typing.Union[str, pathlib.PurePosixPath],
149
146
  typing.Union[modal.volume._Volume, modal.cloud_bucket_mount._CloudBucketMount],
150
147
  ] = {},
151
148
  webhook_config: typing.Optional[modal_proto.api_pb2.WebhookConfig] = None,
152
- memory: typing.Union[int, typing.Tuple[int, int], None] = None,
149
+ memory: typing.Union[int, tuple[int, int], None] = None,
153
150
  proxy: typing.Optional[modal.proxy._Proxy] = None,
154
151
  retries: typing.Union[int, modal.retries.Retries, None] = None,
155
152
  timeout: typing.Optional[int] = None,
@@ -179,13 +176,13 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.
179
176
  obj: modal.cls._Obj,
180
177
  from_other_workspace: bool,
181
178
  options: typing.Optional[modal_proto.api_pb2.FunctionOptions],
182
- args: typing.Sized,
183
- kwargs: typing.Dict[str, typing.Any],
179
+ args: collections.abc.Sized,
180
+ kwargs: dict[str, typing.Any],
184
181
  ) -> _Function: ...
185
182
  async def keep_warm(self, warm_pool_size: int) -> None: ...
186
183
  @classmethod
187
184
  def from_name(
188
- cls: typing.Type[_Function], app_name: str, tag: str, namespace=1, environment_name: typing.Optional[str] = None
185
+ cls: type[_Function], app_name: str, tag: str, namespace=1, environment_name: typing.Optional[str] = None
189
186
  ) -> _Function: ...
190
187
  @staticmethod
191
188
  async def lookup(
@@ -218,13 +215,13 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.
218
215
  def cluster_size(self) -> int: ...
219
216
  def _map(
220
217
  self, input_queue: modal.parallel_map._SynchronizedQueue, order_outputs: bool, return_exceptions: bool
221
- ) -> typing.AsyncGenerator[typing.Any, None]: ...
218
+ ) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
222
219
  async def _call_function(self, args, kwargs) -> ReturnType: ...
223
220
  async def _call_function_nowait(self, args, kwargs, function_call_invocation_type: int) -> _Invocation: ...
224
221
  def _call_generator(self, args, kwargs): ...
225
222
  async def _call_generator_nowait(self, args, kwargs): ...
226
223
  async def remote(self, *args: P.args, **kwargs: P.kwargs) -> ReturnType: ...
227
- def remote_gen(self, *args, **kwargs) -> typing.AsyncGenerator[typing.Any, None]: ...
224
+ def remote_gen(self, *args, **kwargs) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
228
225
  def _get_info(self) -> modal._utils.function_utils.FunctionInfo: ...
229
226
  def _get_obj(self) -> typing.Optional[modal.cls._Obj]: ...
230
227
  def local(self, *args: P.args, **kwargs: P.kwargs) -> OriginalReturnType: ...
@@ -279,7 +276,7 @@ P_INNER = typing_extensions.ParamSpec("P_INNER")
279
276
 
280
277
  class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.Object):
281
278
  _info: typing.Optional[modal._utils.function_utils.FunctionInfo]
282
- _serve_mounts: typing.FrozenSet[modal.mount.Mount]
279
+ _serve_mounts: frozenset[modal.mount.Mount]
283
280
  _app: typing.Optional[modal.app.App]
284
281
  _obj: typing.Optional[modal.cls.Obj]
285
282
  _web_url: typing.Optional[str]
@@ -293,7 +290,7 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
293
290
  _cluster_size: typing.Optional[int]
294
291
  _use_method_name: str
295
292
  _class_parameter_info: typing.Optional[modal_proto.api_pb2.ClassParameterInfo]
296
- _method_handle_metadata: typing.Optional[typing.Dict[str, modal_proto.api_pb2.FunctionHandleMetadata]]
293
+ _method_handle_metadata: typing.Optional[dict[str, modal_proto.api_pb2.FunctionHandleMetadata]]
297
294
 
298
295
  def __init__(self, *args, **kwargs): ...
299
296
  def _bind_method(self, user_cls, method_name: str, partial_function: modal.partial_function.PartialFunction): ...
@@ -303,23 +300,23 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
303
300
  info: modal._utils.function_utils.FunctionInfo,
304
301
  app,
305
302
  image: modal.image.Image,
306
- secrets: typing.Sequence[modal.secret.Secret] = (),
303
+ secrets: collections.abc.Sequence[modal.secret.Secret] = (),
307
304
  schedule: typing.Optional[modal.schedule.Schedule] = None,
308
305
  is_generator=False,
309
306
  gpu: typing.Union[
310
- None, bool, str, modal.gpu._GPUConfig, typing.List[typing.Union[None, bool, str, modal.gpu._GPUConfig]]
307
+ None, bool, str, modal.gpu._GPUConfig, list[typing.Union[None, bool, str, modal.gpu._GPUConfig]]
311
308
  ] = None,
312
- mounts: typing.Collection[modal.mount.Mount] = (),
313
- network_file_systems: typing.Dict[
309
+ mounts: collections.abc.Collection[modal.mount.Mount] = (),
310
+ network_file_systems: dict[
314
311
  typing.Union[str, pathlib.PurePosixPath], modal.network_file_system.NetworkFileSystem
315
312
  ] = {},
316
313
  allow_cross_region_volumes: bool = False,
317
- volumes: typing.Dict[
314
+ volumes: dict[
318
315
  typing.Union[str, pathlib.PurePosixPath],
319
316
  typing.Union[modal.volume.Volume, modal.cloud_bucket_mount.CloudBucketMount],
320
317
  ] = {},
321
318
  webhook_config: typing.Optional[modal_proto.api_pb2.WebhookConfig] = None,
322
- memory: typing.Union[int, typing.Tuple[int, int], None] = None,
319
+ memory: typing.Union[int, tuple[int, int], None] = None,
323
320
  proxy: typing.Optional[modal.proxy.Proxy] = None,
324
321
  retries: typing.Union[int, modal.retries.Retries, None] = None,
325
322
  timeout: typing.Optional[int] = None,
@@ -349,8 +346,8 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
349
346
  obj: modal.cls.Obj,
350
347
  from_other_workspace: bool,
351
348
  options: typing.Optional[modal_proto.api_pb2.FunctionOptions],
352
- args: typing.Sized,
353
- kwargs: typing.Dict[str, typing.Any],
349
+ args: collections.abc.Sized,
350
+ kwargs: dict[str, typing.Any],
354
351
  ) -> Function: ...
355
352
 
356
353
  class __keep_warm_spec(typing_extensions.Protocol):
@@ -361,7 +358,7 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
361
358
 
362
359
  @classmethod
363
360
  def from_name(
364
- cls: typing.Type[Function], app_name: str, tag: str, namespace=1, environment_name: typing.Optional[str] = None
361
+ cls: type[Function], app_name: str, tag: str, namespace=1, environment_name: typing.Optional[str] = None
365
362
  ) -> Function: ...
366
363
 
367
364
  class __lookup_spec(typing_extensions.Protocol):
@@ -412,7 +409,7 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
412
409
  ) -> typing.Generator[typing.Any, None, None]: ...
413
410
  def aio(
414
411
  self, input_queue: modal.parallel_map.SynchronizedQueue, order_outputs: bool, return_exceptions: bool
415
- ) -> typing.AsyncGenerator[typing.Any, None]: ...
412
+ ) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
416
413
 
417
414
  _map: ___map_spec
418
415
 
@@ -444,7 +441,7 @@ class Function(typing.Generic[P, ReturnType, OriginalReturnType], modal.object.O
444
441
 
445
442
  class __remote_gen_spec(typing_extensions.Protocol):
446
443
  def __call__(self, *args, **kwargs) -> typing.Generator[typing.Any, None, None]: ...
447
- def aio(self, *args, **kwargs) -> typing.AsyncGenerator[typing.Any, None]: ...
444
+ def aio(self, *args, **kwargs) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
448
445
 
449
446
  remote_gen: __remote_gen_spec
450
447
 
@@ -517,8 +514,8 @@ class _FunctionCall(typing.Generic[ReturnType], modal.object._Object):
517
514
 
518
515
  def _invocation(self): ...
519
516
  async def get(self, timeout: typing.Optional[float] = None) -> ReturnType: ...
520
- def get_gen(self) -> typing.AsyncGenerator[typing.Any, None]: ...
521
- async def get_call_graph(self) -> typing.List[modal.call_graph.InputInfo]: ...
517
+ def get_gen(self) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
518
+ async def get_call_graph(self) -> list[modal.call_graph.InputInfo]: ...
522
519
  async def cancel(self, terminate_containers: bool = False): ...
523
520
  @staticmethod
524
521
  async def from_id(
@@ -539,13 +536,13 @@ class FunctionCall(typing.Generic[ReturnType], modal.object.Object):
539
536
 
540
537
  class __get_gen_spec(typing_extensions.Protocol):
541
538
  def __call__(self) -> typing.Generator[typing.Any, None, None]: ...
542
- def aio(self) -> typing.AsyncGenerator[typing.Any, None]: ...
539
+ def aio(self) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
543
540
 
544
541
  get_gen: __get_gen_spec
545
542
 
546
543
  class __get_call_graph_spec(typing_extensions.Protocol):
547
- def __call__(self) -> typing.List[modal.call_graph.InputInfo]: ...
548
- async def aio(self) -> typing.List[modal.call_graph.InputInfo]: ...
544
+ def __call__(self) -> list[modal.call_graph.InputInfo]: ...
545
+ async def aio(self) -> list[modal.call_graph.InputInfo]: ...
549
546
 
550
547
  get_call_graph: __get_call_graph_spec
551
548