fal 1.15.0__py3-none-any.whl → 1.15.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 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.15.0'
21
- __version_tuple__ = version_tuple = (1, 15, 0)
20
+ __version__ = version = '1.15.1'
21
+ __version_tuple__ = version_tuple = (1, 15, 1)
fal/cli/files.py CHANGED
@@ -18,14 +18,14 @@ def _download(args):
18
18
  from fal.files import FalFileSystem
19
19
 
20
20
  fs = FalFileSystem()
21
- fs.get(args.remote_path, args.local_path)
21
+ fs.get(args.remote_path, args.local_path, recursive=True)
22
22
 
23
23
 
24
24
  def _upload(args):
25
25
  from fal.files import FalFileSystem
26
26
 
27
27
  fs = FalFileSystem()
28
- fs.put(args.local_path, args.remote_path)
28
+ fs.put(args.local_path, args.remote_path, recursive=True)
29
29
 
30
30
 
31
31
  def add_parser(main_subparsers, parents):
fal/files.py CHANGED
@@ -1,3 +1,4 @@
1
+ import os
1
2
  import posixpath
2
3
  from functools import cached_property
3
4
  from typing import TYPE_CHECKING
@@ -28,14 +29,16 @@ class FalFileSystem(AbstractFileSystem):
28
29
  )
29
30
 
30
31
  def ls(self, path, detail=True, **kwargs):
