{ lib, buildPythonPackage, django, django-allauth, djangorestframework, djangorestframework-simplejwt, fetchFromGitHub, fetchpatch, python, responses, setuptools, unittest-xml-reporting, pytestCheckHook, pytest-django, }: buildPythonPackage rec { pname = "dj-rest-auth"; version = "7.0.2"; pyproject = true; src = fetchFromGitHub { owner = "iMerica"; repo = "dj-rest-auth"; tag = version; hash = "sha256-tgcEnB9n9pq+TBde8udsr8osdAAJqmXaaU1Wt2psPIw="; }; patches = [ # See https://github.com/iMerica/dj-rest-auth/pull/683 (fetchpatch { name = "djangorestframework-simplejwt_5.5_compatibility.patch"; url = "https://github.com/iMerica/dj-rest-auth/commit/cc5587e4e3f327697709f3f0d491650bff5464e7.diff"; hash = "sha256-2LahibxuNECAfjqsbNs2ezaWt1VH0ZBNwSNWCZwIe8I="; }) ]; postPatch = '' substituteInPlace setup.py \ --replace-fail "==" ">=" ''; build-system = [ setuptools ]; buildInputs = [ django ]; dependencies = [ djangorestframework ]; optional-dependencies.with_social = [ django-allauth ] ++ django-allauth.optional-dependencies.socialaccount; nativeCheckInputs = [ djangorestframework-simplejwt responses unittest-xml-reporting ] ++ optional-dependencies.with_social; checkInputs = [ pytestCheckHook pytest-django ]; env.DJANGO_SETTINGS_MODULE = "dj_rest_auth.tests.settings"; preCheck = '' # Make tests module available for the checkPhase export PYTHONPATH=$out/${python.sitePackages}/dj_rest_auth:$PYTHONPATH ''; disabledTests = [ # Test connects to graph.facebook.com "TestSocialLoginSerializer" # claim[user_id] is "1" (str) vs 1 (int) "test_custom_jwt_claims" "test_custom_jwt_claims_cookie_w_authentication" ]; disabledTestPaths = [ # Test fails with > django-allauth 65.4 # See: https://github.com/iMerica/dj-rest-auth/pull/681#issuecomment-3034953311 "dj_rest_auth/tests/test_social.py" ]; pythonImportsCheck = [ "dj_rest_auth" ]; meta = { description = "Authentication for Django Rest Framework"; homepage = "https://github.com/iMerica/dj-rest-auth"; changelog = "https://github.com/iMerica/dj-rest-auth/releases/tag/${src.tag}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ onny ]; }; }