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