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.5";
21 format = "setuptools";
22
23 disabled = pythonOlder "3.6";
24
25 src = fetchFromGitHub {
26 repo = pname;
27 owner = "druid-io";
28 rev = "refs/tags/${version}";
29 hash = "sha256-9+xomjSwWDVHkret/mqAZKWOPFRMvVB3CWtFPzrT81k=";
30 };
31
32 # patch out the CLI because it doesn't work with newer versions of pygments
33 postPatch = ''
34 substituteInPlace setup.py --replace '"console_scripts": ["pydruid = pydruid.console:main"],' ""
35 '';
36
37 nativeBuildInputs = [ setuptools ];
38
39 propagatedBuildInputs = [ requests ];
40
41 nativeCheckInputs = [
42 pytestCheckHook
43 pycurl
44 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
45
46 pythonImportsCheck = [ "pydruid" ];
47
48 passthru = {
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
57 meta = with lib; {
58 description = "Simple API to create, execute, and analyze Druid queries";
59 homepage = "https://github.com/druid-io/pydruid";
60 license = licenses.asl20;
61 maintainers = with maintainers; [ cpcloud ];
62 };
63}