31
- response = self._client.get(f"/files/list/{path.lstrip('/')}")
32
- response.raise_for_status()
33
- files = response.json()
34
- if detail:
35
- return sorted(
32
+ if path in self.dircache:
33
+ entries = self.dircache[path]
34
+ else:
35
+ response = self._client.get(f"/files/list/{path.lstrip('/')}")
36
+ response.raise_for_status()
37
+ files = response.json()
38
+ entries = sorted(
36
39
  (
37
40
  {
38
- "name": entry["path"],
41
+ "name": entry["path"].lstrip("/data/"),
39
42
  "size": entry["size"],
40
43
  "type": "file" if entry["is_file"] else "directory",
41
44
  "mtime": entry["updated_time"],
@@ -44,8 +47,12 @@ class FalFileSystem(AbstractFileSystem):
44
47
  ),
45
48
  key=lambda x: x["name"],
46
49
  )
47
- else:
48
- return sorted(entry["path"] for entry in files)
50
+ self.dircache[path] = entries
51
+
52
+ if detail:
53
+ return entries
54
+
55
+ return [entry["name"] for entry in entries]
49
56
 
50
57
  def info(self, path, **kwargs):
51
58
  parent = posixpath.dirname(path)
@@ -56,19 +63,28 @@ class FalFileSystem(AbstractFileSystem):
56
63
  raise FileNotFoundError(f"File not found: {path}")
57
64
 
58
65
  def get_file(self, rpath, lpath, **kwargs):
66
+ if self.isdir(rpath):
67
+ os.makedirs(lpath, exist_ok=True)
68
+ return
69
+
59
70
  with open(lpath, "wb") as fobj:
60
71
  response = self._client.get(f"/files/file/{rpath.lstrip('/')}")
61
72
  response.raise_for_status()
62
73
  fobj.write(response.content)
63
74
 
64
75
  def put_file(self, lpath, rpath, mode="overwrite", **kwargs):
76
+ if os.path.isdir(lpath):
77
+ return
78
+
65
79
  with open(lpath, "rb") as fobj:
66
80
  response = self._client.post(
67
81
  f"/files/file/local/{rpath.lstrip('/')}",
68
82
  files={"file_upload": (posixpath.basename(lpath), fobj, "text/plain")},
69
83
  )
70
84
  response.raise_for_status()
85
+ self.dircache.clear()
71
86
 
72
87
  def rm(self, path, **kwargs):
73
88
  response = self._client.delete(f"/files/file/{path.lstrip('/')}")
74
89
  response.raise_for_status()
90
+ self.dircache.clear()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fal
3
- Version: 1.15.0
3
+ Version: 1.15.1
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,6 +1,6 @@
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=bw-GHVwYsU9TasIoWctP5ethaWthhk1oAuWz-86NHtc,513
3
+ fal/_fal_version.py,sha256=u2kvcE5eJlQ5arI8vANUY9cq2C_oRgBLSNFx24U4PgU,513
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=gVZKtdMRNKacBCNVmdZZRGMyF3hrR2bqGiAzUBstkDM,45661
@@ -8,7 +8,7 @@ fal/app.py,sha256=aRb8t-5QCrIPeKHY39yJ3231T5uHGZLhSurkRBtzyu8,24216
8
8
  fal/apps.py,sha256=pzCd2mrKl5J_4oVc40_pggvPtFahXBCdrZXWpnaEJVs,12130
9
9
  fal/config.py,sha256=19Q7fymEkfxCd9AIy8SxhaQaRvb_vKvYAG3AeZAI6uk,3116
10
10
  fal/container.py,sha256=OvR-Zq-NPbYFHTnw0SBUUFxr890Fgbe68J2kSJEpLOk,1905
11
- fal/files.py,sha256=HgXD8q9-RKQGIaN7lXtht2BOFFsdMozJcLr3DwLx4x8,2387
11
+ fal/files.py,sha256=LHJxT4fs2jDs1hH26YoXdq77hUQp4IiaNJ0TE2-RFjo,2773
12
12
  fal/flags.py,sha256=oWN_eidSUOcE9wdPK_77si3A1fpgOC0UEERPsvNLIMc,842
13
13
  fal/project.py,sha256=QgfYfMKmNobMPufrAP_ga1FKcIAlSbw18Iar1-0qepo,2650
14
14
  fal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -30,7 +30,7 @@ fal/cli/create.py,sha256=a8WDq-nJLFTeoIXqpb5cr7GR7YR9ZZrQCawNm34KXXE,627
30
30
  fal/cli/debug.py,sha256=u_urnyFzSlNnrq93zz_GXE9FX4VyVxDoamJJyrZpFI0,1312
31
31
  fal/cli/deploy.py,sha256=CWf0Y56w-hNCrht-qrfgiOi9nuvve1Kl5NFZJpt_oRA,7770
32
32
  fal/cli/doctor.py,sha256=U4ne9LX5gQwNblsYQ27XdO8AYDgbYjTO39EtxhwexRM,983
33
- fal/cli/files.py,sha256=SN0pr6bvdss8_EjmaB2kai5VYVacLRF_oH6it4Ni8-M,1936
33
+ fal/cli/files.py,sha256=zOJeRy1W1CsNw0QMxt2vT8Q352phh3l4lZSOLiTQa2w,1968
34
34
  fal/cli/keys.py,sha256=7Sf4DT4le89G42eAOt0ltRjbZAtE70AVQ62hmjZhUy0,3059
35
35
  fal/cli/main.py,sha256=CNh-i1xL0G2pbYMsk0VUC6qsxBT9rrQuLCIeDSiRuQs,2260
36
36
  fal/cli/parser.py,sha256=jYsGQ0BLQuKI7KtN1jnLVYKMbLtez7hPjwTNfG3UPSk,2964
@@ -136,8 +136,8 @@ openapi_fal_rest/models/workflow_node_type.py,sha256=-FzyeY2bxcNmizKbJI8joG7byRi
136
136
  openapi_fal_rest/models/workflow_schema.py,sha256=4K5gsv9u9pxx2ItkffoyHeNjBBYf6ur5bN4m_zePZNY,2019
137
137
  openapi_fal_rest/models/workflow_schema_input.py,sha256=2OkOXWHTNsCXHWS6EGDFzcJKkW5FIap-2gfO233EvZQ,1191
138
138
  openapi_fal_rest/models/workflow_schema_output.py,sha256=EblwSPAGfWfYVWw_WSSaBzQVju296is9o28rMBAd0mc,1196
139
- fal-1.15.0.dist-info/METADATA,sha256=_ngkJv-caqQuXH8IS_jwmliPyjEOs0I7sIcQ2QPtPN0,4084
140
- fal-1.15.0.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
141
- fal-1.15.0.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
142
- fal-1.15.0.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
143
- fal-1.15.0.dist-info/RECORD,,
139
+ fal-1.15.1.dist-info/METADATA,sha256=kEoBe0iKdW2G8ypAPAjVn78pPkYFxhKy8Ykw14AB5Wo,4084
140
+ fal-1.15.1.dist-info/WHEEL,sha256=QZxptf4Y1BKFRCEDxD4h2V0mBFQOVFLFEpvxHmIs52A,91
141
+ fal-1.15.1.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
142
+ fal-1.15.1.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
143
+ fal-1.15.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.4.0)
2
+ Generator: setuptools (80.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5