-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Async compatible debug-toolbar middleware #1938
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
Conversation
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.
Thanks!
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.
LGTM. I wonder how the panels can differentiate in process_request
between the sync and async version. Also, await
ing def process_request
(NOT async def process_request
) looks a bit strange, but seems fine to me after thinking about it a bit.
panels would receive either
it even adapts the view if its not this is my overall understanding so far. |
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.
This is coming along nicely! Thank you for all your work. I have a few comments on particular aspects. We also need to document the new panel API before this can be merged in.
I have changed the approach to test async panel compatibility tests. |
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.
Code-wise, this is great! Thank you Aman. I think we need to update the docs in two areas:
- Change
Panel.is_async
to a@property
method with a doc string, then update https://github.com/jazzband/django-debug-toolbar/blob/main/docs/panels.rst?plain=1#L332 to include that attribute in the documentation. - Update the architecture document here: https://github.com/jazzband/django-debug-toolbar/blob/9bcd6cac17fd1721d60c2b1b8218884caf0ee45e/docs/architecture.rst?plain=1#L82-L84
Sorry for the nit pick question but should we use |
Not a nitpick at all. It's a good question @salty-ivy! My instinct is to go with |
Autogenerating documentation from code is always a workaround for lazyness (I like it a lot!) but I'm not sure we should uglify the code just for that. I thought that adding a |
TIL, then let's go with what Matthias suggested. Thank you for pointing that out |
If you search this page for So, if the autodoc support is the only reason for converting the attribute to a property I think I'm -0 on it. No strong opposition certainly, I just don't see the need for it. |
I wanted the autodoc and then thought it would bring consistency to the API. Though you and @salty-ivy both questioning it is enough for me to agree to having it as an attribute. |
So we are left with this only while keeping |
Sounds good. |
Not sure, may be something related to sphinx missing in the updated docs to throw the lint error? |
@salty-ivy it can be hard to read the docs failures:
You need to change |
ahh, how can I miss this, thank you so much. Interestingly It even fails on |
See! I didn't even catch that other one. I thought it was two lines because the word was used twice on that line 😁 |
extract redudant code in _postprocess disable non async capable panels add middleware sync and async compatible test case rename file add panel async compatibility tests/ added panel async compatibility tests/ marked erreneous panels as non async refactor panel test Add function docstrings update async panel compatibility tests revert middleware back to __call__ and __acall__ approach update architecture.rst documentation fix typo in docs remove ASGI keyword from docs
8a55336
to
25656ee
Compare
I squashed the commits down to one, cleaned up the commit message, and rebased on main. After tests pass, I'll merge it in |
Description
GSoC 2024
This PR aims to add async compatibility in django-debug-toolbar middleware
Fixes # (issue)
Checklist:
docs/changes.rst
.