summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/trino-python-client/default.nix
blob: b76dba2b7692eeda6a1a023ee685c7514cecbb8d (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  # build
  setuptools,
  # required
  pytz,
  requests,
  tzlocal,
  # optional
  requests-kerberos,
  sqlalchemy,
  keyring,
  # tests
  pytestCheckHook,
  httpretty,
}:

buildPythonPackage rec {
  pname = "trino-python-client";
  version = "0.322.0";
  format = "setuptools";

  src = fetchFromGitHub {
    repo = pname;
    owner = "trinodb";
    rev = "refs/tags/${version}";
    hash = "sha256-Hl88Keavyp1QBw67AFbevy/btzNs7UlsKQ93K02YgLM=";
  };

  nativeBuildInputs = [ setuptools ];

  propagatedBuildInputs = [
    pytz
    requests
    tzlocal
  ];

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

  nativeCheckInputs = [
    httpretty
    pytestCheckHook
  ] ++ optional-dependencies.all;

  pythonImportsCheck = [ "trino" ];

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

  pytestFlagsArray = [ "-k 'not auth'" ];

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