1{
2 lib,
3 blinker,
4 buildPythonPackage,
5 cryptography,
6 fetchFromGitHub,
7 mock,
8 pyjwt,
9 pytestCheckHook,
10 pythonAtLeast,
11 pythonOlder,
12 setuptools,
13
14 # for passthru.tests
15 django-allauth,
16 django-oauth-toolkit,
17 google-auth-oauthlib,
18 requests-oauthlib,
19}:
20
21buildPythonPackage rec {
22 pname = "oauthlib";
23 version = "3.2.2";
24 pyproject = true;
25
26 disabled = pythonOlder "3.7";
27
28 src = fetchFromGitHub {
29 owner = "oauthlib";
30 repo = "oauthlib";
31 rev = "v${version}";
32 hash = "sha256-KADS1pEaLYi86LEt2VVuz8FVTBANzxC8EeQLgGMxuBU=";
33 };
34
35 nativeBuildInputs = [ setuptools ];
36
37 optional-dependencies = {
38 rsa = [ cryptography ];
39 signedtoken = [
40 cryptography
41 pyjwt
42 ];
43 signals = [ blinker ];
44 };
45
46 nativeCheckInputs = [
47 mock
48 pytestCheckHook
49 ] ++ lib.flatten (lib.attrValues optional-dependencies);
50
51 disabledTests =
52 [
53 # https://github.com/oauthlib/oauthlib/issues/877
54 "test_rsa_bad_keys"
55 ]
56 ++ lib.optionals (pythonAtLeast "3.13") [
57 "test_filter_params"
58 ];
59
60 pythonImportsCheck = [ "oauthlib" ];
61
62 passthru.tests = {
63 inherit
64 django-allauth
65 django-oauth-toolkit
66 google-auth-oauthlib
67 requests-oauthlib
68 ;
69 };
70
71 meta = with lib; {
72 changelog = "https://github.com/oauthlib/oauthlib/blob/${src.rev}/CHANGELOG.rst";
73 description = "Generic, spec-compliant, thorough implementation of the OAuth request-signing logic";
74 homepage = "https://github.com/oauthlib/oauthlib";
75 license = licenses.bsd3;
76 maintainers = with maintainers; [ prikhi ];
77 };
78}