about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/google-cloud-bigquery/default.nix
blob: 0a7c67ec7aa72ea4672152f40b42a07e03467be9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
{ lib
, buildPythonPackage
, db-dtypes
, fetchPypi
, freezegun
, google-api-core
, google-cloud-bigquery-storage
, google-cloud-core
, google-cloud-datacatalog
, google-cloud-storage
, google-cloud-testutils
, google-resumable-media
, grpcio
, ipython
, mock
, pandas
, proto-plus
, protobuf
, psutil
, pyarrow
, pytest-xdist
, pytestCheckHook
, python-dateutil
, pythonOlder
, requests
, tqdm
}:

buildPythonPackage rec {
  pname = "google-cloud-bigquery";
  version = "3.18.0";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-dPD8bwupR3+AjSWSTcigUsVffKkQZOg+FtPuX7fKd6s=";
  };

  propagatedBuildInputs = [
    grpcio
    google-api-core
    google-cloud-core
    google-cloud-bigquery-storage
    google-resumable-media
    proto-plus
    protobuf
    requests
    python-dateutil
  ] ++ google-api-core.optional-dependencies.grpc;

  passthru.optional-dependencies = {
    bqstorage = [
      google-cloud-bigquery-storage
      grpcio
      pyarrow
    ];
    pandas = [
      db-dtypes
      pandas
      pyarrow
    ];
    tqdm = [
      tqdm
    ];
    ipython = [
      ipython
    ];
  };

  nativeCheckInputs = [
    freezegun
    google-cloud-testutils
    mock
    psutil
    google-cloud-datacatalog
    google-cloud-storage
    pytestCheckHook
    pytest-xdist
  ] ++ passthru.optional-dependencies.pandas
  ++ passthru.optional-dependencies.ipython;

  # prevent google directory from shadowing google imports
  preCheck = ''
    rm -r google
  '';

  disabledTests = [
    # requires credentials
    "test_bigquery_magic"
    "TestBigQuery"
    "test_context_with_no_query_cache_from_context"
    "test_arrow_extension_types_same_for_storage_and_REST_APIs_894"
    "test_list_rows_empty_table"
    "test_list_rows_page_size"
    "test_list_rows_scalars"
    "test_list_rows_scalars_extreme"
    "test_dry_run"
    "test_session"
    # Mocking of _ensure_bqstorage_client fails
    "test_to_arrow_ensure_bqstorage_client_wo_bqstorage"
    # requires network
    "test_dbapi_create_view"
    "test_list_rows_nullable_scalars_dtypes"
    "test_parameterized_types_round_trip"
    "test_structs"
    "test_table_snapshots"
    "test__initiate_resumable_upload"
    "test__initiate_resumable_upload_mtls"
    "test__initiate_resumable_upload_with_retry"
    "test_table_clones"
    "test_context_with_default_connection"
    "test_context_with_custom_connection"
  ];

  disabledTestPaths = [
    # Tests require credentials
    "tests/system/test_query.py"
    "tests/system/test_job_retry.py"
    "tests/system/test_pandas.py"
  ];

  pythonImportsCheck = [
    "google.cloud.bigquery"
    "google.cloud.bigquery_v2"
  ];

  meta = with lib; {
    description = "Google BigQuery API client library";
    homepage = "https://github.com/googleapis/python-bigquery";
    changelog = "https://github.com/googleapis/python-bigquery/blob/v${version}/CHANGELOG.md";
    license = licenses.asl20;
    maintainers = with maintainers; [ ];
  };
}