♻️ Ignore on_event is deprecated deprecation warnings, fix ValidationError import warning#1600
♻️ Ignore on_event is deprecated deprecation warnings, fix ValidationError import warning#1600YuriiMotov wants to merge 3 commits intofastapi:mainfrom
on_event is deprecated deprecation warnings, fix ValidationError import warning#1600Conversation
📝 Docs previewLast commit 1235d73 at: https://82260756.sqlmodel.pages.dev |
#958 uses blocking function inside async lifespan function. That's not a good practice.. @asynccontextmanager
async def lifespan(app: FastAPI):
create_db_and_tables()
yieldWe can update it to run it in the threadpool, but it will make the code example more complicated.. |
|
The amount of warning messages when running tests on main is daunting, and the changes here are a great help (well worth the effort of patching them in locally). 👍
|
I personally do think that we should update the tutorial files to use non-deprecated functions, to showcase best practices for our users. But maybe run it by Sebastián first to see what he thinks? |
svlandeg
left a comment
There was a problem hiding this comment.
Talked to Yurii briefly offline, this is just a temp fix and will be addressed more properly in the future. As such, I think this is good to merge 🎉
Currently we have a lot of deprecation warnings because we use
fastapi.on_eventin docs examples.These warnings are useless and make it hard to read log of tests.
I suggest we just ignore "on_event is deprecated" warnings globally.
I also fixed import of
ValidationErrorwhich also produced a deprecation warning.With Pydantic V2 we still have 1 type of warnings:
Not sure how to fix this one..
See log
With Pydantic V1 we still have a lot of warnings, but they are not easily fixable.
Anyway, with this PR we will have less warnings and it will be easier to review test logs