1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 google-auth,
6 googleapis-common-protos,
7 grpcio,
8 grpcio-gcp,
9 grpcio-status,
10 mock,
11 proto-plus,
12 protobuf,
13 pytest-asyncio,
14 pytestCheckHook,
15 pythonOlder,
16 requests,
17 setuptools,
18}:
19
20buildPythonPackage rec {
21 pname = "google-api-core";
22 version = "2.24.2";
23 pyproject = true;
24
25 disabled = pythonOlder "3.7";
26
27 src = fetchFromGitHub {
28 owner = "googleapis";
29 repo = "python-api-core";
30 tag = "v${version}";
31 hash = "sha256-7/9oU8KqwvL7DIDKDIUlGxfJZp7kGp1W6/tsEp6zcuc=";
32 };
33
34 build-system = [ setuptools ];
35
36 dependencies = [
37 googleapis-common-protos
38 google-auth
39 protobuf
40 proto-plus
41 requests
42 ];
43
44 optional-dependencies = {
45 async_rest = [ google-auth ] ++ google-auth.optional-dependencies.aiohttp;
46 grpc = [
47 grpcio
48 grpcio-status
49 ];
50 grpcgcp = [ grpcio-gcp ];
51 grpcio-gcp = [ grpcio-gcp ];
52 };
53
54 nativeCheckInputs = [
55 mock
56 pytest-asyncio
57 pytestCheckHook
58 ];
59
60 # prevent google directory from shadowing google imports
61 preCheck = ''
62 rm -r google
63 '';
64
65 disabledTests = [
66 # Those grpc_helpers tests are failing
67 "test_wrap_unary_errors"
68 "test_wrap_stream_errors_raised"
69 "test_wrap_stream_errors_read"
70 "test_wrap_stream_errors_aiter"
71 "test_wrap_stream_errors_write"
72 "test_wrap_unary_errors"
73 "test___next___w_rpc_error"
74 "test_wrap_stream_errors_invocation"
75 "test_wrap_stream_errors_iterator_initialization"
76 "test_wrap_stream_errors_during_iteration"
77 "test_exception_with_error_code"
78 ];
79
80 pythonImportsCheck = [ "google.api_core" ];
81
82 meta = with lib; {
83 description = "Core Library for Google Client Libraries";
84 longDescription = ''
85 This library is not meant to stand-alone. Instead it defines common
86 helpers used by all Google API clients.
87 '';
88 homepage = "https://github.com/googleapis/python-api-core";
89 changelog = "https://github.com/googleapis/python-api-core/blob/v${version}/CHANGELOG.md";
90 license = licenses.asl20;
91 maintainers = [ ];
92 };
93}