modal 1.0.4.dev10__py3-none-any.whl → 1.0.5__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 (67) hide show
  1. modal/_clustered_functions.pyi +13 -3
  2. modal/_functions.py +84 -46
  3. modal/_partial_function.py +1 -1
  4. modal/_runtime/container_io_manager.pyi +222 -40
  5. modal/_runtime/execution_context.pyi +60 -6
  6. modal/_serialization.py +25 -2
  7. modal/_tunnel.pyi +380 -12
  8. modal/_utils/async_utils.py +1 -1
  9. modal/_utils/blob_utils.py +56 -19
  10. modal/_utils/function_utils.py +33 -7
  11. modal/_utils/grpc_utils.py +11 -4
  12. modal/app.py +5 -5
  13. modal/app.pyi +658 -48
  14. modal/cli/run.py +2 -1
  15. modal/client.pyi +224 -36
  16. modal/cloud_bucket_mount.pyi +192 -4
  17. modal/cls.py +57 -16
  18. modal/cls.pyi +442 -34
  19. modal/container_process.pyi +103 -14
  20. modal/dict.py +4 -4
  21. modal/dict.pyi +453 -51
  22. modal/environments.pyi +41 -9
  23. modal/exception.py +6 -2
  24. modal/experimental/__init__.py +90 -0
  25. modal/experimental/ipython.py +11 -7
  26. modal/file_io.pyi +236 -45
  27. modal/functions.pyi +573 -65
  28. modal/gpu.py +1 -1
  29. modal/image.py +1 -1
  30. modal/image.pyi +1256 -74
  31. modal/io_streams.py +8 -4
  32. modal/io_streams.pyi +348 -38
  33. modal/mount.pyi +261 -31
  34. modal/network_file_system.py +3 -3
  35. modal/network_file_system.pyi +307 -26
  36. modal/object.pyi +48 -9
  37. modal/parallel_map.py +93 -19
  38. modal/parallel_map.pyi +160 -15
  39. modal/partial_function.pyi +255 -14
  40. modal/proxy.py +1 -1
  41. modal/proxy.pyi +28 -3
  42. modal/queue.py +4 -4
  43. modal/queue.pyi +447 -30
  44. modal/runner.pyi +160 -22
  45. modal/sandbox.py +8 -7
  46. modal/sandbox.pyi +310 -50
  47. modal/schedule.py +1 -1
  48. modal/secret.py +2 -2
  49. modal/secret.pyi +164 -15
  50. modal/snapshot.pyi +25 -4
  51. modal/token_flow.pyi +28 -8
  52. modal/volume.py +41 -4
  53. modal/volume.pyi +693 -59
  54. {modal-1.0.4.dev10.dist-info → modal-1.0.5.dist-info}/METADATA +3 -3
  55. {modal-1.0.4.dev10.dist-info → modal-1.0.5.dist-info}/RECORD +67 -67
  56. modal_proto/api.proto +57 -0
  57. modal_proto/api_grpc.py +48 -0
  58. modal_proto/api_pb2.py +874 -780
  59. modal_proto/api_pb2.pyi +198 -9
  60. modal_proto/api_pb2_grpc.py +100 -0
  61. modal_proto/api_pb2_grpc.pyi +32 -0
  62. modal_proto/modal_api_grpc.py +3 -0
  63. modal_version/__init__.py +1 -1
  64. {modal-1.0.4.dev10.dist-info → modal-1.0.5.dist-info}/WHEEL +0 -0
  65. {modal-1.0.4.dev10.dist-info → modal-1.0.5.dist-info}/entry_points.txt +0 -0
  66. {modal-1.0.4.dev10.dist-info → modal-1.0.5.dist-info}/licenses/LICENSE +0 -0
  67. {modal-1.0.4.dev10.dist-info → modal-1.0.5.dist-info}/top_level.txt +0 -0
@@ -7,6 +7,26 @@ import typing_extensions
7
7
  T = typing.TypeVar("T")
8
8
 
9
9
  class _ContainerProcess(typing.Generic[T]):
10
+ """Abstract base class for generic types.
11
+
12
+ A generic type is typically declared by inheriting from
13
+ this class parameterized with one or more type variables.
14
+ For example, a generic mapping type might be defined as::
15
+
16
+ class Mapping(Generic[KT, VT]):
17
+ def __getitem__(self, key: KT) -> VT:
18
+ ...
19
+ # Etc.
20
+
21
+ This class can then be used as follows::
22
+
23
+ def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
24
+ try:
25
+ return mapping[key]
26
+ except KeyError:
27
+ return default
28
+ """
29
+
10
30
  _process_id: typing.Optional[str]
11
31
  _stdout: modal.io_streams._StreamReader[T]
12
32
  _stderr: modal.io_streams._StreamReader[T]
@@ -23,23 +43,67 @@ class _ContainerProcess(typing.Generic[T]):
23
43
  stderr: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
24
44
  text: bool = True,
25
45
  by_line: bool = False,
26
- ) -> None: ...
27
- def __repr__(self) -> str: ...
46
+ ) -> None:
47
+ """Initialize self. See help(type(self)) for accurate signature."""
48
+ ...
49
+
50
+ def __repr__(self) -> str:
51
+ """Return repr(self)."""
52
+ ...
53
+
28
54
  @property
29
- def stdout(self) -> modal.io_streams._StreamReader[T]: ...
55
+ def stdout(self) -> modal.io_streams._StreamReader[T]:
56
+ """StreamReader for the container process's stdout stream."""
57
+ ...
58
+
30
59
  @property
