nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
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.8";
20 format = "setuptools";
21
22 src = fetchFromGitHub {
23 repo = "pydruid";
24 owner = "druid-io";
25 tag = version;
26 hash = "sha256-em4UuNnGdfT6KC9XiWSkCmm4DxdvDS+DGY9kw25iepo=";
27 };
28
29 # patch out the CLI because it doesn't work with newer versions of pygments
30 postPatch = ''
31 substituteInPlace setup.py --replace-fail '"console_scripts": ["pydruid = pydruid.console:main"],' ""
32 '';
33
34 nativeBuildInputs = [ setuptools ];
35
36 propagatedBuildInputs = [ requests ];
37
38 nativeCheckInputs = [
39 pytestCheckHook
40 pycurl
41 ]
42 ++ lib.concatAttrValues optional-dependencies;
43
44 pythonImportsCheck = [ "pydruid" ];
45
46 optional-dependencies = {
47 pandas = [ pandas ];
48 async = [ tornado ];
49 sqlalchemy = [ sqlalchemy ];
50 # druid has a `cli` extra, but it doesn't work with nixpkgs pygments
51 };
52
53 meta = {
54 description = "Simple API to create, execute, and analyze Druid queries";
55 homepage = "https://github.com/druid-io/pydruid";
56 license = lib.licenses.asl20;
57 maintainers = with lib.maintainers; [ cpcloud ];
58 };
59}