modal 1.1.5.dev64__py3-none-any.whl → 1.1.5.dev66__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.
- modal/_functions.py +3 -36
- modal/client.pyi +2 -2
- modal/cls.py +0 -41
- modal/cls.pyi +0 -78
- modal/dict.py +0 -41
- modal/dict.pyi +0 -77
- modal/environments.py +0 -20
- modal/environments.pyi +0 -14
- modal/functions.pyi +6 -55
- modal/image.py +3 -31
- modal/image.pyi +0 -5
- modal/mount.py +0 -117
- modal/mount.pyi +0 -170
- modal/network_file_system.py +1 -40
- modal/network_file_system.pyi +0 -74
- modal/queue.py +0 -39
- modal/queue.pyi +0 -74
- modal/secret.py +0 -29
- modal/secret.pyi +0 -38
- modal/volume.py +0 -41
- modal/volume.pyi +0 -77
- {modal-1.1.5.dev64.dist-info → modal-1.1.5.dev66.dist-info}/METADATA +1 -1
- {modal-1.1.5.dev64.dist-info → modal-1.1.5.dev66.dist-info}/RECORD +28 -28
- modal_version/__init__.py +1 -1
- {modal-1.1.5.dev64.dist-info → modal-1.1.5.dev66.dist-info}/WHEEL +0 -0
- {modal-1.1.5.dev64.dist-info → modal-1.1.5.dev66.dist-info}/entry_points.txt +0 -0
- {modal-1.1.5.dev64.dist-info → modal-1.1.5.dev66.dist-info}/licenses/LICENSE +0 -0
- {modal-1.1.5.dev64.dist-info → modal-1.1.5.dev66.dist-info}/top_level.txt +0 -0
modal/_functions.py
CHANGED
|
@@ -1429,40 +1429,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1429
1429
|
warn_if_passing_namespace(namespace, "modal.Function.from_name")
|
|
1430
1430
|
return cls._from_name(app_name, name, environment_name=environment_name)
|
|
1431
1431
|
|
|
1432
|
-
@staticmethod
|
|
1433
|
-
async def lookup(
|
|
1434
|
-
app_name: str,
|
|
1435
|
-
name: str,
|
|
1436
|
-
namespace=None, # mdmd:line-hidden
|
|
1437
|
-
client: Optional[_Client] = None,
|
|
1438
|
-
environment_name: Optional[str] = None,
|
|
1439
|
-
) -> "_Function":
|
|
1440
|
-
"""mdmd:hidden
|
|
1441
|
-
Lookup a Function from a deployed App by its name.
|
|
1442
|
-
|
|
1443
|
-
DEPRECATED: This method is deprecated in favor of `modal.Function.from_name`.
|
|
1444
|
-
|
|
1445
|
-
In contrast to `modal.Function.from_name`, this is an eager method
|
|
1446
|
-
that will hydrate the local object with metadata from Modal servers.
|
|
1447
|
-
|
|
1448
|
-
```python notest
|
|
1449
|
-
f = modal.Function.lookup("other-app", "function")
|
|
1450
|
-
```
|
|
1451
|
-
"""
|
|
1452
|
-
deprecation_warning(
|
|
1453
|
-
(2025, 1, 27),
|
|
1454
|
-
"`modal.Function.lookup` is deprecated and will be removed in a future release."
|
|
1455
|
-
" It can be replaced with `modal.Function.from_name`."
|
|
1456
|
-
"\n\nSee https://modal.com/docs/guide/modal-1-0-migration for more information.",
|
|
1457
|
-
)
|
|
1458
|
-
warn_if_passing_namespace(namespace, "modal.Function.lookup")
|
|
1459
|
-
obj = _Function.from_name(app_name, name, environment_name=environment_name)
|
|
1460
|
-
if client is None:
|
|
1461
|
-
client = await _Client.from_env()
|
|
1462
|
-
resolver = Resolver(client=client)
|
|
1463
|
-
await resolver.load(obj)
|
|
1464
|
-
return obj
|
|
1465
|
-
|
|
1466
1432
|
@property
|
|
1467
1433
|
def tag(self) -> str:
|
|
1468
1434
|
"""mdmd:hidden"""
|
|
@@ -1811,8 +1777,9 @@ Use the `Function.get_web_url()` method instead.
|
|
|
1811
1777
|
# "user code" to run on the synchronicity thread, which seems bad
|
|
1812
1778
|
if not self._is_local():
|
|
1813
1779
|
msg = (
|
|
1814
|
-
"The definition for this
|
|
1815
|
-
"If this function was retrieved via `Function.
|
|
1780
|
+
"The definition for this Function is missing, so it is not possible to invoke it locally. "
|
|
1781
|
+
"If this function was retrieved via `Function.from_name`, "
|
|
1782
|
+
"you need to use one of the remote invocation methods instead."
|
|
1816
1783
|
)
|
|
1817
1784
|
raise ExecutionError(msg)
|
|
1818
1785
|
|
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.1.5.
|
|
36
|
+
version: str = "1.1.5.dev66",
|
|
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.1.5.
|
|
167
|
+
version: str = "1.1.5.dev66",
|
|
168
168
|
):
|
|
169
169
|
"""mdmd:hidden
|
|
170
170
|
The Modal client object is not intended to be instantiated directly by users.
|
modal/cls.py
CHANGED
|
@@ -32,7 +32,6 @@ from ._utils.deprecation import (
|
|
|
32
32
|
)
|
|
33
33
|
from ._utils.grpc_utils import retry_transient_errors
|
|
34
34
|
from ._utils.mount_utils import validate_volumes
|
|
35
|
-
from .client import _Client
|
|
36
35
|
from .cloud_bucket_mount import _CloudBucketMount
|
|
37
36
|
from .config import config
|
|
38
37
|
from .exception import ExecutionError, InvalidError, NotFoundError
|
|
@@ -852,46 +851,6 @@ More information on class parameterization can be found here: https://modal.com/
|
|
|
852
851
|
cls._options.merge_options(batching_options)
|
|
853
852
|
return cls
|
|
854
853
|
|
|
855
|
-
@staticmethod
|
|
856
|
-
async def lookup(
|
|
857
|
-
app_name: str,
|
|
858
|
-
name: str,
|
|
859
|
-
namespace=None, # mdmd:line-hidden
|
|
860
|
-
client: Optional[_Client] = None,
|
|
861
|
-
environment_name: Optional[str] = None,
|
|
862
|
-
) -> "_Cls":
|
|
863
|
-
"""mdmd:hidden
|
|
864
|
-
Lookup a Cls from a deployed App by its name.
|
|
865
|
-
|
|
866
|
-
DEPRECATED: This method is deprecated in favor of `modal.Cls.from_name`.
|
|
867
|
-
|
|
868
|
-
In contrast to `modal.Cls.from_name`, this is an eager method
|
|
869
|
-
that will hydrate the local object with metadata from Modal servers.
|
|
870
|
-
|
|
871
|
-
```python notest
|
|
872
|
-
Model = modal.Cls.from_name("other-app", "Model")
|
|
873
|
-
model = Model()
|
|
874
|
-
model.inference(...)
|
|
875
|
-
```
|
|
876
|
-
"""
|
|
877
|
-
deprecation_warning(
|
|
878
|
-
(2025, 1, 27),
|
|
879
|
-
"`modal.Cls.lookup` is deprecated and will be removed in a future release."
|
|
880
|
-
" It can be replaced with `modal.Cls.from_name`."
|
|
881
|
-
"\n\nSee https://modal.com/docs/guide/modal-1-0-migration for more information.",
|
|
882
|
-
)
|
|
883
|
-
warn_if_passing_namespace(namespace, "modal.Cls.lookup")
|
|
884
|
-
obj = _Cls.from_name(
|
|
885
|
-
app_name,
|
|
886
|
-
name,
|
|
887
|
-
environment_name=environment_name,
|
|
888
|
-
)
|
|
889
|
-
if client is None:
|
|
890
|
-
client = await _Client.from_env()
|
|
891
|
-
resolver = Resolver(client=client)
|
|
892
|
-
await resolver.load(obj)
|
|
893
|
-
return obj
|
|
894
|
-
|
|
895
854
|
@synchronizer.no_input_translation
|
|
896
855
|
def __call__(self, *args, **kwargs) -> _Obj:
|
|
897
856
|
"""This acts as the class constructor."""
|
modal/cls.pyi
CHANGED
|
@@ -5,7 +5,6 @@ import modal._functions
|
|
|
5
5
|
import modal._object
|
|
6
6
|
import modal._partial_function
|
|
7
7
|
import modal.app
|
|
8
|
-
import modal.client
|
|
9
8
|
import modal.cloud_bucket_mount
|
|
10
9
|
import modal.functions
|
|
11
10
|
import modal.gpu
|
|
@@ -471,30 +470,6 @@ class _Cls(modal._object._Object):
|
|
|
471
470
|
"""
|
|
472
471
|
...
|
|
473
472
|
|
|
474
|
-
@staticmethod
|
|
475
|
-
async def lookup(
|
|
476
|
-
app_name: str,
|
|
477
|
-
name: str,
|
|
478
|
-
namespace=None,
|
|
479
|
-
client: typing.Optional[modal.client._Client] = None,
|
|
480
|
-
environment_name: typing.Optional[str] = None,
|
|
481
|
-
) -> _Cls:
|
|
482
|
-
"""mdmd:hidden
|
|
483
|
-
Lookup a Cls from a deployed App by its name.
|
|
484
|
-
|
|
485
|
-
DEPRECATED: This method is deprecated in favor of `modal.Cls.from_name`.
|
|
486
|
-
|
|
487
|
-
In contrast to `modal.Cls.from_name`, this is an eager method
|
|
488
|
-
that will hydrate the local object with metadata from Modal servers.
|
|
489
|
-
|
|
490
|
-
```python notest
|
|
491
|
-
Model = modal.Cls.from_name("other-app", "Model")
|
|
492
|
-
model = Model()
|
|
493
|
-
model.inference(...)
|
|
494
|
-
```
|
|
495
|
-
"""
|
|
496
|
-
...
|
|
497
|
-
|
|
498
473
|
def __call__(self, *args, **kwargs) -> _Obj:
|
|
499
474
|
"""This acts as the class constructor."""
|
|
500
475
|
...
|
|
@@ -653,59 +628,6 @@ class Cls(modal.object.Object):
|
|
|
653
628
|
"""
|
|
654
629
|
...
|
|
655
630
|
|
|
656
|
-
class __lookup_spec(typing_extensions.Protocol):
|
|
657
|
-
def __call__(
|
|
658
|
-
self,
|
|
659
|
-
/,
|
|
660
|
-
app_name: str,
|
|
661
|
-
name: str,
|
|
662
|
-
namespace=None,
|
|
663
|
-
client: typing.Optional[modal.client.Client] = None,
|
|
664
|
-
environment_name: typing.Optional[str] = None,
|
|
665
|
-
) -> Cls:
|
|
666
|
-
"""mdmd:hidden
|
|
667
|
-
Lookup a Cls from a deployed App by its name.
|
|
668
|
-
|
|
669
|
-
DEPRECATED: This method is deprecated in favor of `modal.Cls.from_name`.
|
|
670
|
-
|
|
671
|
-
In contrast to `modal.Cls.from_name`, this is an eager method
|
|
672
|
-
that will hydrate the local object with metadata from Modal servers.
|
|
673
|
-
|
|
674
|
-
```python notest
|
|
675
|
-
Model = modal.Cls.from_name("other-app", "Model")
|
|
676
|
-
model = Model()
|
|
677
|
-
model.inference(...)
|
|
678
|
-
```
|
|
679
|
-
"""
|
|
680
|
-
...
|
|
681
|
-
|
|
682
|
-
async def aio(
|
|
683
|
-
self,
|
|
684
|
-
/,
|
|
685
|
-
app_name: str,
|
|
686
|
-
name: str,
|
|
687
|
-
namespace=None,
|
|
688
|
-
client: typing.Optional[modal.client.Client] = None,
|
|
689
|
-
environment_name: typing.Optional[str] = None,
|
|
690
|
-
) -> Cls:
|
|
691
|
-
"""mdmd:hidden
|
|
692
|
-
Lookup a Cls from a deployed App by its name.
|
|
693
|
-
|
|
694
|
-
DEPRECATED: This method is deprecated in favor of `modal.Cls.from_name`.
|
|
695
|
-
|
|
696
|
-
In contrast to `modal.Cls.from_name`, this is an eager method
|
|
697
|
-
that will hydrate the local object with metadata from Modal servers.
|
|
698
|
-
|
|
699
|
-
```python notest
|
|
700
|
-
Model = modal.Cls.from_name("other-app", "Model")
|
|
701
|
-
model = Model()
|
|
702
|
-
model.inference(...)
|
|
703
|
-
```
|
|
704
|
-
"""
|
|
705
|
-
...
|
|
706
|
-
|
|
707
|
-
lookup: __lookup_spec
|
|
708
|
-
|
|
709
631
|
def __call__(self, *args, **kwargs) -> Obj:
|
|
710
632
|
"""This acts as the class constructor."""
|
|
711
633
|
...
|
modal/dict.py
CHANGED
|
@@ -383,47 +383,6 @@ class _Dict(_Object, type_prefix="di"):
|
|
|
383
383
|
rep = _Dict._repr(name, environment_name)
|
|
384
384
|
return _Dict._from_loader(_load, rep, is_another_app=True, hydrate_lazily=True, name=name)
|
|
385
385
|
|
|
386
|
-
@staticmethod
|
|
387
|
-
async def lookup(
|
|
388
|
-
name: str,
|
|
389
|
-
data: Optional[dict] = None,
|
|
390
|
-
namespace=None, # mdmd:line-hidden
|
|
391
|
-
client: Optional[_Client] = None,
|
|
392
|
-
environment_name: Optional[str] = None,
|
|
393
|
-
create_if_missing: bool = False,
|
|
394
|
-
) -> "_Dict":
|
|
395
|
-
"""mdmd:hidden
|
|
396
|
-
Lookup a named Dict.
|
|
397
|
-
|
|
398
|
-
DEPRECATED: This method is deprecated in favor of `modal.Dict.from_name`.
|
|
399
|
-
|
|
400
|
-
In contrast to `modal.Dict.from_name`, this is an eager method
|
|
401
|
-
that will hydrate the local object with metadata from Modal servers.
|
|
402
|
-
|
|
403
|
-
```python
|
|
404
|
-
d = modal.Dict.from_name("my-dict")
|
|
405
|
-
d["xyz"] = 123
|
|
406
|
-
```
|
|
407
|
-
"""
|
|
408
|
-
deprecation_warning(
|
|
409
|
-
(2025, 1, 27),
|
|
410
|
-
"`modal.Dict.lookup` is deprecated and will be removed in a future release."
|
|
411
|
-
" It can be replaced with `modal.Dict.from_name`."
|
|
412
|
-
"\n\nSee https://modal.com/docs/guide/modal-1-0-migration for more information.",
|
|
413
|
-
)
|
|
414
|
-
warn_if_passing_namespace(namespace, "modal.Dict.lookup")
|
|
415
|
-
obj = _Dict.from_name(
|
|
416
|
-
name,
|
|
417
|
-
data=data,
|
|
418
|
-
environment_name=environment_name,
|
|
419
|
-
create_if_missing=create_if_missing,
|
|
420
|
-
)
|
|
421
|
-
if client is None:
|
|
422
|
-
client = await _Client.from_env()
|
|
423
|
-
resolver = Resolver(client=client)
|
|
424
|
-
await resolver.load(obj)
|
|
425
|
-
return obj
|
|
426
|
-
|
|
427
386
|
@staticmethod
|
|
428
387
|
async def delete(
|
|
429
388
|
name: str,
|
modal/dict.pyi
CHANGED
|
@@ -462,30 +462,6 @@ class _Dict(modal._object._Object):
|
|
|
462
462
|
"""
|
|
463
463
|
...
|
|
464
464
|
|
|
465
|
-
@staticmethod
|
|
466
|
-
async def lookup(
|
|
467
|
-
name: str,
|
|
468
|
-
data: typing.Optional[dict] = None,
|
|
469
|
-
namespace=None,
|
|
470
|
-
client: typing.Optional[modal.client._Client] = None,
|
|
471
|
-
environment_name: typing.Optional[str] = None,
|
|
472
|
-
create_if_missing: bool = False,
|
|
473
|
-
) -> _Dict:
|
|
474
|
-
"""mdmd:hidden
|
|
475
|
-
Lookup a named Dict.
|
|
476
|
-
|
|
477
|
-
DEPRECATED: This method is deprecated in favor of `modal.Dict.from_name`.
|
|
478
|
-
|
|
479
|
-
In contrast to `modal.Dict.from_name`, this is an eager method
|
|
480
|
-
that will hydrate the local object with metadata from Modal servers.
|
|
481
|
-
|
|
482
|
-
```python
|
|
483
|
-
d = modal.Dict.from_name("my-dict")
|
|
484
|
-
d["xyz"] = 123
|
|
485
|
-
```
|
|
486
|
-
"""
|
|
487
|
-
...
|
|
488
|
-
|
|
489
465
|
@staticmethod
|
|
490
466
|
async def delete(
|
|
491
467
|
name: str,
|
|
@@ -704,59 +680,6 @@ class Dict(modal.object.Object):
|
|
|
704
680
|
"""
|
|
705
681
|
...
|
|
706
682
|
|
|
707
|
-
class __lookup_spec(typing_extensions.Protocol):
|
|
708
|
-
def __call__(
|
|
709
|
-
self,
|
|
710
|
-
/,
|
|
711
|
-
name: str,
|
|
712
|
-
data: typing.Optional[dict] = None,
|
|
713
|
-
namespace=None,
|
|
714
|
-
client: typing.Optional[modal.client.Client] = None,
|
|
715
|
-
environment_name: typing.Optional[str] = None,
|
|
716
|
-
create_if_missing: bool = False,
|
|
717
|
-
) -> Dict:
|
|
718
|
-
"""mdmd:hidden
|
|
719
|
-
Lookup a named Dict.
|
|
720
|
-
|
|
721
|
-
DEPRECATED: This method is deprecated in favor of `modal.Dict.from_name`.
|
|
722
|
-
|
|
723
|
-
In contrast to `modal.Dict.from_name`, this is an eager method
|
|
724
|
-
that will hydrate the local object with metadata from Modal servers.
|
|
725
|
-
|
|
726
|
-
```python
|
|
727
|
-
d = modal.Dict.from_name("my-dict")
|
|
728
|
-
d["xyz"] = 123
|
|
729
|
-
```
|
|
730
|
-
"""
|
|
731
|
-
...
|
|
732
|
-
|
|
733
|
-
async def aio(
|
|
734
|
-
self,
|
|
735
|
-
/,
|
|
736
|
-
name: str,
|
|
737
|
-
data: typing.Optional[dict] = None,
|
|
738
|
-
namespace=None,
|
|
739
|
-
client: typing.Optional[modal.client.Client] = None,
|
|
740
|
-
environment_name: typing.Optional[str] = None,
|
|
741
|
-
create_if_missing: bool = False,
|
|
742
|
-
) -> Dict:
|
|
743
|
-
"""mdmd:hidden
|
|
744
|
-
Lookup a named Dict.
|
|
745
|
-
|
|
746
|
-
DEPRECATED: This method is deprecated in favor of `modal.Dict.from_name`.
|
|
747
|
-
|
|
748
|
-
In contrast to `modal.Dict.from_name`, this is an eager method
|
|
749
|
-
that will hydrate the local object with metadata from Modal servers.
|
|
750
|
-
|
|
751
|
-
```python
|
|
752
|
-
d = modal.Dict.from_name("my-dict")
|
|
753
|
-
d["xyz"] = 123
|
|
754
|
-
```
|
|
755
|
-
"""
|
|
756
|
-
...
|
|
757
|
-
|
|
758
|
-
lookup: __lookup_spec
|
|
759
|
-
|
|
760
683
|
class __delete_spec(typing_extensions.Protocol):
|
|
761
684
|
def __call__(
|
|
762
685
|
self,
|
modal/environments.py
CHANGED
|
@@ -11,7 +11,6 @@ from modal_proto import api_pb2
|
|
|
11
11
|
from ._object import _Object
|
|
12
12
|
from ._resolver import Resolver
|
|
13
13
|
from ._utils.async_utils import synchronize_api, synchronizer
|
|
14
|
-
from ._utils.deprecation import deprecation_warning
|
|
15
14
|
from ._utils.grpc_utils import retry_transient_errors
|
|
16
15
|
from ._utils.name_utils import check_object_name
|
|
17
16
|
from .client import _Client
|
|
@@ -79,25 +78,6 @@ class _Environment(_Object, type_prefix="en"):
|
|
|
79
78
|
# TODO environment name (and id?) in the repr? (We should make reprs consistently more useful)
|
|
80
79
|
return _Environment._from_loader(_load, "Environment()", is_another_app=True, hydrate_lazily=True)
|
|
81
80
|
|
|
82
|
-
@staticmethod
|
|
83
|
-
async def lookup(
|
|
84
|
-
name: str,
|
|
85
|
-
client: Optional[_Client] = None,
|
|
86
|
-
create_if_missing: bool = False,
|
|
87
|
-
):
|
|
88
|
-
deprecation_warning(
|
|
89
|
-
(2025, 1, 27),
|
|
90
|
-
"`modal.Environment.lookup` is deprecated and will be removed in a future release."
|
|
91
|
-
" It can be replaced with `modal.Environment.from_name`."
|
|
92
|
-
"\n\nSee https://modal.com/docs/guide/modal-1-0-migration for more information.",
|
|
93
|
-
)
|
|
94
|
-
obj = _Environment.from_name(name, create_if_missing=create_if_missing)
|
|
95
|
-
if client is None:
|
|
96
|
-
client = await _Client.from_env()
|
|
97
|
-
resolver = Resolver(client=client)
|
|
98
|
-
await resolver.load(obj)
|
|
99
|
-
return obj
|
|
100
|
-
|
|
101
81
|
|
|
102
82
|
Environment = synchronize_api(_Environment)
|
|
103
83
|
|
modal/environments.pyi
CHANGED
|
@@ -46,10 +46,6 @@ class _Environment(modal._object._Object):
|
|
|
46
46
|
def _hydrate_metadata(self, metadata: google.protobuf.message.Message): ...
|
|
47
47
|
@staticmethod
|
|
48
48
|
def from_name(name: str, *, create_if_missing: bool = False): ...
|
|
49
|
-
@staticmethod
|
|
50
|
-
async def lookup(
|
|
51
|
-
name: str, client: typing.Optional[modal.client._Client] = None, create_if_missing: bool = False
|
|
52
|
-
): ...
|
|
53
49
|
|
|
54
50
|
class Environment(modal.object.Object):
|
|
55
51
|
_settings: EnvironmentSettings
|
|
@@ -62,16 +58,6 @@ class Environment(modal.object.Object):
|
|
|
62
58
|
@staticmethod
|
|
63
59
|
def from_name(name: str, *, create_if_missing: bool = False): ...
|
|
64
60
|
|
|
65
|
-
class __lookup_spec(typing_extensions.Protocol):
|
|
66
|
-
def __call__(
|
|
67
|
-
self, /, name: str, client: typing.Optional[modal.client.Client] = None, create_if_missing: bool = False
|
|
68
|
-
): ...
|
|
69
|
-
async def aio(
|
|
70
|
-
self, /, name: str, client: typing.Optional[modal.client.Client] = None, create_if_missing: bool = False
|
|
71
|
-
): ...
|
|
72
|
-
|
|
73
|
-
lookup: __lookup_spec
|
|
74
|
-
|
|
75
61
|
async def _get_environment_cached(name: str, client: modal.client._Client) -> _Environment: ...
|
|
76
62
|
|
|
77
63
|
class __delete_environment_spec(typing_extensions.Protocol):
|
modal/functions.pyi
CHANGED
|
@@ -262,55 +262,6 @@ class Function(
|
|
|
262
262
|
"""
|
|
263
263
|
...
|
|
264
264
|
|
|
265
|
-
class __lookup_spec(typing_extensions.Protocol):
|
|
266
|
-
def __call__(
|
|
267
|
-
self,
|
|
268
|
-
/,
|
|
269
|
-
app_name: str,
|
|
270
|
-
name: str,
|
|
271
|
-
namespace=None,
|
|
272
|
-
client: typing.Optional[modal.client.Client] = None,
|
|
273
|
-
environment_name: typing.Optional[str] = None,
|
|
274
|
-
) -> Function:
|
|
275
|
-
"""mdmd:hidden
|
|
276
|
-
Lookup a Function from a deployed App by its name.
|
|
277
|
-
|
|
278
|
-
DEPRECATED: This method is deprecated in favor of `modal.Function.from_name`.
|
|
279
|
-
|
|
280
|
-
In contrast to `modal.Function.from_name`, this is an eager method
|
|
281
|
-
that will hydrate the local object with metadata from Modal servers.
|
|
282
|
-
|
|
283
|
-
```python notest
|
|
284
|
-
f = modal.Function.lookup("other-app", "function")
|
|
285
|
-
```
|
|
286
|
-
"""
|
|
287
|
-
...
|
|
288
|
-
|
|
289
|
-
async def aio(
|
|
290
|
-
self,
|
|
291
|
-
/,
|
|
292
|
-
app_name: str,
|
|
293
|
-
name: str,
|
|
294
|
-
namespace=None,
|
|
295
|
-
client: typing.Optional[modal.client.Client] = None,
|
|
296
|
-
environment_name: typing.Optional[str] = None,
|
|
297
|
-
) -> Function:
|
|
298
|
-
"""mdmd:hidden
|
|
299
|
-
Lookup a Function from a deployed App by its name.
|
|
300
|
-
|
|
301
|
-
DEPRECATED: This method is deprecated in favor of `modal.Function.from_name`.
|
|
302
|
-
|
|
303
|
-
In contrast to `modal.Function.from_name`, this is an eager method
|
|
304
|
-
that will hydrate the local object with metadata from Modal servers.
|
|
305
|
-
|
|
306
|
-
```python notest
|
|
307
|
-
f = modal.Function.lookup("other-app", "function")
|
|
308
|
-
```
|
|
309
|
-
"""
|
|
310
|
-
...
|
|
311
|
-
|
|
312
|
-
lookup: __lookup_spec
|
|
313
|
-
|
|
314
265
|
@property
|
|
315
266
|
def tag(self) -> str:
|
|
316
267
|
"""mdmd:hidden"""
|
|
@@ -450,7 +401,7 @@ class Function(
|
|
|
450
401
|
|
|
451
402
|
_call_generator: ___call_generator_spec[typing_extensions.Self]
|
|
452
403
|
|
|
453
|
-
class __remote_spec(typing_extensions.Protocol[
|
|
404
|
+
class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
|
|
454
405
|
def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
|
|
455
406
|
"""Calls the function remotely, executing it with the given arguments and returning the execution's result."""
|
|
456
407
|
...
|
|
@@ -459,7 +410,7 @@ class Function(
|
|
|
459
410
|
"""Calls the function remotely, executing it with the given arguments and returning the execution's result."""
|
|
460
411
|
...
|
|
461
412
|
|
|
462
|
-
remote: __remote_spec[modal._functions.
|
|
413
|
+
remote: __remote_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
|
|
463
414
|
|
|
464
415
|
class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
465
416
|
def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
|
|
@@ -486,7 +437,7 @@ class Function(
|
|
|
486
437
|
"""
|
|
487
438
|
...
|
|
488
439
|
|
|
489
|
-
class ___experimental_spawn_spec(typing_extensions.Protocol[
|
|
440
|
+
class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
|
|
490
441
|
def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
|
|
491
442
|
"""[Experimental] Calls the function with the given arguments, without waiting for the results.
|
|
492
443
|
|
|
@@ -510,7 +461,7 @@ class Function(
|
|
|
510
461
|
...
|
|
511
462
|
|
|
512
463
|
_experimental_spawn: ___experimental_spawn_spec[
|
|
513
|
-
modal._functions.
|
|
464
|
+
modal._functions.P, modal._functions.ReturnType, typing_extensions.Self
|
|
514
465
|
]
|
|
515
466
|
|
|
516
467
|
class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER, SUPERSELF]):
|
|
@@ -519,7 +470,7 @@ class Function(
|
|
|
519
470
|
|
|
520
471
|
_spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P, typing_extensions.Self]
|
|
521
472
|
|
|
522
|
-
class __spawn_spec(typing_extensions.Protocol[
|
|
473
|
+
class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
|
|
523
474
|
def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
|
|
524
475
|
"""Calls the function with the given arguments, without waiting for the results.
|
|
525
476
|
|
|
@@ -540,7 +491,7 @@ class Function(
|
|
|
540
491
|
"""
|
|
541
492
|
...
|
|
542
493
|
|
|
543
|
-
spawn: __spawn_spec[modal._functions.
|
|
494
|
+
spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
|
|
544
495
|
|
|
545
496
|
def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
|
|
546
497
|
"""Return the inner Python object wrapped by this Modal Function."""
|
modal/image.py
CHANGED
|
@@ -33,7 +33,6 @@ from ._resolver import Resolver
|
|
|
33
33
|
from ._serialization import get_preferred_payload_format, serialize
|
|
34
34
|
from ._utils.async_utils import synchronize_api
|
|
35
35
|
from ._utils.blob_utils import MAX_OBJECT_SIZE_BYTES
|
|
36
|
-
from ._utils.deprecation import deprecation_warning
|
|
37
36
|
from ._utils.docker_utils import (
|
|
38
37
|
extract_copy_command_patterns,
|
|
39
38
|
find_dockerignore_file,
|
|
@@ -284,24 +283,12 @@ def _create_context_mount_function(
|
|
|
284
283
|
ignore: Union[Sequence[str], Callable[[Path], bool], _AutoDockerIgnoreSentinel],
|
|
285
284
|
dockerfile_cmds: list[str] = [],
|
|
286
285
|
dockerfile_path: Optional[Path] = None,
|
|
287
|
-
context_mount: Optional[_Mount] = None,
|
|
288
286
|
context_dir: Optional[Union[Path, str]] = None,
|
|
289
287
|
):
|
|
290
288
|
if dockerfile_path and dockerfile_cmds:
|
|
291
289
|
raise InvalidError("Cannot provide both dockerfile and docker commands")
|
|
292
290
|
|
|
293
|
-
if
|
|
294
|
-
if ignore is not AUTO_DOCKERIGNORE:
|
|
295
|
-
raise InvalidError("Cannot set both `context_mount` and `ignore`")
|
|
296
|
-
if context_dir is not None:
|
|
297
|
-
raise InvalidError("Cannot set both `context_mount` and `context_dir`")
|
|
298
|
-
|
|
299
|
-
def identity_context_mount_fn() -> Optional[_Mount]:
|
|
300
|
-
return context_mount
|
|
301
|
-
|
|
302
|
-
return identity_context_mount_fn
|
|
303
|
-
|
|
304
|
-
elif ignore is AUTO_DOCKERIGNORE:
|
|
291
|
+
if ignore is AUTO_DOCKERIGNORE:
|
|
305
292
|
|
|
306
293
|
def auto_created_context_mount_fn() -> Optional[_Mount]:
|
|
307
294
|
nonlocal context_dir
|
|
@@ -1596,7 +1583,6 @@ class _Image(_Object, type_prefix="im"):
|
|
|
1596
1583
|
env: Optional[dict[str, Optional[str]]] = None,
|
|
1597
1584
|
secrets: Optional[Collection[_Secret]] = None,
|
|
1598
1585
|
gpu: GPU_T = None,
|
|
1599
|
-
context_mount: Optional[_Mount] = None, # Deprecated: the context is now inferred
|
|
1600
1586
|
context_dir: Optional[Union[Path, str]] = None, # Context for relative COPY commands
|
|
1601
1587
|
force_build: bool = False, # Ignore cached builds, similar to 'docker build --no-cache'
|
|
1602
1588
|
ignore: Union[Sequence[str], Callable[[Path], bool]] = AUTO_DOCKERIGNORE,
|
|
@@ -1642,12 +1628,6 @@ class _Image(_Object, type_prefix="im"):
|
|
|
1642
1628
|
)
|
|
1643
1629
|
```
|
|
1644
1630
|
"""
|
|
1645
|
-
if context_mount is not None:
|
|
1646
|
-
deprecation_warning(
|
|
1647
|
-
(2025, 1, 13),
|
|
1648
|
-
"The `context_mount` parameter of `Image.dockerfile_commands` is deprecated."
|
|
1649
|
-
" Files are now automatically added to the build context based on the commands.",
|
|
1650
|
-
)
|
|
1651
1631
|
cmds = _flatten_str_args("dockerfile_commands", "dockerfile_commands", dockerfile_commands)
|
|
1652
1632
|
if not cmds:
|
|
1653
1633
|
return self
|
|
@@ -1665,7 +1645,7 @@ class _Image(_Object, type_prefix="im"):
|
|
|
1665
1645
|
secrets=secrets,
|
|
1666
1646
|
gpu_config=parse_gpu_config(gpu),
|
|
1667
1647
|
context_mount_function=_create_context_mount_function(
|
|
1668
|
-
ignore=ignore, dockerfile_cmds=cmds,
|
|
1648
|
+
ignore=ignore, dockerfile_cmds=cmds, context_dir=context_dir
|
|
1669
1649
|
),
|
|
1670
1650
|
force_build=self.force_build or force_build,
|
|
1671
1651
|
)
|
|
@@ -2022,7 +2002,6 @@ class _Image(_Object, type_prefix="im"):
|
|
|
2022
2002
|
def from_dockerfile(
|
|
2023
2003
|
path: Union[str, Path], # Filepath to Dockerfile.
|
|
2024
2004
|
*,
|
|
2025
|
-
context_mount: Optional[_Mount] = None, # Deprecated: the context is now inferred
|
|
2026
2005
|
force_build: bool = False, # Ignore cached builds, similar to 'docker build --no-cache'
|
|
2027
2006
|
context_dir: Optional[Union[Path, str]] = None, # Context for relative COPY commands
|
|
2028
2007
|
env: Optional[dict[str, Optional[str]]] = None,
|
|
@@ -2086,13 +2065,6 @@ class _Image(_Object, type_prefix="im"):
|
|
|
2086
2065
|
if env:
|
|
2087
2066
|
secrets = [*secrets, _Secret.from_dict(env)]
|
|
2088
2067
|
|
|
2089
|
-
if context_mount is not None:
|
|
2090
|
-
deprecation_warning(
|
|
2091
|
-
(2025, 1, 13),
|
|
2092
|
-
"The `context_mount` parameter of `Image.from_dockerfile` is deprecated."
|
|
2093
|
-
" Files are now automatically added to the build context based on the commands in the Dockerfile.",
|
|
2094
|
-
)
|
|
2095
|
-
|
|
2096
2068
|
# --- Build the base dockerfile
|
|
2097
2069
|
|
|
2098
2070
|
def build_dockerfile_base(version: ImageBuilderVersion) -> DockerfileSpec:
|
|
@@ -2104,7 +2076,7 @@ class _Image(_Object, type_prefix="im"):
|
|
|
2104
2076
|
base_image = _Image._from_args(
|
|
2105
2077
|
dockerfile_function=build_dockerfile_base,
|
|
2106
2078
|
context_mount_function=_create_context_mount_function(
|
|
2107
|
-
ignore=ignore, dockerfile_path=Path(path),
|
|
2079
|
+
ignore=ignore, dockerfile_path=Path(path), context_dir=context_dir
|
|
2108
2080
|
),
|
|
2109
2081
|
gpu_config=gpu_config,
|
|
2110
2082
|
secrets=secrets,
|
modal/image.pyi
CHANGED
|
@@ -91,7 +91,6 @@ def _create_context_mount_function(
|
|
|
91
91
|
],
|
|
92
92
|
dockerfile_cmds: list[str] = [],
|
|
93
93
|
dockerfile_path: typing.Optional[pathlib.Path] = None,
|
|
94
|
-
context_mount: typing.Optional[modal.mount._Mount] = None,
|
|
95
94
|
context_dir: typing.Union[str, pathlib.Path, None] = None,
|
|
96
95
|
): ...
|
|
97
96
|
|
|
@@ -599,7 +598,6 @@ class _Image(modal._object._Object):
|
|
|
599
598
|
env: typing.Optional[dict[str, typing.Optional[str]]] = None,
|
|
600
599
|
secrets: typing.Optional[collections.abc.Collection[modal.secret._Secret]] = None,
|
|
601
600
|
gpu: typing.Union[None, str, modal.gpu._GPUConfig] = None,
|
|
602
|
-
context_mount: typing.Optional[modal.mount._Mount] = None,
|
|
603
601
|
context_dir: typing.Union[str, pathlib.Path, None] = None,
|
|
604
602
|
force_build: bool = False,
|
|
605
603
|
ignore: typing.Union[
|
|
@@ -817,7 +815,6 @@ class _Image(modal._object._Object):
|
|
|
817
815
|
def from_dockerfile(
|
|
818
816
|
path: typing.Union[str, pathlib.Path],
|
|
819
817
|
*,
|
|
820
|
-
context_mount: typing.Optional[modal.mount._Mount] = None,
|
|
821
818
|
force_build: bool = False,
|
|
822
819
|
context_dir: typing.Union[str, pathlib.Path, None] = None,
|
|
823
820
|
env: typing.Optional[dict[str, typing.Optional[str]]] = None,
|
|
@@ -1572,7 +1569,6 @@ class Image(modal.object.Object):
|
|
|
1572
1569
|
env: typing.Optional[dict[str, typing.Optional[str]]] = None,
|
|
1573
1570
|
secrets: typing.Optional[collections.abc.Collection[modal.secret.Secret]] = None,
|
|
1574
1571
|
gpu: typing.Union[None, str, modal.gpu._GPUConfig] = None,
|
|
1575
|
-
context_mount: typing.Optional[modal.mount.Mount] = None,
|
|
1576
1572
|
context_dir: typing.Union[str, pathlib.Path, None] = None,
|
|
1577
1573
|
force_build: bool = False,
|
|
1578
1574
|
ignore: typing.Union[
|
|
@@ -1790,7 +1786,6 @@ class Image(modal.object.Object):
|
|
|
1790
1786
|
def from_dockerfile(
|
|
1791
1787
|
path: typing.Union[str, pathlib.Path],
|
|
1792
1788
|
*,
|
|
1793
|
-
context_mount: typing.Optional[modal.mount.Mount] = None,
|
|
1794
1789
|
force_build: bool = False,
|
|
1795
1790
|
context_dir: typing.Union[str, pathlib.Path, None] = None,
|
|
1796
1791
|
env: typing.Optional[dict[str, typing.Optional[str]]] = None,
|