Skip to content
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

Add Python 3.12 to test matrix and add classifiers #1096

Merged
merged 5 commits into from
Nov 20, 2023

Conversation

foarsitter
Copy link
Contributor

@foarsitter foarsitter commented Oct 31, 2023

djangorestframework-simplejwt is not yet compatible with Python 3.12. Took me a while to figure out that the real errors gets silenced.

try:
from rest_framework_simplejwt.authentication import (
JWTAuthentication, JWTTokenUserAuthentication,
)
from rest_framework_simplejwt.views import (
TokenObtainPairView, TokenObtainSlidingView, TokenRefreshView, TokenVerifyView,
)
except ImportError:
JWTAuthentication = None

Is this is something acceptable in a different PR I'm happily to submit.

except ImportError as e:
    if "rest_framework_simplejwt" in str(e):
        JWTAuthentication = None
    else:
        raise e

@foarsitter
Copy link
Contributor Author

Seems they have already fixed it: jazzband/djangorestframework-simplejwt#754

@foarsitter
Copy link
Contributor Author

foarsitter commented Nov 1, 2023

After installing setuptools the next error I'm running into is with dj_rest_auth buth the error doesn't make any sense to me.

    def get_token_serializer_class():
>       from dj_rest_auth.app_settings import JWTSerializer, TokenSerializer
E       ImportError: cannot import name 'JWTSerializer' from 'dj_rest_auth.app_settings' 

@tfranzel
Copy link
Owner

tfranzel commented Nov 1, 2023

Good question. I suppose the ecosystem is not there yet with 3.12

I have this issue on linux: https://stackoverflow.com/questions/77364550/attributeerror-module-pkgutil-has-no-attribute-impimporter-did-you-mean

And on mac I have pip issues with installing psyopg2-binary

So I couldn't even reproduce the issue here in the pipeline.

@tfranzel
Copy link
Owner

looks like this is essentially only blocked by jazzband/djangorestframework-simplejwt#762

We have a bug in the except clause. It is missing

JWTAuthentication = None
+ JWTTokenUserAuthentication = None

then everything "works", except simplejwt and 2 other contrib libraries that have interdependent imports going on.

Copy link

codecov bot commented Nov 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ad7e4a0) 98.58% compared to head (c515633) 98.58%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1096   +/-   ##
=======================================
  Coverage   98.58%   98.58%           
=======================================
  Files          68       68           
  Lines        8462     8462           
=======================================
  Hits         8342     8342           
  Misses        120      120           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tfranzel
Copy link
Owner

looks good to me. thx @foarsitter.

though I'm a bit confused why simplejwt now passes for 3.12, given that they have not released and we didn't change much. I'll merge it.

@tfranzel tfranzel merged commit 82c00f8 into tfranzel:master Nov 20, 2023
33 checks passed
@foarsitter
Copy link
Contributor Author

Thats indeed strange. There has to be a change in a underlying lib or something.

Thanks for merging!

@foarsitter foarsitter deleted the py312 branch November 20, 2023 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants