1{ stdenv
2, lib
3, buildPythonApplication
4, fetchFromGitHub
5# python requirements
6, beautifulsoup4
7, boto3
8, faker
9, fonttools
10, h5py
11, importlib-metadata
12, lxml
13, matplotlib
14, numpy
15, odfpy
16, openpyxl
17, pandas
18, pdfminer-six
19, praw
20, psutil
21, psycopg2
22, pyarrow
23, pyshp
24, pypng
25, python-dateutil
26, pyyaml
27, requests
28, seaborn
29, setuptools
30, sh
31, tabulate
32, urllib3
33, vobject
34, wcwidth
35, xlrd
36, xlwt
37, zstandard
38, zulip
39# other
40, git
41, withPcap ? true, dpkt, dnslib
42, withXclip ? stdenv.isLinux, xclip
43, testers
44, visidata
45}:
46buildPythonApplication rec {
47 pname = "visidata";
48 version = "2.11";
49
50 src = fetchFromGitHub {
51 owner = "saulpw";
52 repo = "visidata";
53 rev = "v${version}";
54 hash = "sha256-G/9paJFJsRfIxMJ2hbuVS7pxCfSUCK69DNV2DHi60qA=";
55 };
56
57 propagatedBuildInputs = [
58 # from visidata/requirements.txt
59 # packages not (yet) present in nixpkgs are commented
60 python-dateutil
61 pandas
62 requests
63 lxml
64 openpyxl
65 xlrd
66 xlwt
67 h5py
68 psycopg2
69 boto3
70 pyshp
71 #mapbox-vector-tile
72 pypng
73 fonttools
74 #sas7bdat
75 #xport
76 #savReaderWriter
77 pyyaml
78 #namestand
79 #datapackage
80 pdfminer-six
81 #tabula
82 vobject
83 tabulate
84 wcwidth
85 zstandard
86 odfpy
87 urllib3
88 pyarrow
89 seaborn
90 matplotlib
91 sh
92 psutil
93 numpy
94
95 #requests_cache
96 beautifulsoup4
97
98 faker
99 praw
100 zulip
101 #pyairtable
102
103 setuptools
104 importlib-metadata
105 ] ++ lib.optionals withPcap [ dpkt dnslib ]
106 ++ lib.optional withXclip xclip;
107
108 nativeCheckInputs = [
109 git
110 ];
111
112 # check phase uses the output bin, which is not possible when cross-compiling
113 doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
114
115 checkPhase = ''
116 runHook preCheck
117 # disable some tests which require access to the network
118 rm -f tests/load-http.vd # http
119 rm -f tests/graph-cursor-nosave.vd # http
120 rm -f tests/messenger-nosave.vd # dns
121
122 # tests use git to compare outputs to references
123 git init -b "test-reference"
124 git config user.name "nobody"
125 git config user.email "no@where"
126 git add .
127 git commit -m "test reference"
128
129 substituteInPlace dev/test.sh --replace "bin/vd" "$out/bin/vd"
130 bash dev/test.sh
131 runHook postCheck
132 '';
133 postInstall = ''
134 python dev/zsh-completion.py
135 install -Dm644 _visidata -t $out/share/zsh/site-functions
136 '';
137
138 pythonImportsCheck = ["visidata"];
139
140 passthru.tests.version = testers.testVersion {
141 package = visidata;
142 version = "v${version}";
143 };
144
145 meta = {
146 description = "Interactive terminal multitool for tabular data";
147 license = lib.licenses.gpl3;
148 maintainers = with lib.maintainers; [ raskin markus1189 ];
149 homepage = "https://visidata.org/";
150 changelog = "https://github.com/saulpw/visidata/blob/v${version}/CHANGELOG.md";
151 };
152}