summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/trino-python-client/default.nix
blob: a068a7bf33d21bc3b1107d70008c055a4dca3966 (plain)
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
{
  lib,
  buildPythonPackage,
  boto3,
  fetchFromGitHub,
  httpretty,
  keyring,
  lz4,
  pytestCheckHook,
  python-dateutil,
  pytz,
  requests-gssapi,
  requests-kerberos,
  requests,
  setuptools,
  sqlalchemy,
  testcontainers,
  tzlocal,
  zstandard,
}:

buildPythonPackage rec {
  pname = "trino-python-client";
  version = "0.334.0";
  pyproject = true;

  src = fetchFromGitHub {
    repo = "trino-python-client";
    owner = "trinodb";
    tag = version;
    hash = "sha256-cSwMmzIUFYX8VgSwobth8EsARUff3hhfBf+IrhuFSYM=";
  };

  build-system = [ setuptools ];

  dependencies = [
    lz4
    python-dateutil
    pytz
    requests
    tzlocal
    zstandard
  ];

  optional-dependencies = lib.fix (self: {
    kerberos = [ requests-kerberos ];
    gsaapi = [ requests-gssapi ];
    sqlalchemy = [ sqlalchemy ];
    external-authentication-token-cache = [ keyring ];
    all = self.kerberos ++ self.sqlalchemy;
  });

  nativeCheckInputs = [
    boto3
    httpretty
    pytestCheckHook
    testcontainers
  ]
  ++ lib.concatAttrValues optional-dependencies;

  pythonImportsCheck = [ "trino" ];

  disabledTestPaths = [
    # Tests require a running trino instance
    "tests/integration/test_types_integration.py"
    "tests/integration/test_dbapi_integration.py"
    "tests/integration/test_sqlalchemy_integration.py"
  ];

  disabledTestMarks = [ "auth" ];

  disabledTests = [
    # Tests require a running trino instance
    "test_oauth2"
    "test_token_retrieved_once_when_authentication_instance_is_shared"
    "test_multithreaded_oauth2_authentication_flow"
  ];

  meta = {
    changelog = "https://github.com/trinodb/trino-python-client/blob/${src.tag}/CHANGES.md";
    description = "Client for the Trino distributed SQL Engine";
    homepage = "https://github.com/trinodb/trino-python-client";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [
      cpcloud
      flokli
    ];
  };
}