modal 1.0.5.dev2__py3-none-any.whl → 1.0.5.dev4__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/_clustered_functions.pyi +13 -3
- modal/_functions.py +5 -4
- modal/_partial_function.py +1 -1
- modal/_runtime/container_io_manager.pyi +222 -40
- modal/_runtime/execution_context.pyi +60 -6
- modal/_tunnel.pyi +380 -12
- modal/app.py +4 -4
- modal/app.pyi +658 -48
- modal/cli/run.py +2 -1
- modal/client.pyi +224 -28
- modal/cloud_bucket_mount.pyi +192 -4
- modal/cls.py +3 -3
- modal/cls.pyi +442 -35
- modal/container_process.pyi +103 -14
- modal/dict.py +1 -1
- modal/dict.pyi +453 -51
- modal/environments.pyi +41 -9
- modal/exception.py +2 -2
- modal/file_io.pyi +236 -45
- modal/functions.pyi +545 -56
- modal/gpu.py +1 -1
- modal/image.py +1 -1
- modal/image.pyi +1256 -74
- modal/io_streams.pyi +342 -39
- modal/mount.pyi +261 -31
- modal/network_file_system.pyi +307 -26
- modal/object.pyi +48 -9
- modal/parallel_map.pyi +144 -14
- modal/partial_function.pyi +255 -14
- modal/proxy.py +1 -1
- modal/proxy.pyi +28 -3
- modal/queue.py +1 -1
- modal/queue.pyi +447 -30
- modal/runner.pyi +160 -22
- modal/sandbox.py +7 -7
- modal/sandbox.pyi +310 -50
- modal/schedule.py +1 -1
- modal/secret.py +2 -2
- modal/secret.pyi +164 -15
- modal/snapshot.pyi +25 -4
- modal/token_flow.pyi +28 -8
- modal/volume.py +1 -1
- modal/volume.pyi +649 -59
- {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/METADATA +1 -1
- {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/RECORD +50 -50
- modal_version/__init__.py +1 -1
- {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/WHEEL +0 -0
- {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/entry_points.txt +0 -0
- {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/licenses/LICENSE +0 -0
- {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/top_level.txt +0 -0
modal/secret.pyi
CHANGED
@@ -5,16 +5,82 @@ import typing
|
|
5
5
|
import typing_extensions
|
6
6
|
|
7
7
|
class _Secret(modal._object._Object):
|
8
|
+
"""Secrets provide a dictionary of environment variables for images.
|
9
|
+
|
10
|
+
Secrets are a secure way to add credentials and other sensitive information
|
11
|
+
to the containers your functions run in. You can create and edit secrets on
|
12
|
+
[the dashboard](https://modal.com/secrets), or programmatically from Python code.
|
13
|
+
|
14
|
+
See [the secrets guide page](https://modal.com/docs/guide/secrets) for more information.
|
15
|
+
"""
|
8
16
|
@staticmethod
|
9
|
-
def from_dict(env_dict: dict[str, typing.Optional[str]] = {}) -> _Secret:
|
17
|
+
def from_dict(env_dict: dict[str, typing.Optional[str]] = {}) -> _Secret:
|
18
|
+
"""Create a secret from a str-str dictionary. Values can also be `None`, which is ignored.
|
19
|
+
|
20
|
+
Usage:
|
21
|
+
```python
|
22
|
+
@app.function(secrets=[modal.Secret.from_dict({"FOO": "bar"})])
|
23
|
+
def run():
|
24
|
+
print(os.environ["FOO"])
|
25
|
+
```
|
26
|
+
"""
|
27
|
+
...
|
28
|
+
|
10
29
|
@staticmethod
|
11
|
-
def from_local_environ(env_keys: list[str]) -> _Secret:
|
30
|
+
def from_local_environ(env_keys: list[str]) -> _Secret:
|
31
|
+
"""Create secrets from local environment variables automatically."""
|
32
|
+
...
|
33
|
+
|
12
34
|
@staticmethod
|
13
|
-
def from_dotenv(path=None, *, filename=".env") -> _Secret:
|
35
|
+
def from_dotenv(path=None, *, filename=".env") -> _Secret:
|
36
|
+
"""Create secrets from a .env file automatically.
|
37
|
+
|
38
|
+
If no argument is provided, it will use the current working directory as the starting
|
39
|
+
point for finding a `.env` file. Note that it does not use the location of the module
|
40
|
+
calling `Secret.from_dotenv`.
|
41
|
+
|
42
|
+
If called with an argument, it will use that as a starting point for finding `.env` files.
|
43
|
+
In particular, you can call it like this:
|
44
|
+
```python
|
45
|
+
@app.function(secrets=[modal.Secret.from_dotenv(__file__)])
|
46
|
+
def run():
|
47
|
+
print(os.environ["USERNAME"]) # Assumes USERNAME is defined in your .env file
|
48
|
+
```
|
49
|
+
|
50
|
+
This will use the location of the script calling `modal.Secret.from_dotenv` as a
|
51
|
+
starting point for finding the `.env` file.
|
52
|
+
|
53
|
+
A file named `.env` is expected by default, but this can be overridden with the `filename`
|
54
|
+
keyword argument:
|
55
|
+
|
56
|
+
```python
|
57
|
+
@app.function(secrets=[modal.Secret.from_dotenv(filename=".env-dev")])
|
58
|
+
def run():
|
59
|
+
...
|
60
|
+
```
|
61
|
+
"""
|
62
|
+
...
|
63
|
+
|
14
64
|
@staticmethod
|
15
65
|
def from_name(
|
16
66
|
name: str, *, namespace=1, environment_name: typing.Optional[str] = None, required_keys: list[str] = []
|
17
|
-
) -> _Secret:
|
67
|
+
) -> _Secret:
|
68
|
+
"""Reference a Secret by its name.
|
69
|
+
|
70
|
+
In contrast to most other Modal objects, named Secrets must be provisioned
|
71
|
+
from the Dashboard. See other methods for alternate ways of creating a new
|
72
|
+
Secret from code.
|
73
|
+
|
74
|
+
```python
|
75
|
+
secret = modal.Secret.from_name("my-secret")
|
76
|
+
|
77
|
+
@app.function(secrets=[secret])
|
78
|
+
def run():
|
79
|
+
...
|
80
|
+
```
|
81
|
+
"""
|
82
|
+
...
|
83
|
+
|
18
84
|
@staticmethod
|
19
85
|
async def lookup(
|
20
86
|
name: str,
|
@@ -22,7 +88,10 @@ class _Secret(modal._object._Object):
|
|
22
88
|
client: typing.Optional[modal.client._Client] = None,
|
23
89
|
environment_name: typing.Optional[str] = None,
|
24
90
|
required_keys: list[str] = [],
|
25
|
-
) -> _Secret:
|
91
|
+
) -> _Secret:
|
92
|
+
"""mdmd:hidden"""
|
93
|
+
...
|
94
|
+
|
26
95
|
@staticmethod
|
27
96
|
async def create_deployed(
|
28
97
|
deployment_name: str,
|
@@ -31,20 +100,90 @@ class _Secret(modal._object._Object):
|
|
31
100
|
client: typing.Optional[modal.client._Client] = None,
|
32
101
|
environment_name: typing.Optional[str] = None,
|
33
102
|
overwrite: bool = False,
|
34
|
-
) -> str:
|
103
|
+
) -> str:
|
104
|
+
"""mdmd:hidden"""
|
105
|
+
...
|
35
106
|
|
36
107
|
class Secret(modal.object.Object):
|
37
|
-
|
108
|
+
"""Secrets provide a dictionary of environment variables for images.
|
109
|
+
|
110
|
+
Secrets are a secure way to add credentials and other sensitive information
|
111
|
+
to the containers your functions run in. You can create and edit secrets on
|
112
|
+
[the dashboard](https://modal.com/secrets), or programmatically from Python code.
|
113
|
+
|
114
|
+
See [the secrets guide page](https://modal.com/docs/guide/secrets) for more information.
|
115
|
+
"""
|
116
|
+
def __init__(self, *args, **kwargs):
|
117
|
+
"""mdmd:hidden"""
|
118
|
+
...
|
119
|
+
|
38
120
|
@staticmethod
|
39
|
-
def from_dict(env_dict: dict[str, typing.Optional[str]] = {}) -> Secret:
|
121
|
+
def from_dict(env_dict: dict[str, typing.Optional[str]] = {}) -> Secret:
|
122
|
+
"""Create a secret from a str-str dictionary. Values can also be `None`, which is ignored.
|
123
|
+
|
124
|
+
Usage:
|
125
|
+
```python
|
126
|
+
@app.function(secrets=[modal.Secret.from_dict({"FOO": "bar"})])
|
127
|
+
def run():
|
128
|
+
print(os.environ["FOO"])
|
129
|
+
```
|
130
|
+
"""
|
131
|
+
...
|
132
|
+
|
40
133
|
@staticmethod
|
41
|
-
def from_local_environ(env_keys: list[str]) -> Secret:
|
134
|
+
def from_local_environ(env_keys: list[str]) -> Secret:
|
135
|
+
"""Create secrets from local environment variables automatically."""
|
136
|
+
...
|
137
|
+
|
42
138
|
@staticmethod
|
43
|
-
def from_dotenv(path=None, *, filename=".env") -> Secret:
|
139
|
+
def from_dotenv(path=None, *, filename=".env") -> Secret:
|
140
|
+
"""Create secrets from a .env file automatically.
|
141
|
+
|
142
|
+
If no argument is provided, it will use the current working directory as the starting
|
143
|
+
point for finding a `.env` file. Note that it does not use the location of the module
|
144
|
+
calling `Secret.from_dotenv`.
|
145
|
+
|
146
|
+
If called with an argument, it will use that as a starting point for finding `.env` files.
|
147
|
+
In particular, you can call it like this:
|
148
|
+
```python
|
149
|
+
@app.function(secrets=[modal.Secret.from_dotenv(__file__)])
|
150
|
+
def run():
|
151
|
+
print(os.environ["USERNAME"]) # Assumes USERNAME is defined in your .env file
|
152
|
+
```
|
153
|
+
|
154
|
+
This will use the location of the script calling `modal.Secret.from_dotenv` as a
|
155
|
+
starting point for finding the `.env` file.
|
156
|
+
|
157
|
+
A file named `.env` is expected by default, but this can be overridden with the `filename`
|
158
|
+
keyword argument:
|
159
|
+
|
160
|
+
```python
|
161
|
+
@app.function(secrets=[modal.Secret.from_dotenv(filename=".env-dev")])
|
162
|
+
def run():
|
163
|
+
...
|
164
|
+
```
|
165
|
+
"""
|
166
|
+
...
|
167
|
+
|
44
168
|
@staticmethod
|
45
169
|
def from_name(
|
46
170
|
name: str, *, namespace=1, environment_name: typing.Optional[str] = None, required_keys: list[str] = []
|
47
|
-
) -> Secret:
|
171
|
+
) -> Secret:
|
172
|
+
"""Reference a Secret by its name.
|
173
|
+
|
174
|
+
In contrast to most other Modal objects, named Secrets must be provisioned
|
175
|
+
from the Dashboard. See other methods for alternate ways of creating a new
|
176
|
+
Secret from code.
|
177
|
+
|
178
|
+
```python
|
179
|
+
secret = modal.Secret.from_name("my-secret")
|
180
|
+
|
181
|
+
@app.function(secrets=[secret])
|
182
|
+
def run():
|
183
|
+
...
|
184
|
+
```
|
185
|
+
"""
|
186
|
+
...
|
48
187
|
|
49
188
|
class __lookup_spec(typing_extensions.Protocol):
|
50
189
|
def __call__(
|
@@ -55,7 +194,10 @@ class Secret(modal.object.Object):
|
|
55
194
|
client: typing.Optional[modal.client.Client] = None,
|
56
195
|
environment_name: typing.Optional[str] = None,
|
57
196
|
required_keys: list[str] = [],
|
58
|
-
) -> Secret:
|
197
|
+
) -> Secret:
|
198
|
+
"""mdmd:hidden"""
|
199
|
+
...
|
200
|
+
|
59
201
|
async def aio(
|
60
202
|
self,
|
61
203
|
/,
|
@@ -64,7 +206,9 @@ class Secret(modal.object.Object):
|
|
64
206
|
client: typing.Optional[modal.client.Client] = None,
|
65
207
|
environment_name: typing.Optional[str] = None,
|
66
208
|
required_keys: list[str] = [],
|
67
|
-
) -> Secret:
|
209
|
+
) -> Secret:
|
210
|
+
"""mdmd:hidden"""
|
211
|
+
...
|
68
212
|
|
69
213
|
lookup: __lookup_spec
|
70
214
|
|
@@ -78,7 +222,10 @@ class Secret(modal.object.Object):
|
|
78
222
|
client: typing.Optional[modal.client.Client] = None,
|
79
223
|
environment_name: typing.Optional[str] = None,
|
80
224
|
overwrite: bool = False,
|
81
|
-
) -> str:
|
225
|
+
) -> str:
|
226
|
+
"""mdmd:hidden"""
|
227
|
+
...
|
228
|
+
|
82
229
|
async def aio(
|
83
230
|
self,
|
84
231
|
/,
|
@@ -88,6 +235,8 @@ class Secret(modal.object.Object):
|
|
88
235
|
client: typing.Optional[modal.client.Client] = None,
|
89
236
|
environment_name: typing.Optional[str] = None,
|
90
237
|
overwrite: bool = False,
|
91
|
-
) -> str:
|
238
|
+
) -> str:
|
239
|
+
"""mdmd:hidden"""
|
240
|
+
...
|
92
241
|
|
93
242
|
create_deployed: __create_deployed_spec
|
modal/snapshot.pyi
CHANGED
@@ -5,14 +5,35 @@ import typing
|
|
5
5
|
import typing_extensions
|
6
6
|
|
7
7
|
class _SandboxSnapshot(modal._object._Object):
|
8
|
+
"""> Sandbox memory snapshots are in **early preview**.
|
9
|
+
|
10
|
+
A `SandboxSnapshot` object lets you interact with a stored Sandbox snapshot that was created by calling
|
11
|
+
`._experimental_snapshot()` on a Sandbox instance. This includes both the filesystem and memory state of
|
12
|
+
the original Sandbox at the time the snapshot was taken.
|
13
|
+
"""
|
8
14
|
@staticmethod
|
9
|
-
async def from_id(sandbox_snapshot_id: str, client: typing.Optional[modal.client._Client] = None):
|
15
|
+
async def from_id(sandbox_snapshot_id: str, client: typing.Optional[modal.client._Client] = None):
|
16
|
+
"""Construct a `SandboxSnapshot` object from a sandbox snapshot ID."""
|
17
|
+
...
|
10
18
|
|
11
19
|
class SandboxSnapshot(modal.object.Object):
|
12
|
-
|
20
|
+
"""> Sandbox memory snapshots are in **early preview**.
|
21
|
+
|
22
|
+
A `SandboxSnapshot` object lets you interact with a stored Sandbox snapshot that was created by calling
|
23
|
+
`._experimental_snapshot()` on a Sandbox instance. This includes both the filesystem and memory state of
|
24
|
+
the original Sandbox at the time the snapshot was taken.
|
25
|
+
"""
|
26
|
+
def __init__(self, *args, **kwargs):
|
27
|
+
"""mdmd:hidden"""
|
28
|
+
...
|
13
29
|
|
14
30
|
class __from_id_spec(typing_extensions.Protocol):
|
15
|
-
def __call__(self, /, sandbox_snapshot_id: str, client: typing.Optional[modal.client.Client] = None):
|
16
|
-
|
31
|
+
def __call__(self, /, sandbox_snapshot_id: str, client: typing.Optional[modal.client.Client] = None):
|
32
|
+
"""Construct a `SandboxSnapshot` object from a sandbox snapshot ID."""
|
33
|
+
...
|
34
|
+
|
35
|
+
async def aio(self, /, sandbox_snapshot_id: str, client: typing.Optional[modal.client.Client] = None):
|
36
|
+
"""Construct a `SandboxSnapshot` object from a sandbox snapshot ID."""
|
37
|
+
...
|
17
38
|
|
18
39
|
from_id: __from_id_spec
|
modal/token_flow.pyi
CHANGED
@@ -5,13 +5,21 @@ import typing
|
|
5
5
|
import typing_extensions
|
6
6
|
|
7
7
|
class _TokenFlow:
|
8
|
-
def __init__(self, client: modal.client._Client):
|
8
|
+
def __init__(self, client: modal.client._Client):
|
9
|
+
"""Initialize self. See help(type(self)) for accurate signature."""
|
10
|
+
...
|
11
|
+
|
9
12
|
def start(
|
10
13
|
self, utm_source: typing.Optional[str] = None, next_url: typing.Optional[str] = None
|
11
|
-
) -> typing.AsyncContextManager[tuple[str, str, str]]:
|
14
|
+
) -> typing.AsyncContextManager[tuple[str, str, str]]:
|
15
|
+
"""mdmd:hidden"""
|
16
|
+
...
|
17
|
+
|
12
18
|
async def finish(
|
13
19
|
self, timeout: float = 40.0, grpc_extra_timeout: float = 5.0
|
14
|
-
) -> typing.Optional[modal_proto.api_pb2.TokenFlowWaitResponse]:
|
20
|
+
) -> typing.Optional[modal_proto.api_pb2.TokenFlowWaitResponse]:
|
21
|
+
"""mdmd:hidden"""
|
22
|
+
...
|
15
23
|
|
16
24
|
SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
|
17
25
|
|
@@ -21,20 +29,30 @@ class TokenFlow:
|
|
21
29
|
class __start_spec(typing_extensions.Protocol[SUPERSELF]):
|
22
30
|
def __call__(
|
23
31
|
self, /, utm_source: typing.Optional[str] = None, next_url: typing.Optional[str] = None
|
24
|
-
) -> synchronicity.combined_types.AsyncAndBlockingContextManager[tuple[str, str, str]]:
|
32
|
+
) -> synchronicity.combined_types.AsyncAndBlockingContextManager[tuple[str, str, str]]:
|
33
|
+
"""mdmd:hidden"""
|
34
|
+
...
|
35
|
+
|
25
36
|
def aio(
|
26
37
|
self, /, utm_source: typing.Optional[str] = None, next_url: typing.Optional[str] = None
|
27
|
-
) -> typing.AsyncContextManager[tuple[str, str, str]]:
|
38
|
+
) -> typing.AsyncContextManager[tuple[str, str, str]]:
|
39
|
+
"""mdmd:hidden"""
|
40
|
+
...
|
28
41
|
|
29
42
|
start: __start_spec[typing_extensions.Self]
|
30
43
|
|
31
44
|
class __finish_spec(typing_extensions.Protocol[SUPERSELF]):
|
32
45
|
def __call__(
|
33
46
|
self, /, timeout: float = 40.0, grpc_extra_timeout: float = 5.0
|
34
|
-
) -> typing.Optional[modal_proto.api_pb2.TokenFlowWaitResponse]:
|
47
|
+
) -> typing.Optional[modal_proto.api_pb2.TokenFlowWaitResponse]:
|
48
|
+
"""mdmd:hidden"""
|
49
|
+
...
|
50
|
+
|
35
51
|
async def aio(
|
36
52
|
self, /, timeout: float = 40.0, grpc_extra_timeout: float = 5.0
|
37
|
-
) -> typing.Optional[modal_proto.api_pb2.TokenFlowWaitResponse]:
|
53
|
+
) -> typing.Optional[modal_proto.api_pb2.TokenFlowWaitResponse]:
|
54
|
+
"""mdmd:hidden"""
|
55
|
+
...
|
38
56
|
|
39
57
|
finish: __finish_spec[typing_extensions.Self]
|
40
58
|
|
@@ -55,4 +73,6 @@ async def _set_token(
|
|
55
73
|
verify: bool = True,
|
56
74
|
server_url: typing.Optional[str] = None,
|
57
75
|
): ...
|
58
|
-
def _open_url(url: str) -> bool:
|
76
|
+
def _open_url(url: str) -> bool:
|
77
|
+
"""Opens url in web browser, making sure we use a modern one (not Lynx etc)"""
|
78
|
+
...
|
modal/volume.py
CHANGED
@@ -405,7 +405,7 @@ class _Volume(_Object, type_prefix="vo"):
|
|
405
405
|
|
406
406
|
Note - this function is primarily intended to be used outside of a Modal App.
|
407
407
|
For more information on downloading files from a Modal Volume, see
|
408
|
-
[the guide](/docs/guide/volumes).
|
408
|
+
[the guide](https://modal.com/docs/guide/volumes).
|
409
409
|
|
410
410
|
**Example:**
|
411
411
|
|