-
Notifications
You must be signed in to change notification settings - Fork 34
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
Reimplement async support #209
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #209 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 41 41
Lines 1272 1104 -168
==========================================
- Hits 1272 1104 -168
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
I tried to run 5.0.0 at us, we have python 3.9 and django 3.2.15
It looks like it may be dependency issue for Python 3.9 (at least) in the library. Moreover, when bumping django-structlog to 5.0.0 and generating requirements, asgiref doesn't bump itself to 3.6.0 but stays at 3.5.0. Looks like django-structlog in 5.0.0 still uses asgiref==3.5.0 since iscoroutinefunction and markcoroutinefunction are available from 3.6.0 IIUC Do you have any idea why it could work like that? |
I did not noticed it was recently added in asgiref. The problem is in django-structlog's pyproject.toml line 19. I am not specifying a minimum version for asgiref. |
Do you have an idea how to deal with it? I understand that it should work if we manually install version 3.6 of asgiref, however it doesn't work with django-structlog version 5.0.0 |
What does not work with |
Looks like I've fix it right now. |
I am currently working on 5.0.1 that will explicitly fix this issue. |
@jrobichaud Seems to be in order. Thank you once again! |
I confirm #212 and 5.0.1 fixes the problem. Here's a proof. I first install django-structlog==5.0.0 asgiref==3.5.0: $ python3 -m venv ./venv
$ source ./venv/bin/activate
$ pip install django-structlog==5.0.0 asgiref==3.5.0
Collecting django-structlog==5.0.0
Downloading django_structlog-5.0.0-py3-none-any.whl (13 kB)
Collecting asgiref==3.5.0
Downloading asgiref-3.5.0-py3-none-any.whl (22 kB)
Collecting structlog>=21.4.0
Using cached structlog-22.3.0-py3-none-any.whl (61 kB)
Collecting django-ipware
Using cached django_ipware-5.0.0-py2.py3-none-any.whl (9.4 kB)
Collecting django>=3.2
Using cached Django-3.2.18-py3-none-any.whl (7.9 MB)
Collecting typing-extensions; python_version < "3.8"
Using cached typing_extensions-4.5.0-py3-none-any.whl (27 kB)
Collecting importlib-metadata; python_version < "3.8"
Using cached importlib_metadata-6.1.0-py3-none-any.whl (21 kB)
Collecting pytz
Using cached pytz-2022.7.1-py2.py3-none-any.whl (499 kB)
Collecting sqlparse>=0.2.2
Using cached sqlparse-0.4.3-py3-none-any.whl (42 kB)
Collecting zipp>=0.5
Using cached zipp-3.15.0-py3-none-any.whl (6.8 kB)
Installing collected packages: typing-extensions, zipp, importlib-metadata, structlog, asgiref, django-ipware, pytz, sqlparse, django, django-structlog
Successfully installed asgiref-3.5.0 django-3.2.18 django-ipware-5.0.0 django-structlog-5.0.0 importlib-metadata-6.1.0 pytz-2022.7.1 sqlparse-0.4.3 structlog-22.3.0 typing-extensions-4.5.0 zipp-3.15.0 Then explicitly install only django-structlog==5.0.1. $ pip install django-structlog==5.0.1
Collecting django-structlog==5.0.1
Downloading django_structlog-5.0.1-py3-none-any.whl (13 kB)
Requirement already satisfied: django-ipware in ./venv/lib/python3.7/site-packages (from django-structlog==5.0.1) (5.0.0)
Collecting asgiref>=3.6.0
Using cached asgiref-3.6.0-py3-none-any.whl (23 kB)
Requirement already satisfied: django>=3.2 in ./venv/lib/python3.7/site-packages (from django-structlog==5.0.1) (3.2.18)
Requirement already satisfied: structlog>=21.4.0 in ./venv/lib/python3.7/site-packages (from django-structlog==5.0.1) (22.3.0)
Requirement already satisfied: typing-extensions; python_version < "3.8" in ./venv/lib/python3.7/site-packages (from asgiref>=3.6.0->django-structlog==5.0.1) (4.5.0)
Requirement already satisfied: sqlparse>=0.2.2 in ./venv/lib/python3.7/site-packages (from django>=3.2->django-structlog==5.0.1) (0.4.3)
Requirement already satisfied: pytz in ./venv/lib/python3.7/site-packages (from django>=3.2->django-structlog==5.0.1) (2022.7.1)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in ./venv/lib/python3.7/site-packages (from structlog>=21.4.0->django-structlog==5.0.1) (6.1.0)
Requirement already satisfied: zipp>=0.5 in ./venv/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->structlog>=21.4.0->django-structlog==5.0.1) (3.15.0)
Installing collected packages: asgiref, django-structlog
Attempting uninstall: asgiref
Found existing installation: asgiref 3.5.0
Uninstalling asgiref-3.5.0:
Successfully uninstalled asgiref-3.5.0
Attempting uninstall: django-structlog
Found existing installation: django-structlog 5.0.0
Uninstalling django-structlog-5.0.0:
Successfully uninstalled django-structlog-5.0.0
Successfully installed asgiref-3.6.0 django-structlog-5.0.1 asgiref is correctly updated. |
RequestMiddleware
now properly handles sync/async requests