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