1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4 # build
5, setuptools
6 # required
7, pytz
8, requests
9, tzlocal
10 # optional
11, requests-kerberos
12, sqlalchemy
13, keyring
14 # tests
15, pytestCheckHook
16, httpretty
17}:
18
19buildPythonPackage rec {
20 pname = "trino-python-client";
21 version = "0.322.0";
22 format = "setuptools";
23
24 src = fetchFromGitHub {
25 repo = pname;
26 owner = "trinodb";
27 rev = "refs/tags/${version}";
28 hash = "sha256-Hl88Keavyp1QBw67AFbevy/btzNs7UlsKQ93K02YgLM=";
29 };
30
31 nativeBuildInputs = [
32 setuptools
33 ];
34
35 propagatedBuildInputs = [
36 pytz
37 requests
38 tzlocal
39 ];
40
41 passthru.optional-dependencies = lib.fix (self: {
42 kerberos = [
43 requests-kerberos
44 ];
45 sqlalchemy = [
46 sqlalchemy
47 ];
48 external-authentication-token-cache = [
49 keyring
50 ];
51 all = self.kerberos ++ self.sqlalchemy;
52 });
53
54 nativeCheckInputs = [
55 httpretty
56 pytestCheckHook
57 ] ++ passthru.optional-dependencies.all;
58
59 pythonImportsCheck = [
60 "trino"
61 ];
62
63 disabledTestPaths = [
64 # these all require a running trino instance
65 "tests/integration/test_types_integration.py"
66 "tests/integration/test_dbapi_integration.py"
67 "tests/integration/test_sqlalchemy_integration.py"
68 ];
69
70 pytestFlagsArray = [
71 "-k 'not auth'"
72 ];
73
74 meta = with lib; {
75 changelog = "https://github.com/trinodb/trino-python-client/blob/${version}/CHANGES.md";
76 description = "Client for the Trino distributed SQL Engine";
77 homepage = "https://github.com/trinodb/trino-python-client";
78 license = licenses.asl20;
79 maintainers = with maintainers; [ cpcloud ];
80 };
81}