fal 1.21.0__py3-none-any.whl → 1.22.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.

Potentially problematic release.


This version of fal might be problematic. Click here for more details.

fal/_fal_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '1.21.0'
21
- __version_tuple__ = version_tuple = (1, 21, 0)
20
+ __version__ = version = '1.22.0'
21
+ __version_tuple__ = version_tuple = (1, 22, 0)
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 "Access your exposed service at" in log.message:
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
- for module_name in local_python_modules or []:
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
@@ -456,7 +456,7 @@ def clone_repository(
456
456
  # repository might be already deleted by another worker
457
457
  os.rename(local_repo_path, tmp_dir)
458
458
  # sometimes seeing FileNotFoundError even here on juicefs
459
- shutil.rmtree(tmp_dir)
459
+ shutil.rmtree(tmp_dir, ignore_errors=True)
460
460
 
461
461
  # NOTE: using the target_dir to be able to avoid potential copies across temp fs
462
462
  # and target fs, and also to be able to atomically rename repo_name dir into place
@@ -492,7 +492,7 @@ def clone_repository(
492
492
  try:
493
493
  os.rename(temp_dir, local_repo_path)
494
494
  except OSError as error:
495
- shutil.rmtree(temp_dir)
495
+ shutil.rmtree(temp_dir, ignore_errors=True)
496
496
 
497
497
  # someone beat us to it, assume it's good
498
498
  if error.errno != errno.ENOTEMPTY:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fal
3
- Version: 1.21.0
3
+ Version: 1.22.0
4
4
  Summary: fal is an easy-to-use Serverless Python Framework
5
5
  Author: Features & Labels <support@fal.ai>
6
6
  Requires-Python: >=3.8
@@ -1,9 +1,9 @@
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=glHIIuPg58nJyE9NLnlCi40SYMkep1l15F34liYRIWE,513
3
+ fal/_fal_version.py,sha256=kabBVDEUDLijsKri4qrNeWMmy6rv5W4lO7kJYfMb9Mg,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=KR3RkuEEamAJBe5cBwfDL64Yj3bZVeVC_IpZDJ4uGC4,46149
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
@@ -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=trOGg_dAGSpftv4sSpW21b-nnQauaqaW1NV-ILO5i6k,20151
76
+ fal/toolkit/utils/download_utils.py,sha256=sy1MNmYAELyBScSsG7QNxzOCCxFIPusol_RPhNyqZ_w,20191
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.21.0.dist-info/METADATA,sha256=PdO2oBmWxNGyo6JmXbNhPRp-Mt_8QXrLLrAiCnFVjbE,4085
145
- fal-1.21.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
146
- fal-1.21.0.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
147
- fal-1.21.0.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
148
- fal-1.21.0.dist-info/RECORD,,
144
+ fal-1.22.0.dist-info/METADATA,sha256=1h6ZFhJJi6nYLhYDC8vY_rVsGkjd0SY6cwAjtoHU8v4,4085
145
+ fal-1.22.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
146
+ fal-1.22.0.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
147
+ fal-1.22.0.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
148
+ fal-1.22.0.dist-info/RECORD,,
File without changes