1{ stdenv
2, lib
3, buildPythonPackage
4, fetchPypi
5, cachetools
6, pyasn1-modules
7, rsa
8, six
9, aiohttp
10, cryptography
11, pyopenssl
12, pyu2f
13, requests
14, aioresponses
15, asynctest
16, flask
17, freezegun
18, grpcio
19, mock
20, oauth2client
21, pytest-asyncio
22, pytest-localserver
23, pytestCheckHook
24, responses
25, urllib3
26}:
27
28buildPythonPackage rec {
29 pname = "google-auth";
30 version = "2.14.0";
31
32 src = fetchPypi {
33 inherit pname version;
34 sha256 = "sha256-zySBeFXYdO3i79BxqiISVEX1Vd4Whbc5qXgvz0CMKj0=";
35 };
36
37 propagatedBuildInputs = [
38 cachetools
39 pyasn1-modules
40 rsa
41 six
42 ];
43
44 passthru.optional-dependencies = {
45 aiohttp = [
46 aiohttp
47 requests
48 ];
49 enterprise_cert = [
50 cryptography
51 pyopenssl
52 ];
53 pyopenssl = [
54 pyopenssl
55 ];
56 reauth = [
57 pyu2f
58 ];
59 };
60
61 checkInputs = [
62 aioresponses
63 asynctest
64 flask
65 freezegun
66 grpcio
67 mock
68 oauth2client
69 pytest-asyncio
70 pytest-localserver
71 pytestCheckHook
72 responses
73 urllib3
74 ] ++ passthru.optional-dependencies.aiohttp
75 # `cryptography` is still required on `aarch64-darwin` for `tests/crypt/*`
76 ++ (if (stdenv.isDarwin && stdenv.isAarch64) then [ cryptography ] else passthru.optional-dependencies.enterprise_cert)
77 ++ passthru.optional-dependencies.reauth;
78
79 pythonImportsCheck = [
80 "google.auth"
81 "google.oauth2"
82 ];
83
84 disabledTestPaths = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
85 # Disable tests using pyOpenSSL as it does not build on M1 Macs
86 "tests/transport/test__mtls_helper.py"
87 "tests/transport/test_requests.py"
88 "tests/transport/test_urllib3.py"
89 "tests/transport/test__custom_tls_signer.py"
90 ];
91
92 meta = with lib; {
93 description = "Google Auth Python Library";
94 longDescription = ''
95 This library simplifies using Google’s various server-to-server
96 authentication mechanisms to access Google APIs.
97 '';
98 homepage = "https://github.com/googleapis/google-auth-library-python";
99 changelog = "https://github.com/googleapis/google-auth-library-python/blob/v${version}/CHANGELOG.md";
100 license = licenses.asl20;
101 maintainers = with maintainers; [ SuperSandro2000 ];
102 };
103}