1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 # required dependencies
7 requests,
8 setuptools,
9 # optional dependencies
10 pandas,
11 tornado,
12 sqlalchemy,
13 # test dependencies
14 pycurl,
15 pytestCheckHook,
16}:
17
18buildPythonPackage rec {
19 pname = "pydruid";
20 version = "0.6.8";
21 format = "setuptools";
22
23 disabled = pythonOlder "3.6";
24
25 src = fetchFromGitHub {
26 repo = "pydruid";
27 owner = "druid-io";
28 tag = version;
29 hash = "sha256-em4UuNnGdfT6KC9XiWSkCmm4DxdvDS+DGY9kw25iepo=";
30 };
31
32 # patch out the CLI because it doesn't work with newer versions of pygments
33 postPatch = ''
34 substituteInPlace setup.py --replace-fail '"console_scripts": ["pydruid = pydruid.console:main"],' ""
35 '';
36
37 nativeBuildInputs = [ setuptools ];
38
39 propagatedBuildInputs = [ requests ];
40
41 nativeCheckInputs = [
42 pytestCheckHook
43 pycurl
44 ]
45 ++ lib.flatten (lib.attrValues optional-dependencies);
46
47 pythonImportsCheck = [ "pydruid" ];
48
49 optional-dependencies = {
50 pandas = [ pandas ];
51 async = [ tornado ];
52 sqlalchemy = [ sqlalchemy ];
53 # druid has a `cli` extra, but it doesn't work with nixpkgs pygments
54 };
55
56 meta = with lib; {
57 description = "Simple API to create, execute, and analyze Druid queries";
58 homepage = "https://github.com/druid-io/pydruid";
59 license = licenses.asl20;
60 maintainers = with maintainers; [ cpcloud ];
61 };
62}