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.17"; 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-UFsAKROnzaaAyUDHHARZIO8zZP3knUYoBdGSf9ZGjXo="; 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 [ 55 pytestCheckHook 56 pytest-dotenv 57 ] 58 ++ optional-dependencies.sqlalchemy 59 ++ optional-dependencies.numpy; 60 61 # these tests require a running clickhouse instance 62 disabledTestPaths = [ 63 "tests/integration_tests" 64 ]; 65 66 pythonImportsCheck = [ 67 "clickhouse_connect" 68 "clickhouse_connect.driverc.buffer" 69 "clickhouse_connect.driverc.dataconv" 70 "clickhouse_connect.driverc.npconv" 71 ]; 72 73 optional-dependencies = { 74 sqlalchemy = [ sqlalchemy ]; 75 numpy = [ numpy ]; 76 pandas = [ pandas ]; 77 arrow = [ pyarrow ]; 78 orjson = [ orjson ]; 79 }; 80 81 meta = with lib; { 82 description = "ClickHouse Database Core Driver for Python, Pandas, and Superset"; 83 homepage = "https://github.com/ClickHouse/clickhouse-connect"; 84 license = licenses.asl20; 85 maintainers = with maintainers; [ cpcloud ]; 86 }; 87}