fal 1.7.7__py3-none-any.whl → 1.8.1__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 fal might be problematic. Click here for more details.
- fal/_fal_version.py +2 -2
- fal/api.py +2 -0
- fal/container.py +38 -8
- fal/toolkit/utils/download_utils.py +5 -1
- {fal-1.7.7.dist-info → fal-1.8.1.dist-info}/METADATA +1 -1
- {fal-1.7.7.dist-info → fal-1.8.1.dist-info}/RECORD +9 -9
- {fal-1.7.7.dist-info → fal-1.8.1.dist-info}/WHEEL +0 -0
- {fal-1.7.7.dist-info → fal-1.8.1.dist-info}/entry_points.txt +0 -0
- {fal-1.7.7.dist-info → fal-1.8.1.dist-info}/top_level.txt +0 -0
fal/_fal_version.py
CHANGED
fal/api.py
CHANGED
|
@@ -142,6 +142,8 @@ class Host(Generic[ArgsT, ReturnT]):
|
|
|
142
142
|
# Conda environment definition should be parsed before sending to serverless
|
|
143
143
|
with open(value) as f:
|
|
144
144
|
return "env_dict", yaml.safe_load(f)
|
|
145
|
+
elif key == "image" and isinstance(value, ContainerImage):
|
|
146
|
+
return "image", value.to_dict()
|
|
145
147
|
else:
|
|
146
148
|
return key, value
|
|
147
149
|
|
fal/container.py
CHANGED
|
@@ -1,19 +1,49 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import Dict, Literal
|
|
3
|
+
|
|
4
|
+
Builder = Literal["depot", "service", "worker"]
|
|
5
|
+
BUILDERS = {"depot", "service", "worker"}
|
|
6
|
+
DEFAULT_BUILDER: Builder = "depot"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
1
10
|
class ContainerImage:
|
|
2
11
|
"""ContainerImage represents a Docker image that can be built
|
|
3
12
|
from a Dockerfile.
|
|
4
13
|
"""
|
|
5
14
|
|
|
6
|
-
|
|
15
|
+
dockerfile_str: str
|
|
16
|
+
build_args: Dict[str, str] = field(default_factory=dict)
|
|
17
|
+
registries: Dict[str, Dict[str, str]] = field(default_factory=dict)
|
|
18
|
+
builder: Builder = field(default=DEFAULT_BUILDER)
|
|
19
|
+
|
|
20
|
+
def __post_init__(self) -> None:
|
|
21
|
+
if self.registries:
|
|
22
|
+
for registry in self.registries.values():
|
|
23
|
+
keys = registry.keys()
|
|
24
|
+
if "username" not in keys or "password" not in keys:
|
|
25
|
+
raise ValueError(
|
|
26
|
+
"Username and password are required for each registry"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
if self.builder not in BUILDERS:
|
|
30
|
+
raise ValueError(
|
|
31
|
+
f"Invalid builder: {self.builder}, must be one of {BUILDERS}"
|
|
32
|
+
)
|
|
7
33
|
|
|
8
34
|
@classmethod
|
|
9
|
-
def from_dockerfile_str(cls, text: str, **kwargs):
|
|
10
|
-
|
|
11
|
-
return dict(
|
|
12
|
-
dockerfile_str=text,
|
|
13
|
-
**{k: v for k, v in kwargs.items() if k in cls._known_keys},
|
|
14
|
-
)
|
|
35
|
+
def from_dockerfile_str(cls, text: str, **kwargs) -> "ContainerImage":
|
|
36
|
+
return cls(dockerfile_str=text, **kwargs)
|
|
15
37
|
|
|
16
38
|
@classmethod
|
|
17
|
-
def from_dockerfile(cls, path: str, **kwargs):
|
|
39
|
+
def from_dockerfile(cls, path: str, **kwargs) -> "ContainerImage":
|
|
18
40
|
with open(path) as fobj:
|
|
19
41
|
return cls.from_dockerfile_str(fobj.read(), **kwargs)
|
|
42
|
+
|
|
43
|
+
def to_dict(self) -> dict:
|
|
44
|
+
return {
|
|
45
|
+
"dockerfile_str": self.dockerfile_str,
|
|
46
|
+
"build_args": self.build_args,
|
|
47
|
+
"registries": self.registries,
|
|
48
|
+
"builder": self.builder,
|
|
49
|
+
}
|
|
@@ -416,7 +416,11 @@ def clone_repository(
|
|
|
416
416
|
f"Forcing re-download."
|
|
417
417
|
)
|
|
418
418
|
print(f"Removing the existing repository: {local_repo_path} ")
|
|
419
|
-
|
|
419
|
+
with TemporaryDirectory(
|
|
420
|
+
dir=target_dir, suffix=f"{local_repo_path.name}.tmp.old"
|
|
421
|
+
) as tmp_dir:
|
|
422
|
+
os.rename(local_repo_path, tmp_dir)
|
|
423
|
+
shutil.rmtree(tmp_dir)
|
|
420
424
|
|
|
421
425
|
# NOTE: using the target_dir to be able to avoid potential copies across temp fs
|
|
422
426
|
# and target fs, and also to be able to atomically rename repo_name dir into place
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
fal/__init__.py,sha256=wXs1G0gSc7ZK60-bHe-B2m0l_sA6TrFk4BxY0tMoLe8,784
|
|
2
2
|
fal/__main__.py,sha256=4JMK66Wj4uLZTKbF-sT3LAxOsr6buig77PmOkJCRRxw,83
|
|
3
|
-
fal/_fal_version.py,sha256=
|
|
3
|
+
fal/_fal_version.py,sha256=0CBOWvcgj3z82UQGmgPZNYucWtZfu-kClLlOblR1VJs,411
|
|
4
4
|
fal/_serialization.py,sha256=rD2YiSa8iuzCaZohZwN_MPEB-PpSKbWRDeaIDpTEjyY,7653
|
|
5
5
|
fal/_version.py,sha256=EBGqrknaf1WygENX-H4fBefLvHryvJBBGtVJetaB0NY,266
|
|
6
|
-
fal/api.py,sha256=
|
|
6
|
+
fal/api.py,sha256=TJNuez-xjzHfIAA7ZLmEMksdB3U5EM7bl16ooRL_1Ak,43499
|
|
7
7
|
fal/app.py,sha256=0cm7wZXdusZXyV9nJmlFJl-7Jgxir6954OaO9Lj2ITk,23178
|
|
8
8
|
fal/apps.py,sha256=RpmElElJnDYjsTRQOdNYiJwd74GEOGYA38L5O5GzNEg,11068
|
|
9
9
|
fal/config.py,sha256=hgI3kW4_2NoFsrYEiPss0mnDTr8_Td2z0pVgm93wi9o,600
|
|
10
|
-
fal/container.py,sha256=
|
|
10
|
+
fal/container.py,sha256=9XslBET-NCG2V3-Wmof8c7eHrRoxCye88Ym7CskqCk0,1639
|
|
11
11
|
fal/files.py,sha256=QgfYfMKmNobMPufrAP_ga1FKcIAlSbw18Iar1-0qepo,2650
|
|
12
12
|
fal/flags.py,sha256=oWN_eidSUOcE9wdPK_77si3A1fpgOC0UEERPsvNLIMc,842
|
|
13
13
|
fal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -65,7 +65,7 @@ fal/toolkit/image/nsfw_filter/inference.py,sha256=BhIPF_zxRLetThQYxDDF0sdx9VRwvu
|
|
|
65
65
|
fal/toolkit/image/nsfw_filter/model.py,sha256=63mu8D15z_IosoRUagRLGHy6VbLqFmrG-yZqnu2vVm4,457
|
|
66
66
|
fal/toolkit/image/nsfw_filter/requirements.txt,sha256=3Pmrd0Ny6QAeBqUNHCgffRyfaCARAPJcfSCX5cRYpbM,37
|
|
67
67
|
fal/toolkit/utils/__init__.py,sha256=CrmM9DyCz5-SmcTzRSm5RaLgxy3kf0ZsSEN9uhnX2Xo,97
|
|
68
|
-
fal/toolkit/utils/download_utils.py,sha256=
|
|
68
|
+
fal/toolkit/utils/download_utils.py,sha256=Ju-rvQ0oqFkARONRyrfIGVaqthjlxcFIb-qg5SE7yBw,18419
|
|
69
69
|
fal/toolkit/utils/retry.py,sha256=mHcQvvNIpu-Hi29P1HXSZuyvolRd48dMaJToqzlG0NY,1353
|
|
70
70
|
openapi_fal_rest/__init__.py,sha256=ziculmF_i6trw63LzZGFX-6W3Lwq9mCR8_UpkpvpaHI,152
|
|
71
71
|
openapi_fal_rest/client.py,sha256=G6BpJg9j7-JsrAUGddYwkzeWRYickBjPdcVgXoPzxuE,2817
|
|
@@ -130,8 +130,8 @@ openapi_fal_rest/models/workflow_node_type.py,sha256=-FzyeY2bxcNmizKbJI8joG7byRi
|
|
|
130
130
|
openapi_fal_rest/models/workflow_schema.py,sha256=4K5gsv9u9pxx2ItkffoyHeNjBBYf6ur5bN4m_zePZNY,2019
|
|
131
131
|
openapi_fal_rest/models/workflow_schema_input.py,sha256=2OkOXWHTNsCXHWS6EGDFzcJKkW5FIap-2gfO233EvZQ,1191
|
|
132
132
|
openapi_fal_rest/models/workflow_schema_output.py,sha256=EblwSPAGfWfYVWw_WSSaBzQVju296is9o28rMBAd0mc,1196
|
|
133
|
-
fal-1.
|
|
134
|
-
fal-1.
|
|
135
|
-
fal-1.
|
|
136
|
-
fal-1.
|
|
137
|
-
fal-1.
|
|
133
|
+
fal-1.8.1.dist-info/METADATA,sha256=bEcIv3BFgkvrKOhJA_AgmQQkIQmKBdQq9oumzE0kmDA,4002
|
|
134
|
+
fal-1.8.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
135
|
+
fal-1.8.1.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
|
|
136
|
+
fal-1.8.1.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
|
|
137
|
+
fal-1.8.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|