1{
2 lib,
3 buildPythonPackage,
4 clickhouse-cityhash,
5 cython,
6 fetchFromGitHub,
7 freezegun,
8 lz4,
9 mock,
10 nose,
11 pytestCheckHook,
12 pytest-xdist,
13 pytz,
14 setuptools,
15 tzlocal,
16 zstd,
17}:
18
19buildPythonPackage rec {
20 pname = "clickhouse-driver";
21 version = "0.2.7";
22 format = "setuptools";
23
24 # pypi source doesn't contain tests
25 src = fetchFromGitHub {
26 owner = "mymarilyn";
27 repo = "clickhouse-driver";
28 rev = version;
29 hash = "sha256-l0YHWY25PMHgZG/sAZjtGhwmcxWdA8k96zlm9hbKcek=";
30 };
31
32 nativeBuildInputs = [
33 cython
34 setuptools
35 ];
36
37 propagatedBuildInputs = [
38 clickhouse-cityhash
39 lz4
40 pytz
41 tzlocal
42 zstd
43 ];
44
45 nativeCheckInputs = [
46 freezegun
47 mock
48 nose
49 pytest-xdist
50 pytestCheckHook
51 ];
52
53 postPatch = ''
54 substituteInPlace setup.py \
55 --replace "lz4<=3.0.1" "lz4<=4"
56 '';
57
58 # remove source to prevent pytest testing source instead of the build artifacts
59 # (the source doesn't contain the extension modules)
60 preCheck = ''
61 rm -rf clickhouse_driver
62 '';
63
64 # some test in test_buffered_reader.py doesn't seem to return
65 disabledTestPaths = [ "tests/test_buffered_reader.py" ];
66
67 # most tests require `clickhouse`
68 # TODO: enable tests after `clickhouse` unbroken
69 doCheck = false;
70
71 pythonImportsCheck = [ "clickhouse_driver" ];
72
73 meta = with lib; {
74 description = "Python driver with native interface for ClickHouse";
75 homepage = "https://github.com/mymarilyn/clickhouse-driver";
76 license = licenses.mit;
77 maintainers = with maintainers; [ breakds ];
78 };
79}