Styria-Digital / django-rest-framework-jwt

JSON Web Token Authentication support for Django REST Framework
https://styria-digital.github.io/django-rest-framework-jwt/
MIT License
191 stars 57 forks source link

Django 4.0 Support #106

Closed acc248 closed 2 years ago

acc248 commented 2 years ago

Django 4.0 dropped today which removed django.conf.urls.url(). It looks like we're getting an import error here and subsequently here e.g.

ImportError: Could not import 'rest_framework_jwt.authentication.JSONWebTokenAuthentication' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'. ImportError: cannot import name 'url' from 'django.urls' (/usr/local/lib/python3.8/dist-packages/django/urls/__init__.py).

I did a bit of searching through the codebase and it looks like we could switch to re_path or path for this project but I'm not 100% sure. Wanted to file an issue to get the ball rolling on a solution.

JosephUrciuoli commented 2 years ago

@acc248 I was just writing this up. Having the same issue.

linuxlewis commented 2 years ago

We're seeing this issue as well. Happy to push up a PR if needed

andylamp commented 2 years ago

likewise, we encountered the same issue, eager to get an ETA on when someone can land a PR (that can be swiftly accepted and pushed to pypi)

acc248 commented 2 years ago

Checked out CONTRIBUTING.md and got the test suite running. I tried to add Django 4.0 to tox.ini and run the tests but getting pytz import errors in drf now. Doesn't look they've cut a release beyond 3.12 but it seems like pytz shouldn't actually be deprecated until Django 5 according to the release notes.

tox -e py39-dj40-drf312 -- --cov=rest_framework_jwt

/Users/acc248/source/django-rest-framework-jwt/.tox/py39-dj40-drf312/lib/python3.9/site-packages/setuptools/config.py:510: DeprecationWarning: The license_file parameter is deprecated, use license_files instead.
  warnings.warn(msg, warning_class)
py39-dj40-drf312 develop-inst-noop: /Users/acc248/source/django-rest-framework-jwt
py39-dj40-drf312 installed: asgiref==3.4.1,attrs==21.2.0,cffi==1.15.0,coverage==6.2,cryptography==3.3.2,Django==4.0,djangorestframework==3.12.4,-e git+https://github.com/Styria-Digital/django-rest-framework-jwt.git@b2d7a8de55583133c8e3a8810071d906b31614e4#egg=drf_jwt,iniconfig==1.1.1,mock==4.0.3,packaging==21.3,pluggy==1.0.0,py==1.11.0,pycparser==2.21,PyJWT==2.3.0,pyparsing==3.0.6,pytest==6.2.5,pytest-cov==3.0.0,pytest-django==4.5.2,pytest-runner==5.3.1,six==1.16.0,sqlparse==0.4.2,toml==0.10.2,tomli==1.2.2
py39-dj40-drf312 run-test-pre: PYTHONHASHSEED='1309023437'
py39-dj40-drf312 run-test: commands[0] | pytest --cov=rest_framework_jwt --cov=rest_framework_jwt
/Users/acc248/source/django-rest-framework-jwt/.tox/py39-dj40-drf312/lib/python3.9/site-packages/django/conf/__init__.py:222: RemovedInDjango50Warning: The USE_L10N setting is deprecated. Starting with Django 5.0, localized formatting of data will always be enabled. For example Django will display numbers and dates using the format of the current locale.
  warnings.warn(USE_L10N_DEPRECATED_MSG, RemovedInDjango50Warning)
/Users/acc248/source/django-rest-framework-jwt/.tox/py39-dj40-drf312/lib/python3.9/site-packages/django/apps/registry.py:91: RemovedInDjango41Warning: 'rest_framework_jwt.blacklist' defines default_app_config = 'rest_framework_jwt.blacklist.apps.BlacklistedTokenConfig'. Django now detects this configuration automatically. You can remove default_app_config.
  app_config = AppConfig.create(entry)
/Users/acc248/source/django-rest-framework-jwt/.tox/py39-dj40-drf312/lib/python3.9/site-packages/django/apps/registry.py:91: RemovedInDjango41Warning: 'app' defines default_app_config = 'app.apps.AppConfig'. Django now detects this configuration automatically. You can remove default_app_config.
  app_config = AppConfig.create(entry)
ImportError while loading conftest '/Users/acc248/source/django-rest-framework-jwt/tests/conftest.py'.
tests/conftest.py:10: in <module>
    from rest_framework.test import APIClient
.tox/py39-dj40-drf312/lib/python3.9/site-packages/rest_framework/test.py:138: in <module>
    class APIRequestFactory(DjangoRequestFactory):
.tox/py39-dj40-drf312/lib/python3.9/site-packages/rest_framework/test.py:139: in APIRequestFactory
    renderer_classes_list = api_settings.TEST_REQUEST_RENDERER_CLASSES
.tox/py39-dj40-drf312/lib/python3.9/site-packages/rest_framework/settings.py:225: in __getattr__
    val = perform_import(val, attr)
.tox/py39-dj40-drf312/lib/python3.9/site-packages/rest_framework/settings.py:168: in perform_import
    return [import_from_string(item, setting_name) for item in val]
.tox/py39-dj40-drf312/lib/python3.9/site-packages/rest_framework/settings.py:168: in <listcomp>
    return [import_from_string(item, setting_name) for item in val]
.tox/py39-dj40-drf312/lib/python3.9/site-packages/rest_framework/settings.py:180: in import_from_string
    raise ImportError(msg)
E   ImportError: Could not import 'rest_framework.renderers.MultiPartRenderer' for API setting 'TEST_REQUEST_RENDERER_CLASSES'. ModuleNotFoundError: No module named 'pytz'.
ERROR: InvocationError for command /Users/acc248/source/django-rest-framework-jwt/.tox/py39-dj40-drf312/bin/pytest --cov=rest_framework_jwt --cov=rest_framework_jwt (exited with code 4)
__________________________________________________ summary ___________________________________________________
ERROR:   py39-dj40-drf312: commands failed
andylamp commented 2 years ago

nothing still...? any response from a maintainer would be great...

john-whiting commented 2 years ago

I created a PR for this and have tested it locally. If a maintainer sees this, this fix has been implemented: https://github.com/Styria-Digital/django-rest-framework-jwt/pull/107

andylamp commented 2 years ago

now it is up to the maintainers to approve this - I cannot find who is directly responsible for this but a tag for them to notice would actually be nice...

john-whiting commented 2 years ago

I believe @fitodic is the current active maintainer.

andylamp commented 2 years ago

thanks for the update and also for the tagging, @john-whiting - let's hope we can resolve this soon enough.

andylamp commented 2 years ago

@fitodic is there any progress regarding this?

slumtrimpet commented 2 years ago

@fitodic @ajhi @dskalec @igadmile @ntuckovic Any chance we can get some love here, please? This is becoming a serious roadblock.

fitodic commented 2 years ago

Hi, sorry for the delay. I just merged it and released 1.19.2

ntuckovic commented 2 years ago

👋 to all!

as, @fitodic commented, he just accepted PR https://github.com/Styria-Digital/django-rest-framework-jwt/pull/107

In this occasion I would like to ask you if any of you is interested to join as an active maintainer to this repo?

Let me know so we could add you appropriate user permissions for PR acceptance.

Regards and happy new year to all!