Skip to content

Commit

Permalink
feat(app): print installed packages on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Jan 13, 2025
1 parent 8b6740c commit 64a18dd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions projects/fal/src/fal/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

print("Python packages installed:")
for package in working_set:
print(f"{package.key}=={package.version}")


class App(fal.api.BaseServable):
requirements: ClassVar[list[str]] = []
machine_type: ClassVar[str] = "S"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 64a18dd

Please sign in to comment.