fal 1.2.1__py3-none-any.whl → 1.2.2__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/api.py +3 -1
- fal/app.py +2 -1
- fal/cli/apps.py +4 -2
- fal/cli/create.py +26 -0
- fal/cli/deploy.py +3 -3
- fal/cli/main.py +2 -2
- fal/cli/run.py +1 -1
- fal/utils.py +8 -4
- {fal-1.2.1.dist-info → fal-1.2.2.dist-info}/METADATA +2 -1
- {fal-1.2.1.dist-info → fal-1.2.2.dist-info}/RECORD +14 -13
- {fal-1.2.1.dist-info → fal-1.2.2.dist-info}/WHEEL +1 -1
- {fal-1.2.1.dist-info → fal-1.2.2.dist-info}/entry_points.txt +0 -0
- {fal-1.2.1.dist-info → fal-1.2.2.dist-info}/top_level.txt +0 -0
fal/_fal_version.py
CHANGED
fal/api.py
CHANGED
|
@@ -1048,7 +1048,9 @@ class BaseServable:
|
|
|
1048
1048
|
from uvicorn import Config
|
|
1049
1049
|
|
|
1050
1050
|
app = self._build_app()
|
|
1051
|
-
server = Server(
|
|
1051
|
+
server = Server(
|
|
1052
|
+
config=Config(app, host="0.0.0.0", port=8080, timeout_keep_alive=300)
|
|
1053
|
+
)
|
|
1052
1054
|
metrics_app = FastAPI()
|
|
1053
1055
|
metrics_app.add_route("/metrics", handle_metrics)
|
|
1054
1056
|
metrics_server = Server(config=Config(metrics_app, host="0.0.0.0", port=9090))
|
fal/app.py
CHANGED
|
@@ -7,7 +7,7 @@ import re
|
|
|
7
7
|
import time
|
|
8
8
|
import typing
|
|
9
9
|
from contextlib import asynccontextmanager, contextmanager
|
|
10
|
-
from typing import Any, Callable, ClassVar, TypeVar
|
|
10
|
+
from typing import Any, Callable, ClassVar, Literal, TypeVar
|
|
11
11
|
|
|
12
12
|
import httpx
|
|
13
13
|
from fastapi import FastAPI
|
|
@@ -152,6 +152,7 @@ class App(fal.api.BaseServable):
|
|
|
152
152
|
"keep_alive": 60,
|
|
153
153
|
}
|
|
154
154
|
app_name: ClassVar[str]
|
|
155
|
+
app_auth: ClassVar[Literal["private", "public", "shared"]] = "private"
|
|
155
156
|
|
|
156
157
|
def __init_subclass__(cls, **kwargs):
|
|
157
158
|
app_name = kwargs.pop("name", None) or _to_fal_app_name(cls.__name__)
|
fal/cli/apps.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
from typing import TYPE_CHECKING
|
|
2
4
|
|
|
3
5
|
from .parser import FalClientParser
|
|
@@ -6,7 +8,7 @@ if TYPE_CHECKING:
|
|
|
6
8
|
from fal.sdk import AliasInfo, ApplicationInfo
|
|
7
9
|
|
|
8
10
|
|
|
9
|
-
def _apps_table(apps: list[
|
|
11
|
+
def _apps_table(apps: list[AliasInfo]):
|
|
10
12
|
from rich.table import Table
|
|
11
13
|
|
|
12
14
|
table = Table()
|
|
@@ -56,7 +58,7 @@ def _add_list_parser(subparsers, parents):
|
|
|
56
58
|
parser.set_defaults(func=_list)
|
|
57
59
|
|
|
58
60
|
|
|
59
|
-
def _app_rev_table(revs: list[
|
|
61
|
+
def _app_rev_table(revs: list[ApplicationInfo]):
|
|
60
62
|
from rich.table import Table
|
|
61
63
|
|
|
62
64
|
table = Table()
|
fal/cli/create.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
PROJECT_TYPES = ["app"]
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def _create_project(project_type: str):
|
|
5
|
+
from cookiecutter.main import cookiecutter
|
|
6
|
+
|
|
7
|
+
cookiecutter("https://github.com/fal-ai/cookiecutter-fal.git")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def add_parser(main_subparsers, parents):
|
|
11
|
+
apps_help = "Create fal applications."
|
|
12
|
+
parser = main_subparsers.add_parser(
|
|
13
|
+
"create",
|
|
14
|
+
description=apps_help,
|
|
15
|
+
help=apps_help,
|
|
16
|
+
parents=parents,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
parser.add_argument(
|
|
20
|
+
metavar="project_type",
|
|
21
|
+
choices=PROJECT_TYPES,
|
|
22
|
+
help="Type of project to create.",
|
|
23
|
+
dest="project_type",
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
parser.set_defaults(func=_create_project)
|
fal/cli/deploy.py
CHANGED
|
@@ -81,17 +81,18 @@ def _deploy(args):
|
|
|
81
81
|
|
|
82
82
|
user = _get_user()
|
|
83
83
|
host = FalServerlessHost(args.host)
|
|
84
|
-
isolated_function, app_name = load_function_from(
|
|
84
|
+
isolated_function, app_name, app_auth = load_function_from(
|
|
85
85
|
host,
|
|
86
86
|
file_path,
|
|
87
87
|
func_name,
|
|
88
88
|
)
|
|
89
89
|
app_name = args.app_name or app_name
|
|
90
|
+
app_auth = args.auth or app_auth or "private"
|
|
90
91
|
app_id = host.register(
|
|
91
92
|
func=isolated_function.func,
|
|
92
93
|
options=isolated_function.options,
|
|
93
94
|
application_name=app_name,
|
|
94
|
-
application_auth_mode=
|
|
95
|
+
application_auth_mode=app_auth,
|
|
95
96
|
metadata=isolated_function.options.host.get("metadata", {}),
|
|
96
97
|
)
|
|
97
98
|
|
|
@@ -151,7 +152,6 @@ def add_parser(main_subparsers, parents):
|
|
|
151
152
|
parser.add_argument(
|
|
152
153
|
"--auth",
|
|
153
154
|
type=valid_auth_option,
|
|
154
|
-
default="private",
|
|
155
155
|
help="Application authentication mode (private, public).",
|
|
156
156
|
)
|
|
157
157
|
parser.set_defaults(func=_deploy)
|
fal/cli/main.py
CHANGED
|
@@ -6,7 +6,7 @@ from fal import __version__
|
|
|
6
6
|
from fal.console import console
|
|
7
7
|
from fal.console.icons import CROSS_ICON
|
|
8
8
|
|
|
9
|
-
from . import apps, auth, deploy, doctor, keys, run, secrets
|
|
9
|
+
from . import apps, auth, create, deploy, doctor, keys, run, secrets
|
|
10
10
|
from .debug import debugtools, get_debug_parser
|
|
11
11
|
from .parser import FalParser, FalParserExit
|
|
12
12
|
|
|
@@ -31,7 +31,7 @@ def _get_main_parser() -> argparse.ArgumentParser:
|
|
|
31
31
|
required=True,
|
|
32
32
|
)
|
|
33
33
|
|
|
34
|
-
for cmd in [auth, apps, deploy, run, keys, secrets, doctor]:
|
|
34
|
+
for cmd in [auth, apps, deploy, run, keys, secrets, doctor, create]:
|
|
35
35
|
cmd.add_parser(subparsers, parents)
|
|
36
36
|
|
|
37
37
|
return parser
|
fal/cli/run.py
CHANGED
|
@@ -6,7 +6,7 @@ def _run(args):
|
|
|
6
6
|
from fal.utils import load_function_from
|
|
7
7
|
|
|
8
8
|
host = FalServerlessHost(args.host)
|
|
9
|
-
isolated_function, _ = load_function_from(host, *args.func_ref)
|
|
9
|
+
isolated_function, _, _ = load_function_from(host, *args.func_ref)
|
|
10
10
|
# let our exc handlers handle UserFunctionException
|
|
11
11
|
isolated_function.reraise = False
|
|
12
12
|
isolated_function()
|
fal/utils.py
CHANGED
|
@@ -10,13 +10,13 @@ def load_function_from(
|
|
|
10
10
|
host: FalServerlessHost,
|
|
11
11
|
file_path: str,
|
|
12
12
|
function_name: str | None = None,
|
|
13
|
-
) -> tuple[IsolatedFunction, str | None]:
|
|
13
|
+
) -> tuple[IsolatedFunction, str | None, str | None]:
|
|
14
14
|
import runpy
|
|
15
15
|
|
|
16
16
|
module = runpy.run_path(file_path)
|
|
17
17
|
if function_name is None:
|
|
18
18
|
fal_objects = {
|
|
19
|
-
|
|
19
|
+
obj_name: obj
|
|
20
20
|
for obj_name, obj in module.items()
|
|
21
21
|
if isinstance(obj, type)
|
|
22
22
|
and issubclass(obj, fal.App)
|
|
@@ -30,9 +30,12 @@ def load_function_from(
|
|
|
30
30
|
"Please specify the name of the app."
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
[(
|
|
33
|
+
[(function_name, obj)] = fal_objects.items()
|
|
34
|
+
app_name = obj.app_name
|
|
35
|
+
app_auth = obj.app_auth
|
|
34
36
|
else:
|
|
35
37
|
app_name = None
|
|
38
|
+
app_auth = None
|
|
36
39
|
|
|
37
40
|
if function_name not in module:
|
|
38
41
|
raise FalServerlessError(f"Function '{function_name}' not found in module")
|
|
@@ -44,10 +47,11 @@ def load_function_from(
|
|
|
44
47
|
target = module[function_name]
|
|
45
48
|
if isinstance(target, type) and issubclass(target, App):
|
|
46
49
|
app_name = target.app_name
|
|
50
|
+
app_auth = target.app_auth
|
|
47
51
|
target = wrap_app(target, host=host)
|
|
48
52
|
|
|
49
53
|
if not isinstance(target, IsolatedFunction):
|
|
50
54
|
raise FalServerlessError(
|
|
51
55
|
f"Function '{function_name}' is not a fal.function or a fal.App"
|
|
52
56
|
)
|
|
53
|
-
return target, app_name
|
|
57
|
+
return target, app_name, app_auth
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fal
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
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
|
|
@@ -34,6 +34,7 @@ Requires-Dist: websockets <13,>=12.0
|
|
|
34
34
|
Requires-Dist: pillow <11,>=10.2.0
|
|
35
35
|
Requires-Dist: pyjwt[crypto] <3,>=2.8.0
|
|
36
36
|
Requires-Dist: uvicorn <1,>=0.29.0
|
|
37
|
+
Requires-Dist: cookiecutter
|
|
37
38
|
Requires-Dist: importlib-metadata >=4.4 ; python_version < "3.10"
|
|
38
39
|
Provides-Extra: dev
|
|
39
40
|
Requires-Dist: fal[test] ; extra == 'dev'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
fal/__init__.py,sha256=wXs1G0gSc7ZK60-bHe-B2m0l_sA6TrFk4BxY0tMoLe8,784
|
|
2
2
|
fal/__main__.py,sha256=MSmt_5Xg84uHqzTN38JwgseJK8rsJn_11A8WD99VtEo,61
|
|
3
|
-
fal/_fal_version.py,sha256=
|
|
3
|
+
fal/_fal_version.py,sha256=XEVwqOPlIChKtEnSO5v_SvghWXnn9WeQSoJ436w3v9Y,411
|
|
4
4
|
fal/_serialization.py,sha256=rD2YiSa8iuzCaZohZwN_MPEB-PpSKbWRDeaIDpTEjyY,7653
|
|
5
5
|
fal/_version.py,sha256=EBGqrknaf1WygENX-H4fBefLvHryvJBBGtVJetaB0NY,266
|
|
6
|
-
fal/api.py,sha256=
|
|
7
|
-
fal/app.py,sha256=
|
|
6
|
+
fal/api.py,sha256=LAPl5Hf6ZWzEjv4lFUtsisWgrnXH_qNUHdJrEHT_A5Y,40602
|
|
7
|
+
fal/app.py,sha256=oyN4PNULFJtjOwHYrR5lh4Ks_zBi-dEPzvFYRUXe0sI,15877
|
|
8
8
|
fal/apps.py,sha256=FrKmaAUo8U9vE_fcva0GQvk4sCrzaTEr62lGtu3Ld5M,6825
|
|
9
9
|
fal/container.py,sha256=V7riyyq8AZGwEX9QaqRQDZyDN_bUKeRKV1OOZArXjL0,622
|
|
10
10
|
fal/flags.py,sha256=oWN_eidSUOcE9wdPK_77si3A1fpgOC0UEERPsvNLIMc,842
|
|
@@ -12,21 +12,22 @@ fal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
12
12
|
fal/rest_client.py,sha256=kGBGmuyHfX1lR910EoKCYPjsyU8MdXawT_cW2q8Sajc,568
|
|
13
13
|
fal/sdk.py,sha256=wA58DYnSK1vdsBi8Or9Z8kvMMEyBNfeZYk_xulSfTWE,20078
|
|
14
14
|
fal/sync.py,sha256=ZuIJA2-hTPNANG9B_NNJZUsO68EIdTH0dc9MzeVE2VU,4340
|
|
15
|
-
fal/utils.py,sha256=
|
|
15
|
+
fal/utils.py,sha256=4-V6iGSRd3kG_-UP6OdZp_-EhAkl3zectFlFKkCsS0Q,1884
|
|
16
16
|
fal/workflows.py,sha256=jx3tGy2R7cN6lLvOzT6lhhlcjmiq64iZls2smVrmQj0,14657
|
|
17
17
|
fal/auth/__init__.py,sha256=r8iA2-5ih7-Fik3gEC4HEWNFbGoxpYnXpZu1icPIoS0,3561
|
|
18
18
|
fal/auth/auth0.py,sha256=rSG1mgH-QGyKfzd7XyAaj1AYsWt-ho8Y_LZ-FUVWzh4,5421
|
|
19
19
|
fal/auth/local.py,sha256=sndkM6vKpeVny6NHTacVlTbiIFqaksOmw0Viqs_RN1U,1790
|
|
20
20
|
fal/cli/__init__.py,sha256=padK4o0BFqq61kxAA1qQ0jYr2SuhA2mf90B3AaRkmJA,37
|
|
21
|
-
fal/cli/apps.py,sha256
|
|
21
|
+
fal/cli/apps.py,sha256=-DDp-Gvxz5kHho5YjAhbri8vOny_9cftAI_wP2KR5nU,8175
|
|
22
22
|
fal/cli/auth.py,sha256=--MhfHGwxmtHbRkGioyn1prKn_U-pBzbz0G_QeZou-U,1352
|
|
23
|
+
fal/cli/create.py,sha256=a8WDq-nJLFTeoIXqpb5cr7GR7YR9ZZrQCawNm34KXXE,627
|
|
23
24
|
fal/cli/debug.py,sha256=u_urnyFzSlNnrq93zz_GXE9FX4VyVxDoamJJyrZpFI0,1312
|
|
24
|
-
fal/cli/deploy.py,sha256=
|
|
25
|
+
fal/cli/deploy.py,sha256=1e4OERVGtfwgM0VEFjlCLpNyuOl1BiLI-dx8u-71PVs,4817
|
|
25
26
|
fal/cli/doctor.py,sha256=U4ne9LX5gQwNblsYQ27XdO8AYDgbYjTO39EtxhwexRM,983
|
|
26
27
|
fal/cli/keys.py,sha256=trDpA3LJu9S27qE_K8Hr6fKLK4vwVzbxUHq8TFrV4pw,3157
|
|
27
|
-
fal/cli/main.py,sha256=
|
|
28
|
+
fal/cli/main.py,sha256=_Wh_DQc02qwh-ZN7v41lZm0lDR1WseViXVOcqUlyWLg,2009
|
|
28
29
|
fal/cli/parser.py,sha256=r1hd5e8Jq6yzDZw8-S0On1EjJbjRtHMuVuHC6MlvUj4,2835
|
|
29
|
-
fal/cli/run.py,sha256=
|
|
30
|
+
fal/cli/run.py,sha256=8wHNDruIr8i21JwbfFzS389C-y0jktM5zN5iDnJHsvA,873
|
|
30
31
|
fal/cli/secrets.py,sha256=740msFm7d41HruudlcfqUXlFl53N-WmChsQP9B9M9Po,2572
|
|
31
32
|
fal/console/__init__.py,sha256=ernZ4bzvvliQh5SmrEqQ7lA5eVcbw6Ra2jalKtA7dxg,132
|
|
32
33
|
fal/console/icons.py,sha256=De9MfFaSkO2Lqfne13n3PrYfTXJVIzYZVqYn5BWsdrA,108
|
|
@@ -115,8 +116,8 @@ openapi_fal_rest/models/workflow_node_type.py,sha256=-FzyeY2bxcNmizKbJI8joG7byRi
|
|
|
115
116
|
openapi_fal_rest/models/workflow_schema.py,sha256=4K5gsv9u9pxx2ItkffoyHeNjBBYf6ur5bN4m_zePZNY,2019
|
|
116
117
|
openapi_fal_rest/models/workflow_schema_input.py,sha256=2OkOXWHTNsCXHWS6EGDFzcJKkW5FIap-2gfO233EvZQ,1191
|
|
117
118
|
openapi_fal_rest/models/workflow_schema_output.py,sha256=EblwSPAGfWfYVWw_WSSaBzQVju296is9o28rMBAd0mc,1196
|
|
118
|
-
fal-1.2.
|
|
119
|
-
fal-1.2.
|
|
120
|
-
fal-1.2.
|
|
121
|
-
fal-1.2.
|
|
122
|
-
fal-1.2.
|
|
119
|
+
fal-1.2.2.dist-info/METADATA,sha256=ip9ta9NozUhujfW9CmFlgVrVmrvZztXkFFOCDCboQi0,3805
|
|
120
|
+
fal-1.2.2.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
|
121
|
+
fal-1.2.2.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
|
|
122
|
+
fal-1.2.2.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
|
|
123
|
+
fal-1.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|