fal 1.5.2__py3-none-any.whl → 1.5.3__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
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.5.2'
16
- __version_tuple__ = version_tuple = (1, 5, 2)
15
+ __version__ = version = '1.5.3'
16
+ __version_tuple__ = version_tuple = (1, 5, 3)
fal/app.py CHANGED
@@ -19,7 +19,8 @@ from fal._serialization import include_modules_from
19
19
  from fal.api import RouteSignature
20
20
  from fal.exceptions import RequestCancelledException
21
21
  from fal.logging import get_logger
22
- from fal.toolkit.file.providers import fal as fal_provider_module
22
+ from fal.toolkit.file import get_lifecycle_preference
23
+ from fal.toolkit.file.providers.fal import GLOBAL_LIFECYCLE_PREFERENCE
23
24
 
24
25
  REALTIME_APP_REQUIREMENTS = ["websockets", "msgpack"]
25
26
 
@@ -266,11 +267,14 @@ class App(fal.api.BaseServable):
266
267
 
267
268
  @app.middleware("http")
268
269
  async def set_global_object_preference(request, call_next):
269
- response = await call_next(request)
270
270
  try:
271
- fal_provider_module.GLOBAL_LIFECYCLE_PREFERENCE = request.headers.get(
272
- "X-Fal-Object-Lifecycle-Preference"
273
- )
271
+ preference_dict = get_lifecycle_preference(request) or {}
272
+ expiration_duration = preference_dict.get("expiration_duration_seconds")
273
+ if expiration_duration is not None:
274
+ GLOBAL_LIFECYCLE_PREFERENCE.expiration_duration_seconds = int(
275
+ expiration_duration
276
+ )
277
+
274
278
  except Exception:
275
279
  from fastapi.logger import logger
276
280
 
@@ -278,7 +282,7 @@ class App(fal.api.BaseServable):
278
282
  "Failed set a global lifecycle preference %s",
279
283
  self.__class__.__name__,
280
284
  )
281
- return response
285
+ return await call_next(request)
282
286
 
283
287
  @app.exception_handler(RequestCancelledException)
284
288
  async def value_error_exception_handler(
fal/toolkit/file/file.py CHANGED
@@ -144,7 +144,7 @@ class File(BaseModel):
144
144
 
145
145
  fdata = FileData(data, content_type, file_name)
146
146
 
147
- object_lifecycle_preference = _get_lifecycle_preference(request)
147
+ object_lifecycle_preference = get_lifecycle_preference(request)
148
148
 
149
149
  try:
150
150
  url = repo.save(fdata, object_lifecycle_preference)
@@ -191,7 +191,7 @@ class File(BaseModel):
191
191
  )
192
192
 
193
193
  content_type = content_type or "application/octet-stream"
194
- object_lifecycle_preference = _get_lifecycle_preference(request)
194
+ object_lifecycle_preference = get_lifecycle_preference(request)
195
195
 
196
196
  try:
