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