fal 1.5.15__py3-none-any.whl → 1.5.16__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.15'
16
- __version_tuple__ = version_tuple = (1, 5, 15)
15
+ __version__ = version = '1.5.16'
16
+ __version_tuple__ = version_tuple = (1, 5, 16)
fal/apps.py CHANGED
@@ -261,7 +261,7 @@ class _WSConnection:
261
261
  _ws: Connection
262
262
  _buffer: str | bytes | None = None
263
263
 
264
- def run(self, arguments: dict[str, Any]) -> dict[str, Any]:
264
+ def run(self, arguments: dict[str, Any]) -> bytes:
265
265
  """Run an inference task on the app and return the result."""
266
266
  self.send(arguments)
267
267
  return self.recv()
@@ -318,34 +318,28 @@ class _WSConnection:
318
318
 
319
319
  return json_payload
320
320
 
321
- def _recv_response(self) -> Any:
322
- import msgpack
323
-
324
- body: bytes = b""
321
+ def _recv_response(self) -> Iterator[str | bytes]:
325
322
  while True:
326
323
  try:
327
324
  with self._recv() as res:
328
325
  if self._is_meta(res):
329
- # Keep the meta message for later
326
+ # Raise so we dont consume the message
330
327
  raise _MetaMessageFound()
331
328
 
332
- if isinstance(res, str):
333
- return res
334
- else:
335
- body += res
329
+ yield res
336
330
  except _MetaMessageFound:
337
331
  break
338
332
 
339
- if not body:
340
- raise ValueError("Empty response body")
341
-
342
- return msgpack.unpackb(body)
343
-
344
- def recv(self) -> Any:
333
+ def recv(self) -> bytes:
345
334
  start = self._recv_meta("start")
346
335
  request_id = start["request_id"]
347
336
 
348
- response = self._recv_response()
337
+ response = b""
338
+ for part in self._recv_response():
339
+ if isinstance(part, str):
340
+ response += part.encode()
341
+ else:
342
+ response += part
349
343
 
350
344
  end = self._recv_meta("end")
351
345
  if end["request_id"] != request_id:
@@ -353,6 +347,17 @@ class _WSConnection:
353
347
 
354
348
  return response
355
349
 
350
+ def stream(self) -> Iterator[str | bytes]:
351
+ start = self._recv_meta("start")
352
+ request_id = start["request_id"]
353
+
354
+ yield from self._recv_response()
355
+
356
+ # Make sure we consume the end message
357
+ end = self._recv_meta("end")
358
+ if end["request_id"] != request_id:
359
+ raise ValueError("Mismatched request_id in end message")
360
+
356
361
 
357
362
  @contextmanager
358
363
  def ws(app_id: str, *, path: str = "") -> Iterator[_WSConnection]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fal
3
- Version: 1.5.15
3
+ Version: 1.5.16
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,11 +1,11 @@
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=299zYncL2JUBDyICATkgM5qBt_4iztg0ZseMesrRfvI,413
3
+ fal/_fal_version.py,sha256=mHfZXquAABTFJcCTtEKL7lltRkyfT160CZojEvwd1Aw,413
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=xTtPvDqaEHsq2lFsMwRZiHb4hzjVY3y6lV-xbzkSetI,43375
7
7
  fal/app.py,sha256=nLku84uTyK2VJRH_dGe_Ym8fNRsTvC3_5yolgjh9wlY,22429
8
- fal/apps.py,sha256=-s3xVOclIQxAevLdbMcyhGkPGsx8x0VAZbRoYQG-F_I,10800
8
+ fal/apps.py,sha256=RpmElElJnDYjsTRQOdNYiJwd74GEOGYA38L5O5GzNEg,11068
9
9
  fal/container.py,sha256=V7riyyq8AZGwEX9QaqRQDZyDN_bUKeRKV1OOZArXjL0,622
10
10
  fal/files.py,sha256=QgfYfMKmNobMPufrAP_ga1FKcIAlSbw18Iar1-0qepo,2650
11
11
  fal/flags.py,sha256=oWN_eidSUOcE9wdPK_77si3A1fpgOC0UEERPsvNLIMc,842
@@ -128,8 +128,8 @@ openapi_fal_rest/models/workflow_node_type.py,sha256=-FzyeY2bxcNmizKbJI8joG7byRi
128
128
  openapi_fal_rest/models/workflow_schema.py,sha256=4K5gsv9u9pxx2ItkffoyHeNjBBYf6ur5bN4m_zePZNY,2019
129
129
  openapi_fal_rest/models/workflow_schema_input.py,sha256=2OkOXWHTNsCXHWS6EGDFzcJKkW5FIap-2gfO233EvZQ,1191
130
130
  openapi_fal_rest/models/workflow_schema_output.py,sha256=EblwSPAGfWfYVWw_WSSaBzQVju296is9o28rMBAd0mc,1196
131
- fal-1.5.15.dist-info/METADATA,sha256=C4sigcaEzk4Yv8fuA7rJtKcr0AhaH3zyS7Qb1PQrFF4,3997
132
- fal-1.5.15.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
133
- fal-1.5.15.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
134
- fal-1.5.15.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
135
- fal-1.5.15.dist-info/RECORD,,
131
+ fal-1.5.16.dist-info/METADATA,sha256=rXM_O4xtD7xvwYD3gp1Bsh-Dtgc7M3IvsTv3EiVjVlg,3997
132
+ fal-1.5.16.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
133
+ fal-1.5.16.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
134
+ fal-1.5.16.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
135
+ fal-1.5.16.dist-info/RECORD,,
File without changes