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.20.0";
23 pyproject = true;
24
25 disabled = pythonOlder "3.6";
26
27 src = fetchFromGitHub {
28 owner = "googleapis";
29 repo = "python-api-core";
30 rev = "v${version}";
31 hash = "sha256-ccjkGQNaPRefI6+j/O+NwdBGEVNuZ5q5m1d8EAJGcbs=";
32 };
33
34 nativeBuildInputs = [ setuptools ];
35
36 propagatedBuildInputs = [
37 googleapis-common-protos
38 google-auth
39 protobuf
40 proto-plus
41 requests
42 ];
43
44 optional-dependencies = {
45 grpc = [
46 grpcio
47 grpcio-status
48 ];
49 grpcgcp = [ grpcio-gcp ];
50 grpcio-gcp = [ grpcio-gcp ];
51 };
52
53 nativeCheckInputs = [
54 mock
55 pytest-asyncio
56 pytestCheckHook
57 ];
58
59 # prevent google directory from shadowing google imports
60 preCheck = ''
61 rm -r google
62 '';
63
64 disabledTests = [
65 # Those grpc_helpers tests are failing
66 "test_wrap_unary_errors"
67 "test_wrap_stream_errors_raised"
68 "test_wrap_stream_errors_read"
69 "test_wrap_stream_errors_aiter"
70 "test_wrap_stream_errors_write"
71 "test_wrap_unary_errors"
72 "test___next___w_rpc_error"
73 "test_wrap_stream_errors_invocation"
74 "test_wrap_stream_errors_iterator_initialization"
75 "test_wrap_stream_errors_during_iteration"
76 "test_exception_with_error_code"
77 ];
78
79 pythonImportsCheck = [ "google.api_core" ];
80
81 meta = with lib; {
82 description = "Core Library for Google Client Libraries";
83 longDescription = ''
84 This library is not meant to stand-alone. Instead it defines common
85 helpers used by all Google API clients.
86 '';
87 homepage = "https://github.com/googleapis/python-api-core";
88 changelog = "https://github.com/googleapis/python-api-core/blob/v${version}/CHANGELOG.md";
89 license = licenses.asl20;
90 maintainers = [ ];
91 };
92}