fal 1.7.0__py3-none-any.whl → 1.7.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 +2 -2
- fal/auth/__init__.py +4 -1
- fal/config.py +23 -0
- fal/toolkit/file/file.py +10 -22
- {fal-1.7.0.dist-info → fal-1.7.1.dist-info}/METADATA +1 -1
- {fal-1.7.0.dist-info → fal-1.7.1.dist-info}/RECORD +9 -8
- {fal-1.7.0.dist-info → fal-1.7.1.dist-info}/WHEEL +0 -0
- {fal-1.7.0.dist-info → fal-1.7.1.dist-info}/entry_points.txt +0 -0
- {fal-1.7.0.dist-info → fal-1.7.1.dist-info}/top_level.txt +0 -0
fal/_fal_version.py
CHANGED
fal/auth/__init__.py
CHANGED
|
@@ -8,6 +8,7 @@ from typing import Optional
|
|
|
8
8
|
import click
|
|
9
9
|
|
|
10
10
|
from fal.auth import auth0, local
|
|
11
|
+
from fal.config import Config
|
|
11
12
|
from fal.console import console
|
|
12
13
|
from fal.console.icons import CHECK_ICON
|
|
13
14
|
from fal.exceptions.auth import UnauthenticatedException
|
|
@@ -61,7 +62,9 @@ def key_credentials() -> tuple[str, str] | None:
|
|
|
61
62
|
if os.environ.get("FAL_FORCE_AUTH_BY_USER") == "1":
|
|
62
63
|
return None
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
config = Config()
|
|
66
|
+
|
|
67
|
+
key = os.environ.get("FAL_KEY") or config.get("key") or get_colab_token()
|
|
65
68
|
if key:
|
|
66
69
|
key_id, key_secret = key.split(":", 1)
|
|
67
70
|
return (key_id, key_secret)
|
fal/config.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import tomli
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Config:
|
|
7
|
+
DEFAULT_CONFIG_PATH = "~/.fal/config.toml"
|
|
8
|
+
DEFAULT_PROFILE = "default"
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
self.config_path = os.path.expanduser(
|
|
12
|
+
os.getenv("FAL_CONFIG_PATH", self.DEFAULT_CONFIG_PATH)
|
|
13
|
+
)
|
|
14
|
+
self.profile = os.getenv("FAL_PROFILE", self.DEFAULT_PROFILE)
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
with open(self.config_path, "rb") as file:
|
|
18
|
+
self.config = tomli.load(file)
|
|
19
|
+
except FileNotFoundError:
|
|
20
|
+
self.config = {}
|
|
21
|
+
|
|
22
|
+
def get(self, key):
|
|
23
|
+
return self.config.get(self.profile, {}).get(key)
|
fal/toolkit/file/file.py
CHANGED
|
@@ -47,7 +47,10 @@ BUILT_IN_REPOSITORIES: dict[RepositoryId, FileRepositoryFactory] = {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
def get_builtin_repository(id: RepositoryId) -> FileRepository:
|
|
50
|
+
def get_builtin_repository(id: RepositoryId | FileRepository) -> FileRepository:
|
|
51
|
+
if isinstance(id, FileRepository):
|
|
52
|
+
return id
|
|
53
|
+
|
|
51
54
|
if id not in BUILT_IN_REPOSITORIES.keys():
|
|
52
55
|
raise ValueError(f'"{id}" is not a valid built-in file repository')
|
|
53
56
|
return BUILT_IN_REPOSITORIES[id]()
|
|
@@ -122,7 +125,8 @@ class File(BaseModel):
|
|
|
122
125
|
url=url,
|
|
123
126
|
content_type=None,
|
|
124
127
|
file_name=None,
|
|
125
|
-
|
|
128
|
+
file_size=None,
|
|
129
|
+
file_data=None,
|
|
126
130
|
)
|
|
127
131
|
|
|
128
132
|
@classmethod
|
|
@@ -139,11 +143,7 @@ class File(BaseModel):
|
|
|
139
143
|
save_kwargs: Optional[dict] = None,
|
|
140
144
|
fallback_save_kwargs: Optional[dict] = None,
|
|
141
145
|
) -> File:
|
|
142
|
-
repo = (
|
|
143
|
-
repository
|
|
144
|
-
if isinstance(repository, FileRepository)
|
|
145
|
-
else get_builtin_repository(repository)
|
|
146
|
-
)
|
|
146
|
+
repo = get_builtin_repository(repository)
|
|
147
147
|
|
|
148
148
|
save_kwargs = save_kwargs or {}
|
|
149
149
|
fallback_save_kwargs = fallback_save_kwargs or {}
|
|
@@ -160,11 +160,7 @@ class File(BaseModel):
|
|
|
160
160
|
if not fallback_repository:
|
|
161
161
|
raise
|
|
162
162
|
|
|
163
|
-
fallback_repo = (
|
|
164
|
-
fallback_repository
|
|
165
|
-
if isinstance(fallback_repository, FileRepository)
|
|
166
|
-
else get_builtin_repository(fallback_repository)
|
|
167
|
-
)
|
|
163
|
+
fallback_repo = get_builtin_repository(fallback_repository)
|
|
168
164
|
|
|
169
165
|
url = fallback_repo.save(
|
|
170
166
|
fdata, object_lifecycle_preference, **fallback_save_kwargs
|
|
@@ -196,11 +192,7 @@ class File(BaseModel):
|
|
|
196
192
|
if not file_path.exists():
|
|
197
193
|
raise FileNotFoundError(f"File {file_path} does not exist")
|
|
198
194
|
|
|
199
|
-
repo = (
|
|
200
|
-
repository
|
|
201
|
-
if isinstance(repository, FileRepository)
|
|
202
|
-
else get_builtin_repository(repository)
|
|
203
|
-
)
|
|
195
|
+
repo = get_builtin_repository(repository)
|
|
204
196
|
|
|
205
197
|
save_kwargs = save_kwargs or {}
|
|
206
198
|
fallback_save_kwargs = fallback_save_kwargs or {}
|
|
@@ -222,11 +214,7 @@ class File(BaseModel):
|
|
|
222
214
|
if not fallback_repository:
|
|
223
215
|
raise
|
|
224
216
|
|
|
225
|
-
fallback_repo = (
|
|
226
|
-
fallback_repository
|
|
227
|
-
if isinstance(fallback_repository, FileRepository)
|
|
228
|
-
else get_builtin_repository(fallback_repository)
|
|
229
|
-
)
|
|
217
|
+
fallback_repo = get_builtin_repository(fallback_repository)
|
|
230
218
|
|
|
231
219
|
url, data = fallback_repo.save_file(
|
|
232
220
|
file_path,
|
|
@@ -1,11 +1,12 @@
|
|
|
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=kn-QYzzAhfbnfKK6EpE9gJz8TDZkEk52evaid1DHkG4,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=xTtPvDqaEHsq2lFsMwRZiHb4hzjVY3y6lV-xbzkSetI,43375
|
|
7
7
|
fal/app.py,sha256=C1dTWjit90XdTKmrwd5Aqv3SD0MA1JDZoLLtmStn2Xc,22917
|
|
8
8
|
fal/apps.py,sha256=RpmElElJnDYjsTRQOdNYiJwd74GEOGYA38L5O5GzNEg,11068
|
|
9
|
+
fal/config.py,sha256=hgI3kW4_2NoFsrYEiPss0mnDTr8_Td2z0pVgm93wi9o,600
|
|
9
10
|
fal/container.py,sha256=EjokKTULJ3fPUjDttjir-jmg0gqcUDe0iVzW2j5njec,634
|
|
10
11
|
fal/files.py,sha256=QgfYfMKmNobMPufrAP_ga1FKcIAlSbw18Iar1-0qepo,2650
|
|
11
12
|
fal/flags.py,sha256=oWN_eidSUOcE9wdPK_77si3A1fpgOC0UEERPsvNLIMc,842
|
|
@@ -15,7 +16,7 @@ fal/sdk.py,sha256=HjlToPJkG0Z5h_D0D2FK43i3JFKeO4r2IhCGx4B82Z8,22564
|
|
|
15
16
|
fal/sync.py,sha256=ZuIJA2-hTPNANG9B_NNJZUsO68EIdTH0dc9MzeVE2VU,4340
|
|
16
17
|
fal/utils.py,sha256=9q_QrQBlQN3nZYA1kEGRfhJWi4RjnO4H1uQswfaei9w,2146
|
|
17
18
|
fal/workflows.py,sha256=Zl4f6Bs085hY40zmqScxDUyCu7zXkukDbW02iYOLTTI,14805
|
|
18
|
-
fal/auth/__init__.py,sha256=
|
|
19
|
+
fal/auth/__init__.py,sha256=MXwS5zyY1SYJWEkc6s39et73Dkg3cDJg1ZwxRhXNj4c,4704
|
|
19
20
|
fal/auth/auth0.py,sha256=rSG1mgH-QGyKfzd7XyAaj1AYsWt-ho8Y_LZ-FUVWzh4,5421
|
|
20
21
|
fal/auth/local.py,sha256=sndkM6vKpeVny6NHTacVlTbiIFqaksOmw0Viqs_RN1U,1790
|
|
21
22
|
fal/cli/__init__.py,sha256=padK4o0BFqq61kxAA1qQ0jYr2SuhA2mf90B3AaRkmJA,37
|
|
@@ -49,7 +50,7 @@ fal/toolkit/exceptions.py,sha256=elHZ7dHCJG5zlHGSBbz-ilkZe9QUvQMomJFi8Pt91LA,198
|
|
|
49
50
|
fal/toolkit/optimize.py,sha256=p75sovF0SmRP6zxzpIaaOmqlxvXB_xEz3XPNf59EF7w,1339
|
|
50
51
|
fal/toolkit/types.py,sha256=kkbOsDKj1qPGb1UARTBp7yuJ5JUuyy7XQurYUBCdti8,4064
|
|
51
52
|
fal/toolkit/file/__init__.py,sha256=FbNl6wD-P0aSSTUwzHt4HujBXrbC3ABmaigPQA4hRfg,70
|
|
52
|
-
fal/toolkit/file/file.py,sha256
|
|
53
|
+
fal/toolkit/file/file.py,sha256=-gccCKnarTu6Nfm_0yQ0sJM9aadB5tUNvKS1PTqxiFc,9071
|
|
53
54
|
fal/toolkit/file/types.py,sha256=MjZ6xAhKPv4rowLo2Vcbho0sX7AQ3lm3KFyYDcw0dL4,1845
|
|
54
55
|
fal/toolkit/file/providers/fal.py,sha256=V5CZz6EKmIs2-nm_mWeN9YxUOZCKIuPsZFjkZyazrgk,22375
|
|
55
56
|
fal/toolkit/file/providers/gcp.py,sha256=iQtkoYUqbmKKpC5srVOYtrruZ3reGRm5lz4kM8bshgk,2247
|
|
@@ -129,8 +130,8 @@ openapi_fal_rest/models/workflow_node_type.py,sha256=-FzyeY2bxcNmizKbJI8joG7byRi
|
|
|
129
130
|
openapi_fal_rest/models/workflow_schema.py,sha256=4K5gsv9u9pxx2ItkffoyHeNjBBYf6ur5bN4m_zePZNY,2019
|
|
130
131
|
openapi_fal_rest/models/workflow_schema_input.py,sha256=2OkOXWHTNsCXHWS6EGDFzcJKkW5FIap-2gfO233EvZQ,1191
|
|
131
132
|
openapi_fal_rest/models/workflow_schema_output.py,sha256=EblwSPAGfWfYVWw_WSSaBzQVju296is9o28rMBAd0mc,1196
|
|
132
|
-
fal-1.7.
|
|
133
|
-
fal-1.7.
|
|
134
|
-
fal-1.7.
|
|
135
|
-
fal-1.7.
|
|
136
|
-
fal-1.7.
|
|
133
|
+
fal-1.7.1.dist-info/METADATA,sha256=kI7x5gDlwiymcO6n037_a22y8olxwqg7yrwLu4gt-kM,3996
|
|
134
|
+
fal-1.7.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
135
|
+
fal-1.7.1.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
|
|
136
|
+
fal-1.7.1.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
|
|
137
|
+
fal-1.7.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|