about summary refs log tree commit diff
path: root/pkgs/by-name/ng/ngrid/package.nix
blob: b609689663ec2d75ad2508e43c15ae5d10351db2 (plain) (blame)
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
60
61
62
63
64
65
66
67
68
69
{ lib
, fetchFromGitHub
, python3
, expect
}:

python3.pkgs.buildPythonApplication rec {
  pname = "ngrid";
  version = "0.1.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "twosigma";
    repo = "ngrid";
    rev = version;
    hash = "sha256-69icp0m+bAHBsQFIDGd8NjfMsMYsB1sUfzuP/OBl5jc=";
  };

  nativeBuildInputs = [
    python3.pkgs.setuptools
    python3.pkgs.wheel
  ];

  propagatedBuildInputs = [
    python3.pkgs.six
    python3.pkgs.numpy
    python3.pkgs.pytz
    python3.pkgs.pandas
  ];

  pythonImportsCheck = [ "ngrid.main" ];

  nativeCheckInputs = [ python3.pkgs.pytest expect ];
  checkPhase = ''
    runHook preCheck

    pytest test/formatters.py

    echo -e "a,b,c\n1.98423,some string,5824.2" > test.csv

    expect <<EOD
      exp_internal 1
      set timeout 3
      spawn $out/bin/ngrid test.csv

      expect {
        "Traceback" { exit 1 }
        timeout { }
      }

      send "q"

      expect {
        "Traceback" { exit 1 }
        eof { exit 0 }
      }
    EOD

    runHook postCheck
  '';

  meta = with lib; {
    description = "It's \"less\" for data";
    homepage = "https://github.com/twosigma/ngrid";
    license = licenses.bsd3;
    maintainers = with maintainers; [ twitchy0 ];
    mainProgram = "ngrid";
  };
}