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 tag = 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 optional-dependencies);
45
46 pythonImportsCheck = [ "pydruid" ];
47
48 optional-dependencies = {
49 pandas = [ pandas ];
50 async = [ tornado ];
51 sqlalchemy = [ sqlalchemy ];
52 # druid has a `cli` extra, but it doesn't work with nixpkgs pygments
53 };
54
55 meta = with lib; {
56 description = "Simple API to create, execute, and analyze Druid queries";
57 homepage = "https://github.com/druid-io/pydruid";
58 license = licenses.asl20;
59 maintainers = with maintainers; [ cpcloud ];
60 };
61}