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