Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions backend/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3

from contextlib import asynccontextmanager
import os
import logging
from pathlib import Path
Expand Down Expand Up @@ -29,19 +30,23 @@ def _read_app_version() -> str:

APP_VERSION = _read_app_version()


@asynccontextmanager
async def lifespan(_app: FastAPI):
"""Log version information on startup."""
logger.info(f"Lance Data Viewer v{APP_VERSION}")
logger.info(f"LanceDB: {lancedb.__version__}, PyArrow: {pa.__version__}")
logger.info(f"Data path: {DATA_PATH}")
yield


app = FastAPI(
title="Lance Data Viewer",
description="Read-only web viewer for Lance datasets",
version=APP_VERSION,
lifespan=lifespan,
)

@app.on_event("startup")
async def startup_event():
"""Log version information on startup"""
logger.info(f"Lance Data Viewer v{APP_VERSION}")
logger.info(f"LanceDB: {lancedb.__version__}, PyArrow: {pa.__version__}")
logger.info(f"Data path: {DATA_PATH}")

app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
Expand Down