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