-
Notifications
You must be signed in to change notification settings - Fork 136
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
chore: address deprecations caused by updating packages #570
Conversation
locking until further action due to psf/black#4175 most likely course of action is to get rid of reorder-python-imports
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
caused by updating akatsuki-pp-py version
Ansi.LMAGENTA, | ||
) | ||
|
||
yield # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mypy will scream about not returning anything with yield
without this but the typedef expects Never
we could also yield a dictionary e.g.
yield {
"db": db,
"redis": redis,
"crypto_model": crypto_model,
"osu_service": osu_service,
"stats_service": stats_service,
}
and then it would be available under request.state
instead of request.app.state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just want to make sure, is this a 1:1 copy other than the yield?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep
@@ -239,5 +239,5 @@ async def test_score_submission( | |||
assert response.status_code == status.HTTP_200_OK | |||
assert ( | |||
response.read() | |||
== b"beatmapId:315|beatmapSetId:141|beatmapPlaycount:1|beatmapPasscount:1|approvedDate:2014-05-18 15:41:48|\n|chartId:beatmap|chartUrl:https://osu.cmyui.xyz/s/141|chartName:Beatmap Ranking|rankBefore:|rankAfter:1|rankedScoreBefore:|rankedScoreAfter:26810|totalScoreBefore:|totalScoreAfter:26810|maxComboBefore:|maxComboAfter:52|accuracyBefore:|accuracyAfter:81.94|ppBefore:|ppAfter:9.56523|onlineScoreId:1|\n|chartId:overall|chartUrl:https://cmyui.xyz/u/3|chartName:Overall Ranking|rankBefore:|rankAfter:1|rankedScoreBefore:|rankedScoreAfter:26810|totalScoreBefore:|totalScoreAfter:26810|maxComboBefore:|maxComboAfter:52|accuracyBefore:|accuracyAfter:81.94|ppBefore:|ppAfter:10|achievements-new:osu-skill-pass-4+Insanity Approaches+You're not twitching, you're just ready./all-intro-hidden+Blindsight+I can see just perfectly" | |||
== b"beatmapId:315|beatmapSetId:141|beatmapPlaycount:1|beatmapPasscount:1|approvedDate:2014-05-18 15:41:48|\n|chartId:beatmap|chartUrl:https://osu.cmyui.xyz/s/141|chartName:Beatmap Ranking|rankBefore:|rankAfter:1|rankedScoreBefore:|rankedScoreAfter:26810|totalScoreBefore:|totalScoreAfter:26810|maxComboBefore:|maxComboAfter:52|accuracyBefore:|accuracyAfter:81.94|ppBefore:|ppAfter:10.04103|onlineScoreId:1|\n|chartId:overall|chartUrl:https://cmyui.xyz/u/3|chartName:Overall Ranking|rankBefore:|rankAfter:1|rankedScoreBefore:|rankedScoreAfter:26810|totalScoreBefore:|totalScoreAfter:26810|maxComboBefore:|maxComboAfter:52|accuracyBefore:|accuracyAfter:81.94|ppBefore:|ppAfter:10|achievements-new:osu-skill-pass-4+Insanity Approaches+You're not twitching, you're just ready./all-intro-hidden+Blindsight+I can see just perfectly" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated value due to changed pp calcs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should prolly use snapshot tests for tests like these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also the test suite runs on the docker-compose db rn which is super weird - we should be spinning up a temp db & running migrations every time we run tests
@@ -263,7 +263,7 @@ async def main(argv: Sequence[str] | None = None) -> int: | |||
|
|||
await app.state.services.http_client.aclose() | |||
await db.disconnect() | |||
await redis.close() | |||
await redis.aclose() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
close()
is deprecated as of 5.0.1
+1 👍🏻 |
@@ -64,6 +67,57 @@ def openapi(self) -> dict[str, Any]: | |||
return self.openapi_schema | |||
|
|||
|
|||
@asynccontextmanager | |||
async def lifespan(asgi_app: BanchoAPI) -> AsyncIterator[Never]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be AsyncIterator[None]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i remember trying that and it failing mypy
Describe your changes
RFC. This is the minimal required to get it into a working state. See: https://fastapi.tiangolo.com/advanced/events/#lifespan
Breaking changes spotted:
As a side effect, we now should technically support Python 3.12
Other things of note:
We may support Pytest 8 soon once pytest-asyncio v23.5 is out of alpha. pytest-dev/pytest-asyncio#737 (comment)done in #571Related Issues / Projects
Depends on #568
Checklist