summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pydruid/default.nix
blob: ed5a993e7ae92857ab5577bdec5681b1145b021e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  # required dependencies
  requests,
  setuptools,
  # optional dependencies
  pandas,
  tornado,
  sqlalchemy,
  # test dependencies
  pycurl,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "pydruid";
  version = "0.6.8";
  format = "setuptools";

  src = fetchFromGitHub {
    repo = "pydruid";
    owner = "druid-io";
    tag = version;
    hash = "sha256-em4UuNnGdfT6KC9XiWSkCmm4DxdvDS+DGY9kw25iepo=";
  };

  # patch out the CLI because it doesn't work with newer versions of pygments
  postPatch = ''
    substituteInPlace setup.py --replace-fail '"console_scripts": ["pydruid = pydruid.console:main"],' ""
  '';

  nativeBuildInputs = [ setuptools ];

  propagatedBuildInputs = [ requests ];

  nativeCheckInputs = [
    pytestCheckHook
    pycurl
  ]
  ++ lib.concatAttrValues optional-dependencies;

  pythonImportsCheck = [ "pydruid" ];

  optional-dependencies = {
    pandas = [ pandas ];
    async = [ tornado ];
    sqlalchemy = [ sqlalchemy ];
    # druid has a `cli` extra, but it doesn't work with nixpkgs pygments
  };

  meta = {
    description = "Simple API to create, execute, and analyze Druid queries";
    homepage = "https://github.com/druid-io/pydruid";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ cpcloud ];
  };
}