1{ 2 lib, 3 buildPythonPackage, 4 django, 5 django-allauth, 6 djangorestframework, 7 djangorestframework-simplejwt, 8 fetchFromGitHub, 9 fetchpatch, 10 python, 11 responses, 12 setuptools, 13 unittest-xml-reporting, 14 pytestCheckHook, 15 pytest-django, 16}: 17 18buildPythonPackage rec { 19 pname = "dj-rest-auth"; 20 version = "7.0.1"; 21 pyproject = true; 22 23 src = fetchFromGitHub { 24 owner = "iMerica"; 25 repo = "dj-rest-auth"; 26 tag = version; 27 hash = "sha256-bus7Sf5H4PA5YFrkX7hbALOq04koDz3KTO42hHFJPhw="; 28 }; 29 30 patches = [ 31 # See https://github.com/iMerica/dj-rest-auth/pull/683 32 (fetchpatch { 33 name = "djangorestframework-simplejwt_5.5_compatibility.patch"; 34 url = "https://github.com/iMerica/dj-rest-auth/commit/cc5587e4e3f327697709f3f0d491650bff5464e7.diff"; 35 hash = "sha256-2LahibxuNECAfjqsbNs2ezaWt1VH0ZBNwSNWCZwIe8I="; 36 }) 37 # Add compatibility with django-allauth v65.4 38 # See https://github.com/iMerica/dj-rest-auth/pull/681 39 (fetchpatch { 40 name = "django-allauth_65.4_compatibility.patch"; 41 url = "https://github.com/iMerica/dj-rest-auth/commit/59b8cab7e2f4e3f2fdc11ab3b027a32cad45deef.patch"; 42 hash = "sha256-CH85vB3EOQvFxx+ZP2LYI4LEvaZ+ccLdXZGuAvEfStc="; 43 }) 44 ]; 45 46 postPatch = '' 47 substituteInPlace setup.py \ 48 --replace-fail "==" ">=" 49 ''; 50 51 build-system = [ setuptools ]; 52 53 buildInputs = [ django ]; 54 55 dependencies = [ djangorestframework ]; 56 57 optional-dependencies.with_social = [ 58 django-allauth 59 ] 60 ++ django-allauth.optional-dependencies.socialaccount; 61 62 nativeCheckInputs = [ 63 djangorestframework-simplejwt 64 responses 65 unittest-xml-reporting 66 ] 67 ++ optional-dependencies.with_social; 68 69 checkInputs = [ 70 pytestCheckHook 71 pytest-django 72 ]; 73 74 env.DJANGO_SETTINGS_MODULE = "dj_rest_auth.tests.settings"; 75 76 preCheck = '' 77 # Make tests module available for the checkPhase 78 export PYTHONPATH=$out/${python.sitePackages}/dj_rest_auth:$PYTHONPATH 79 ''; 80 81 disabledTests = [ 82 # Test connects to graph.facebook.com 83 "TestSocialLoginSerializer" 84 # claim[user_id] is "1" (str) vs 1 (int) 85 "test_custom_jwt_claims" 86 "test_custom_jwt_claims_cookie_w_authentication" 87 ]; 88 89 disabledTestPaths = [ 90 # Test fails with > django-allauth 65.4 91 # See: https://github.com/iMerica/dj-rest-auth/pull/681#issuecomment-3034953311 92 "dj_rest_auth/tests/test_social.py" 93 ]; 94 95 pythonImportsCheck = [ "dj_rest_auth" ]; 96 97 meta = { 98 description = "Authentication for Django Rest Framework"; 99 homepage = "https://github.com/iMerica/dj-rest-auth"; 100 changelog = "https://github.com/iMerica/dj-rest-auth/releases/tag/${version}"; 101 license = lib.licenses.mit; 102 maintainers = with lib.maintainers; [ onny ]; 103 }; 104}