31
- def stderr(self) -> modal.io_streams._StreamReader[T]: ...
60
+ def stderr(self) -> modal.io_streams._StreamReader[T]:
61
+ """StreamReader for the container process's stderr stream."""
62
+ ...
63
+
32
64
  @property
33
- def stdin(self) -> modal.io_streams._StreamWriter: ...
65
+ def stdin(self) -> modal.io_streams._StreamWriter:
66
+ """StreamWriter for the container process's stdin stream."""
67
+ ...
68
+
34
69
  @property
35
70
  def returncode(self) -> int: ...
36
- async def poll(self) -> typing.Optional[int]: ...
37
- async def wait(self) -> int: ...
71
+ async def poll(self) -> typing.Optional[int]:
72
+ """Check if the container process has finished running.
73
+
74
+ Returns `None` if the process is still running, else returns the exit code.
75
+ """
76
+ ...
77
+
78
+ async def wait(self) -> int:
79
+ """Wait for the container process to finish running. Returns the exit code."""
80
+ ...
81
+
38
82
  async def attach(self): ...
39
83
 
40
84
  SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
41
85
 
42
86
  class ContainerProcess(typing.Generic[T]):
87
+ """Abstract base class for generic types.
88
+
89
+ A generic type is typically declared by inheriting from
90
+ this class parameterized with one or more type variables.
91
+ For example, a generic mapping type might be defined as::
92
+
93
+ class Mapping(Generic[KT, VT]):
94
+ def __getitem__(self, key: KT) -> VT:
95
+ ...
96
+ # Etc.
97
+
98
+ This class can then be used as follows::
99
+
100
+ def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
101
+ try:
102
+ return mapping[key]
103
+ except KeyError:
104
+ return default
105
+ """
106
+
43
107
  _process_id: typing.Optional[str]
44
108
  _stdout: modal.io_streams.StreamReader[T]
45
109
  _stderr: modal.io_streams.StreamReader[T]
@@ -59,23 +123,48 @@ class ContainerProcess(typing.Generic[T]):
59
123
  ) -> None: ...
60
124
  def __repr__(self) -> str: ...
61
125
  @property
62
- def stdout(self) -> modal.io_streams.StreamReader[T]: ...
126
+ def stdout(self) -> modal.io_streams.StreamReader[T]:
127
+ """StreamReader for the container process's stdout stream."""
128
+ ...
129
+
63
130
  @property
64
- def stderr(self) -> modal.io_streams.StreamReader[T]: ...
131
+ def stderr(self) -> modal.io_streams.StreamReader[T]:
132
+ """StreamReader for the container process's stderr stream."""
133
+ ...
134
+
65
135
  @property
66
- def stdin(self) -> modal.io_streams.StreamWriter: ...
136
+ def stdin(self) -> modal.io_streams.StreamWriter:
137
+ """StreamWriter for the container process's stdin stream."""
138
+ ...
139
+
67
140
  @property
68
141
  def returncode(self) -> int: ...
69
142
 
70
143
  class __poll_spec(typing_extensions.Protocol[SUPERSELF]):
71
- def __call__(self, /) -> typing.Optional[int]: ...
72
- async def aio(self, /) -> typing.Optional[int]: ...
144
+ def __call__(self, /) -> typing.Optional[int]:
145
+ """Check if the container process has finished running.
146
+
147
+ Returns `None` if the process is still running, else returns the exit code.
148
+ """
149
+ ...
150
+
151
+ async def aio(self, /) -> typing.Optional[int]:
152
+ """Check if the container process has finished running.
153
+
154
+ Returns `None` if the process is still running, else returns the exit code.
155
+ """
156
+ ...
73
157
 
74
158
  poll: __poll_spec[typing_extensions.Self]
75
159
 
76
160
  class __wait_spec(typing_extensions.Protocol[SUPERSELF]):
77
- def __call__(self, /) -> int: ...
78
- async def aio(self, /) -> int: ...
161
+ def __call__(self, /) -> int:
162
+ """Wait for the container process to finish running. Returns the exit code."""
163
+ ...
164
+
165
+ async def aio(self, /) -> int:
166
+ """Wait for the container process to finish running. Returns the exit code."""
167
+ ...
79
168
 
80
169
  wait: __wait_spec[typing_extensions.Self]
81
170
 
modal/dict.py CHANGED
@@ -62,7 +62,7 @@ class _Dict(_Object, type_prefix="di"):
62
62
  the `.aio` suffix on the method, whereas their operator-based analogues will always
63
63
  run synchronously and block the event loop.
64
64
 
65
- For more examples, see the [guide](/docs/guide/dicts-and-queues#modal-dicts).
65
+ For more examples, see the [guide](https://modal.com/docs/guide/dicts-and-queues#modal-dicts).
66
66
  """
67
67
 
68
68
  def __init__(self, data={}):
@@ -125,9 +125,9 @@ class _Dict(_Object, type_prefix="di"):
125
125
  ) -> "_Dict":
126
126
  """Reference a named Dict, creating if necessary.
127
127
 
128
- In contrast to `modal.Dict.lookup`, this is a lazy method
129
- that defers hydrating the local object with metadata from
130
- Modal servers until the first time it is actually used.
128
+ This is a lazy method that defers hydrating the local
129
+ object with metadata from Modal servers until the first
130
+ time it is actually used.
131
131
 
132
132
  ```python
133
133
  d = modal.Dict.from_name("my-dict", create_if_missing=True)