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