1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, pythonOlder 5, pytestCheckHook 6 # build_requires 7, cython_3 8 # install_requires 9, certifi 10, importlib-metadata 11, urllib3 12, pytz 13, zstandard 14, lz4 15 # extras_require 16, sqlalchemy 17, numpy 18, pandas 19, pyarrow 20, orjson 21 # not in tests_require, but should be 22, pytest-dotenv 23}: 24buildPythonPackage rec { 25 pname = "clickhouse-connect"; 26 version = "0.6.18"; 27 28 format = "setuptools"; 29 30 disabled = pythonOlder "3.7"; 31 32 src = fetchFromGitHub { 33 repo = "clickhouse-connect"; 34 owner = "ClickHouse"; 35 rev = "refs/tags/v${version}"; 36 hash = "sha256-8deiWqVRqGF8MFYe4Y/alJqudBc/vOpQAB2DGweXL5Q="; 37 }; 38 39 nativeBuildInputs = [ cython_3 ]; 40 setupPyBuildFlags = [ "--inplace" ]; 41 enableParallelBuilding = true; 42 43 propagatedBuildInputs = [ 44 certifi 45 importlib-metadata 46 urllib3 47 pytz 48 zstandard 49 lz4 50 ]; 51 52 nativeCheckInputs = [ pytestCheckHook pytest-dotenv ] 53 ++ passthru.optional-dependencies.sqlalchemy 54 ++ passthru.optional-dependencies.numpy; 55 56 # these tests require a running clickhouse instance 57 disabledTestPaths = [ 58 "tests/integration_tests" 59 "tests/tls" 60 ]; 61 62 pythonImportsCheck = [ 63 "clickhouse_connect" 64 "clickhouse_connect.driverc.buffer" 65 "clickhouse_connect.driverc.dataconv" 66 "clickhouse_connect.driverc.npconv" 67 ]; 68 69 passthru = { 70 optional-dependencies = { 71 sqlalchemy = [ sqlalchemy ]; 72 numpy = [ numpy ]; 73 pandas = [ pandas ]; 74 arrow = [ pyarrow ]; 75 orjson = [ orjson ]; 76 }; 77 }; 78 79 meta = with lib; { 80 description = "ClickHouse Database Core Driver for Python, Pandas, and Superset"; 81 homepage = "https://github.com/ClickHouse/clickhouse-connect"; 82 license = licenses.asl20; 83 maintainers = with maintainers; [ cpcloud ]; 84 }; 85}