1{
2 lib,
3 buildPythonPackage,
4 boto3,
5 fetchFromGitHub,
6 httpretty,
7 keyring,
8 lz4,
9 pytestCheckHook,
10 python-dateutil,
11 pytz,
12 requests-gssapi,
13 requests-kerberos,
14 requests,
15 setuptools,
16 sqlalchemy,
17 testcontainers,
18 tzlocal,
19 zstandard,
20}:
21
22buildPythonPackage rec {
23 pname = "trino-python-client";
24 version = "0.334.0";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 repo = "trino-python-client";
29 owner = "trinodb";
30 tag = version;
31 hash = "sha256-cSwMmzIUFYX8VgSwobth8EsARUff3hhfBf+IrhuFSYM=";
32 };
33
34 build-system = [ setuptools ];
35
36 dependencies = [
37 lz4
38 python-dateutil
39 pytz
40 requests
41 tzlocal
42 zstandard
43 ];
44
45 optional-dependencies = lib.fix (self: {
46 kerberos = [ requests-kerberos ];
47 gsaapi = [ requests-gssapi ];
48 sqlalchemy = [ sqlalchemy ];
49 external-authentication-token-cache = [ keyring ];
50 all = self.kerberos ++ self.sqlalchemy;
51 });
52
53 nativeCheckInputs = [
54 boto3
55 httpretty
56 pytestCheckHook
57 testcontainers
58 ]
59 ++ lib.flatten (builtins.attrValues optional-dependencies);
60
61 pythonImportsCheck = [ "trino" ];
62
63 disabledTestPaths = [
64 # Tests 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 disabledTestMarks = [ "auth" ];
71
72 disabledTests = [
73 # Tests require a running trino instance
74 "test_oauth2"
75 "test_token_retrieved_once_when_authentication_instance_is_shared"
76 "test_multithreaded_oauth2_authentication_flow"
77 ];
78
79 meta = with lib; {
80 changelog = "https://github.com/trinodb/trino-python-client/blob/${src.tag}/CHANGES.md";
81 description = "Client for the Trino distributed SQL Engine";
82 homepage = "https://github.com/trinodb/trino-python-client";
83 license = licenses.asl20;
84 maintainers = with maintainers; [
85 cpcloud
86 flokli
87 ];
88 };
89}