fal 0.15.2__py3-none-any.whl → 1.0.0__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/__init__.py +4 -0
- fal/__main__.py +2 -2
- fal/_fal_version.py +16 -0
- fal/_version.py +6 -0
- fal/api.py +10 -1
- fal/app.py +29 -1
- fal/cli/__init__.py +1 -0
- fal/cli/apps.py +313 -0
- fal/cli/auth.py +59 -0
- fal/cli/debug.py +65 -0
- fal/cli/deploy.py +146 -0
- fal/cli/keys.py +118 -0
- fal/cli/main.py +82 -0
- fal/cli/parser.py +74 -0
- fal/cli/run.py +33 -0
- fal/cli/secrets.py +107 -0
- fal/exceptions/__init__.py +0 -29
- fal/flags.py +0 -1
- fal/sdk.py +1 -0
- fal/utils.py +55 -0
- {fal-0.15.2.dist-info → fal-1.0.0.dist-info}/METADATA +2 -2
- {fal-0.15.2.dist-info → fal-1.0.0.dist-info}/RECORD +25 -14
- fal-1.0.0.dist-info/entry_points.txt +2 -0
- fal/cli.py +0 -622
- fal/exceptions/handlers.py +0 -58
- fal-0.15.2.dist-info/entry_points.txt +0 -2
- {fal-0.15.2.dist-info → fal-1.0.0.dist-info}/WHEEL +0 -0
- {fal-0.15.2.dist-info → fal-1.0.0.dist-info}/top_level.txt +0 -0
fal/exceptions/handlers.py
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import TYPE_CHECKING, Generic, TypeVar
|
|
4
|
-
|
|
5
|
-
from grpc import Call as RpcCall
|
|
6
|
-
|
|
7
|
-
from fal.console import console
|
|
8
|
-
from fal.console.icons import CROSS_ICON
|
|
9
|
-
|
|
10
|
-
if TYPE_CHECKING:
|
|
11
|
-
from fal.api import UserFunctionException
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
ExceptionType = TypeVar("ExceptionType", bound=BaseException)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class BaseExceptionHandler(Generic[ExceptionType]):
|
|
18
|
-
"""Base handler defaults to the string representation of the error"""
|
|
19
|
-
|
|
20
|
-
def should_handle(self, _: Exception) -> bool:
|
|
21
|
-
return True
|
|
22
|
-
|
|
23
|
-
def handle(self, exception: ExceptionType):
|
|
24
|
-
msg = f"{CROSS_ICON} {str(exception)}"
|
|
25
|
-
cause = exception.__cause__
|
|
26
|
-
if cause is not None:
|
|
27
|
-
msg += f": {str(cause)}"
|
|
28
|
-
console.print(msg)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class GrpcExceptionHandler(BaseExceptionHandler[RpcCall]):
|
|
32
|
-
"""Handle GRPC errors. The user message is part of the `details()`"""
|
|
33
|
-
|
|
34
|
-
def should_handle(self, exception: Exception) -> bool:
|
|
35
|
-
return isinstance(exception, RpcCall)
|
|
36
|
-
|
|
37
|
-
def handle(self, exception: RpcCall):
|
|
38
|
-
console.print(exception.details())
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class UserFunctionExceptionHandler(BaseExceptionHandler["UserFunctionException"]):
|
|
42
|
-
def should_handle(self, exception: Exception) -> bool:
|
|
43
|
-
from fal.api import UserFunctionException
|
|
44
|
-
|
|
45
|
-
return isinstance(exception, UserFunctionException)
|
|
46
|
-
|
|
47
|
-
def handle(self, exception: UserFunctionException):
|
|
48
|
-
import rich
|
|
49
|
-
|
|
50
|
-
cause = exception.__cause__
|
|
51
|
-
exc = cause or exception
|
|
52
|
-
tb = rich.traceback.Traceback.from_exception(
|
|
53
|
-
type(exc),
|
|
54
|
-
exc,
|
|
55
|
-
exc.__traceback__,
|
|
56
|
-
)
|
|
57
|
-
console.print(tb)
|
|
58
|
-
super().handle(exception)
|
|
File without changes
|
|
File without changes
|