fal 1.21.1__py3-none-any.whl → 1.23.0__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.
- fal/_fal_version.py +2 -2
- fal/api.py +27 -3
- fal/container.py +2 -0
- fal/toolkit/utils/download_utils.py +13 -4
- {fal-1.21.1.dist-info → fal-1.23.0.dist-info}/METADATA +1 -1
- {fal-1.21.1.dist-info → fal-1.23.0.dist-info}/RECORD +9 -9
- {fal-1.21.1.dist-info → fal-1.23.0.dist-info}/WHEEL +0 -0
- {fal-1.21.1.dist-info → fal-1.23.0.dist-info}/entry_points.txt +0 -0
- {fal-1.21.1.dist-info → fal-1.23.0.dist-info}/top_level.txt +0 -0
fal/_fal_version.py
CHANGED
fal/api.py
CHANGED
|
@@ -33,6 +33,8 @@ import uvicorn
|
|
|
33
33
|
import yaml
|
|
34
34
|
from fastapi import FastAPI
|
|
35
35
|
from fastapi import __version__ as fastapi_version
|
|
36
|
+
from fastapi.encoders import jsonable_encoder
|
|
37
|
+
from fastapi.exceptions import RequestValidationError
|
|
36
38
|
from packaging.requirements import Requirement
|
|
37
39
|
from packaging.utils import canonicalize_name
|
|
38
40
|
from pydantic import __version__ as pydantic_version
|
|
@@ -613,8 +615,8 @@ class FalServerlessHost(Host):
|
|
|
613
615
|
def result_handler(partial_result):
|
|
614
616
|
ret.stream = partial_result.stream
|
|
615
617
|
for log in partial_result.logs:
|
|
616
|
-
if "
|
|
617
|
-
ret.url = log.message.rsplit()[-1]
|
|
618
|
+
if "And API access through" in log.message:
|
|
619
|
+
ret.url = log.message.rsplit()[-1].replace("queue.", "")
|
|
618
620
|
ret.logs.put(log)
|
|
619
621
|
|
|
620
622
|
self._thread_pool.submit(
|
|
@@ -954,7 +956,18 @@ def function( # type: ignore
|
|
|
954
956
|
def wrapper(func: Callable[ArgsT, ReturnT]):
|
|
955
957
|
include_modules_from(func)
|
|
956
958
|
|
|
957
|
-
|
|
959
|
+
if local_python_modules and not isinstance(local_python_modules, list):
|
|
960
|
+
raise ValueError(
|
|
961
|
+
"local_python_modules must be a list of module names as strings, got "
|
|
962
|
+
f"{repr(local_python_modules)}"
|
|
963
|
+
)
|
|
964
|
+
|
|
965
|
+
for idx, module_name in enumerate(local_python_modules or []):
|
|
966
|
+
if not isinstance(module_name, str):
|
|
967
|
+
raise ValueError(
|
|
968
|
+
"local_python_modules must be a list of module names as strings, "
|
|
969
|
+
f"got {repr(module_name)} at index {idx}"
|
|
970
|
+
)
|
|
958
971
|
include_module(module_name)
|
|
959
972
|
|
|
960
973
|
proxy = IsolatedFunction(
|
|
@@ -1092,6 +1105,17 @@ class BaseServable:
|
|
|
1092
1105
|
async def field_exception_handler(request: Request, exc: FieldException):
|
|
1093
1106
|
return JSONResponse(exc.to_pydantic_format(), exc.status_code)
|
|
1094
1107
|
|
|
1108
|
+
# ref: https://github.com/fastapi/fastapi/blob/37c8e7d76b4b47eb2c4cced6b4de59eb3d5f08eb/fastapi/exception_handlers.py#L20
|
|
1109
|
+
@_app.exception_handler(RequestValidationError)
|
|
1110
|
+
async def request_val_exception_handler(
|
|
1111
|
+
request: Request, exc: RequestValidationError
|
|
1112
|
+
):
|
|
1113
|
+
return JSONResponse(
|
|
1114
|
+
{"detail": jsonable_encoder(exc.errors())},
|
|
1115
|
+
422,
|
|
1116
|
+
headers={"x-fal-billable-units": "0"},
|
|
1117
|
+
)
|
|
1118
|
+
|
|
1095
1119
|
@_app.exception_handler(CUDAOutOfMemoryException)
|
|
1096
1120
|
async def cuda_out_of_memory_exception_handler(
|
|
1097
1121
|
request: Request, exc: CUDAOutOfMemoryException
|
fal/container.py
CHANGED
|
@@ -19,6 +19,7 @@ class ContainerImage:
|
|
|
19
19
|
builder: Optional[Builder] = field(default=None)
|
|
20
20
|
compression: str = DEFAULT_COMPRESSION
|
|
21
21
|
force_compression: bool = DEFAULT_FORCE_COMPRESSION
|
|
22
|
+
secrets: Dict[str, str] = field(default_factory=dict)
|
|
22
23
|
|
|
23
24
|
def __post_init__(self) -> None:
|
|
24
25
|
if self.registries:
|
|
@@ -51,4 +52,5 @@ class ContainerImage:
|
|
|
51
52
|
"builder": self.builder,
|
|
52
53
|
"compression": self.compression,
|
|
53
54
|
"force_compression": self.force_compression,
|
|
55
|
+
"secrets": self.secrets,
|
|
54
56
|
}
|
|
@@ -427,13 +427,22 @@ def clone_repository(
|
|
|
427
427
|
if repo_name is None:
|
|
428
428
|
repo_name = Path(https_url).stem
|
|
429
429
|
if commit_hash:
|
|
430
|
+
if len(commit_hash) < 8:
|
|
431
|
+
raise ValueError(f"Commit hash '{commit_hash}' is too short.")
|
|
430
432
|
repo_name += f"-{commit_hash[:8]}"
|
|
431
433
|
|
|
432
434
|
local_repo_path = Path(target_dir) / repo_name # type: ignore[arg-type]
|
|
433
435
|
|
|
434
436
|
if local_repo_path.exists():
|
|
435
|
-
local_repo_commit_hash =
|
|
436
|
-
|
|
437
|
+
local_repo_commit_hash = _git_rev_parse(local_repo_path, "HEAD")
|
|
438
|
+
full_commit_hash = (
|
|
439
|
+
_git_rev_parse(local_repo_path, commit_hash) if commit_hash else None
|
|
440
|
+
)
|
|
441
|
+
if (
|
|
442
|
+
full_commit_hash
|
|
443
|
+
and local_repo_commit_hash == full_commit_hash
|
|
444
|
+
and not force
|
|
445
|
+
):
|
|
437
446
|
if include_to_path:
|
|
438
447
|
__add_local_path_to_sys_path(local_repo_path)
|
|
439
448
|
return local_repo_path
|
|
@@ -516,12 +525,12 @@ def __add_local_path_to_sys_path(local_path: Path | str):
|
|
|
516
525
|
sys.path.insert(0, local_path_str)
|
|
517
526
|
|
|
518
527
|
|
|
519
|
-
def
|
|
528
|
+
def _git_rev_parse(repo_path: Path, ref: str) -> str:
|
|
520
529
|
import subprocess
|
|
521
530
|
|
|
522
531
|
try:
|
|
523
532
|
return subprocess.check_output(
|
|
524
|
-
["git", "rev-parse",
|
|
533
|
+
["git", "rev-parse", ref],
|
|
525
534
|
cwd=repo_path,
|
|
526
535
|
text=True,
|
|
527
536
|
stderr=subprocess.STDOUT,
|
|
@@ -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=5phfzDrMzuxkew7dkMe3AQHf5yuGHlEWJi5-3xyi6aM,513
|
|
4
4
|
fal/_serialization.py,sha256=npXNsFJ5G7jzBeBIyVMH01Ww34mGY4XWhHpRbSrTtnQ,7598
|
|
5
5
|
fal/_version.py,sha256=1BbTFnucNC_6ldKJ_ZoC722_UkW4S9aDBSW9L0fkKAw,2315
|
|
6
|
-
fal/api.py,sha256=
|
|
6
|
+
fal/api.py,sha256=vTYWeKnNg3japot1vOV_JSk812aeB6a2Y7lC1ed-VmM,47277
|
|
7
7
|
fal/app.py,sha256=pMf7P9iVEcw5HiFCYgSdHkjX6f-1SPe06EOwYH1ImGA,24079
|
|
8
8
|
fal/apps.py,sha256=pzCd2mrKl5J_4oVc40_pggvPtFahXBCdrZXWpnaEJVs,12130
|
|
9
9
|
fal/config.py,sha256=BEMH10B2bfWJ9yNawnLG6v3kBLnLmkhMe201EAODzs4,3124
|
|
10
|
-
fal/container.py,sha256=
|
|
10
|
+
fal/container.py,sha256=FTsa5hOW4ars-yV1lUoc0BNeIIvAZcpw7Ftyt3A4m_w,2000
|
|
11
11
|
fal/files.py,sha256=1eOyrj1M0hTixZdbtQ1ogJqWpLd7UfiOt1Rxihnqh8g,3565
|
|
12
12
|
fal/flags.py,sha256=QonyDM7R2GqfAB1bJr46oriu-fHJCkpUwXuSdanePWg,987
|
|
13
13
|
fal/project.py,sha256=QgfYfMKmNobMPufrAP_ga1FKcIAlSbw18Iar1-0qepo,2650
|
|
@@ -73,7 +73,7 @@ fal/toolkit/image/nsfw_filter/inference.py,sha256=BhIPF_zxRLetThQYxDDF0sdx9VRwvu
|
|
|
73
73
|
fal/toolkit/image/nsfw_filter/model.py,sha256=63mu8D15z_IosoRUagRLGHy6VbLqFmrG-yZqnu2vVm4,457
|
|
74
74
|
fal/toolkit/image/nsfw_filter/requirements.txt,sha256=3Pmrd0Ny6QAeBqUNHCgffRyfaCARAPJcfSCX5cRYpbM,37
|
|
75
75
|
fal/toolkit/utils/__init__.py,sha256=CrmM9DyCz5-SmcTzRSm5RaLgxy3kf0ZsSEN9uhnX2Xo,97
|
|
76
|
-
fal/toolkit/utils/download_utils.py,sha256=
|
|
76
|
+
fal/toolkit/utils/download_utils.py,sha256=0OtZoiLGQZUXlYG7MxiTSZgfT7L4qOxQIflvmbPcqSs,20501
|
|
77
77
|
fal/toolkit/utils/endpoint.py,sha256=5EXoshA2PD_brjEfhNWAWasjqLOCRrjBnfhj6QGuMt8,782
|
|
78
78
|
fal/toolkit/utils/retry.py,sha256=0pnKqs1Y2dADMAk2944FZr68ZL3wQC_5hqApfgyMf_8,1531
|
|
79
79
|
fal/toolkit/video/__init__.py,sha256=YV0jWpuvoA_CDFQXhd3zOvilFLKH7DYARrbzR7hWhpE,35
|
|
@@ -141,8 +141,8 @@ openapi_fal_rest/models/workflow_node_type.py,sha256=-FzyeY2bxcNmizKbJI8joG7byRi
|
|
|
141
141
|
openapi_fal_rest/models/workflow_schema.py,sha256=4K5gsv9u9pxx2ItkffoyHeNjBBYf6ur5bN4m_zePZNY,2019
|
|
142
142
|
openapi_fal_rest/models/workflow_schema_input.py,sha256=2OkOXWHTNsCXHWS6EGDFzcJKkW5FIap-2gfO233EvZQ,1191
|
|
143
143
|
openapi_fal_rest/models/workflow_schema_output.py,sha256=EblwSPAGfWfYVWw_WSSaBzQVju296is9o28rMBAd0mc,1196
|
|
144
|
-
fal-1.
|
|
145
|
-
fal-1.
|
|
146
|
-
fal-1.
|
|
147
|
-
fal-1.
|
|
148
|
-
fal-1.
|
|
144
|
+
fal-1.23.0.dist-info/METADATA,sha256=PK_7YpWltcIwUVpO_iPYg4zEhfyX6ZJuagR1pMbeNQE,4085
|
|
145
|
+
fal-1.23.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
146
|
+
fal-1.23.0.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
|
|
147
|
+
fal-1.23.0.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
|
|
148
|
+
fal-1.23.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|