197
197
  url, data = repo.save_file(
@@ -274,7 +274,7 @@ class CompressedFile(File):
274
274
  shutil.rmtree(self.extract_dir)
275
275
 
276
276
 
277
- def _get_lifecycle_preference(request: Request) -> dict[str, str] | None:
277
+ def get_lifecycle_preference(request: Request) -> dict[str, str] | None:
278
278
  import json
279
279
 
280
280
  preference_str = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fal
3
- Version: 1.5.2
3
+ Version: 1.5.3
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
@@ -38,8 +38,12 @@ Requires-Dist: cookiecutter
38
38
  Requires-Dist: tomli
39
39
  Requires-Dist: importlib-metadata>=4.4; python_version < "3.10"
40
40
  Provides-Extra: dev
41
- Requires-Dist: fal[test]; extra == "dev"
41
+ Requires-Dist: fal[docs,test]; extra == "dev"
42
42
  Requires-Dist: openapi-python-client<1,>=0.14.1; extra == "dev"
43
+ Provides-Extra: docs
44
+ Requires-Dist: sphinx; extra == "docs"
45
+ Requires-Dist: sphinx-rtd-theme; extra == "docs"
46
+ Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
43
47
  Provides-Extra: test
44
48
  Requires-Dist: pytest<8; extra == "test"
45
49
  Requires-Dist: pytest-asyncio; extra == "test"
@@ -1,10 +1,10 @@
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=P-JlE1bO3FGbbntvKHqxjgKk7ORvjFhybkK-h8R2s5g,411
3
+ fal/_fal_version.py,sha256=qpWMa3r-Mid4OHoz1spx5Qra38bLcIkEwP2xut7PVrA,411
4
4
  fal/_serialization.py,sha256=rD2YiSa8iuzCaZohZwN_MPEB-PpSKbWRDeaIDpTEjyY,7653
5
5
  fal/_version.py,sha256=EBGqrknaf1WygENX-H4fBefLvHryvJBBGtVJetaB0NY,266
6
6
  fal/api.py,sha256=wmXywHvkdKe0AlsPmXt8_nidPhoC_Ho4BrUi7In4Hek,43278
7
- fal/app.py,sha256=u25k-MLKU_7eux4PuN24iq1zZf5hSeUeYkO7kUIA6uI,18021
7
+ fal/app.py,sha256=cSD0q3meoIy_CMmTHVsY-ghRyDG4k2m5BJXh32zSUaE,18252
8
8
  fal/apps.py,sha256=lge7-HITzI20l1oXdlkAzqxdMVtXRfnACIylKRWgCNQ,7151
9
9
  fal/container.py,sha256=V7riyyq8AZGwEX9QaqRQDZyDN_bUKeRKV1OOZArXjL0,622
10
10
  fal/files.py,sha256=QgfYfMKmNobMPufrAP_ga1FKcIAlSbw18Iar1-0qepo,2650
@@ -47,7 +47,7 @@ fal/toolkit/__init__.py,sha256=sV95wiUzKoiDqF9vDgq4q-BLa2sD6IpuKSqp5kdTQNE,658
47
47
  fal/toolkit/exceptions.py,sha256=elHZ7dHCJG5zlHGSBbz-ilkZe9QUvQMomJFi8Pt91LA,198
48
48
  fal/toolkit/optimize.py,sha256=p75sovF0SmRP6zxzpIaaOmqlxvXB_xEz3XPNf59EF7w,1339
49
49
  fal/toolkit/file/__init__.py,sha256=FbNl6wD-P0aSSTUwzHt4HujBXrbC3ABmaigPQA4hRfg,70
50
- fal/toolkit/file/file.py,sha256=GuY4zTqYMod2e9pLorZdPJqmGQ2CmmxaYxmtBm4J7vQ,8913
50
+ fal/toolkit/file/file.py,sha256=EUSzX8480sKRtQzGisgBc8WUiCCCkrohXmpQIh4otlI,8910
51
51
  fal/toolkit/file/types.py,sha256=MjZ6xAhKPv4rowLo2Vcbho0sX7AQ3lm3KFyYDcw0dL4,1845
52
52
  fal/toolkit/file/providers/fal.py,sha256=W3XKbAsRuCKPDHwVK1IBen_Tdp23Pi8qhgfiVbsPc4s,14777
53
53
  fal/toolkit/file/providers/gcp.py,sha256=cxG1j3yuOpFl_Dl_nCEibFE4677qkdXZhuKgb65PnjQ,2126
@@ -126,8 +126,8 @@ openapi_fal_rest/models/workflow_node_type.py,sha256=-FzyeY2bxcNmizKbJI8joG7byRi
126
126
  openapi_fal_rest/models/workflow_schema.py,sha256=4K5gsv9u9pxx2ItkffoyHeNjBBYf6ur5bN4m_zePZNY,2019
127
127
  openapi_fal_rest/models/workflow_schema_input.py,sha256=2OkOXWHTNsCXHWS6EGDFzcJKkW5FIap-2gfO233EvZQ,1191
128
128
  openapi_fal_rest/models/workflow_schema_output.py,sha256=EblwSPAGfWfYVWw_WSSaBzQVju296is9o28rMBAd0mc,1196
129
- fal-1.5.2.dist-info/METADATA,sha256=hOKSZaGlMc6uIwV8Te50B9vaqRBxE2YjCeALzTpveRo,3787
130
- fal-1.5.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
131
- fal-1.5.2.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
132
- fal-1.5.2.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
133
- fal-1.5.2.dist-info/RECORD,,
129
+ fal-1.5.3.dist-info/METADATA,sha256=8iyC_cB-mgaU5WmOyDpJ7DSUT_Q_T6GBEROWekEJX1w,3958
130
+ fal-1.5.3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
131
+ fal-1.5.3.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
132
+ fal-1.5.3.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
133
+ fal-1.5.3.dist-info/RECORD,,
File without changes