Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate on event and replace it with app lifespan #140

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Removed the example of an old json submission (before 2022-11-21)
- Updated actions using the latest base images and to run using Python 3.9
- Docker image uses Python 3.11 instead of 3.8
- Replaced deprecated app "on event" with app lifespan
### Fixed
- Updated issue templates
- Updated a number of libraries to address all current security advisories
Expand Down
11 changes: 7 additions & 4 deletions preClinVar/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import logging
import re
from contextlib import asynccontextmanager
from typing import List

import requests
Expand All @@ -16,16 +17,18 @@

LOG = logging.getLogger("uvicorn.access")

app = FastAPI()


@app.on_event("startup")
async def startup_event():
@asynccontextmanager
async def lifespan(app_: FastAPI):

Check failure on line 22 in preClinVar/main.py

View workflow job for this annotation

GitHub Actions / vulture

unused variable 'app_' (100% confidence)
LOG = logging.getLogger("uvicorn.access")
console_formatter = uvicorn.logging.ColourizedFormatter(
"{levelprefix} {asctime} : {message}", style="{", use_colors=True
)
LOG.handlers[0].setFormatter(console_formatter)
yield


app = FastAPI(lifespan=lifespan)


@app.get("/")
Expand Down
Loading