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