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.0";
20
21 # pypi source doesn't contain tests
22 src = fetchFromGitHub {
23 owner = "mymarilyn";
24 repo = "clickhouse-driver";
25 rev = "96b7ba448c63ca2670cc9aa70d4a0e08826fb650";
26 sha256 = "sha256-HFKUxJOlBCVlu7Ia8heGpwX6+HdKuwSy92s3v+GKGwE=";
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 pytestFlagsArray = [ "-n" "$NIX_BUILD_CORES" ];
61
62 # most tests require `clickhouse`
63 # TODO: enable tests after `clickhouse` unbroken
64 doCheck = false;
65
66 pythonImportsCheck = [ "clickhouse_driver" ];
67
68 meta = with lib; {
69 description = "Python driver with native interface for ClickHouse";
70 homepage = "https://github.com/mymarilyn/clickhouse-driver";
71 license = licenses.mit;
72 maintainers = with maintainers; [ breakds ];
73 };
74}