From 1d1bddddfa66a950b441feb37f0f43ed52003466 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Mon, 13 Jan 2025 18:15:40 +0200 Subject: [PATCH] feat(app): print installed packages on startup (#384) --- projects/fal/src/fal/app.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/fal/src/fal/app.py b/projects/fal/src/fal/app.py index 7b41e2dc..9cb197ee 100644 --- a/projects/fal/src/fal/app.py +++ b/projects/fal/src/fal/app.py @@ -248,6 +248,14 @@ def _to_fal_app_name(name: str) -> str: return "-".join(part.lower() for part in PART_FINDER_RE.findall(name)) +def _print_python_packages() -> None: + from pkg_resources import working_set + + packages = [f"{package.key}=={package.version}" for package in working_set] + + print("[debug] Python packages installed:", ", ".join(packages)) + + class App(fal.api.BaseServable): requirements: ClassVar[list[str]] = [] machine_type: ClassVar[str] = "S" @@ -305,6 +313,7 @@ def collect_routes(self) -> dict[RouteSignature, Callable[..., Any]]: @asynccontextmanager async def lifespan(self, app: fastapi.FastAPI): + _print_python_packages() await _call_any_fn(self.setup) try: yield