Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / gnu / packages / wireservice.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages wireservice)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (guix build-system python)
22 #:use-module (guix download)
23 #:use-module (guix git-download)
24 #:use-module (guix packages)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages check)
27 #:use-module (gnu packages databases)
28 #:use-module (gnu packages python-web)
29 #:use-module (gnu packages python-xyz)
30 #:use-module (gnu packages sphinx)
31 #:use-module (gnu packages time)
32 #:use-module (gnu packages xml))
33
34 ;; Common package definition for packages from https://github.com/wireservice.
35 (define-syntax-rule (wireservice-package extra-fields ...)
36 (package
37 (build-system python-build-system)
38 (arguments
39 `(#:phases
40 (modify-phases %standard-phases
41 (replace 'check
42 (lambda _
43 (invoke "nosetests" "tests")))
44 (add-after 'install 'install-docs
45 (lambda* (#:key outputs #:allow-other-keys)
46 (let* ((out (assoc-ref outputs "out"))
47 (doc (string-append out "/share/doc/"
48 ,(package-name this-package)
49 "-"
50 ,(package-version this-package))))
51 (with-directory-excursion "docs"
52 (for-each
53 (lambda (target)
54 (invoke "make" target)
55 (copy-recursively (string-append "_build/" target)
56 (string-append doc "/" target)))
57 '("html" "dirhtml" "singlehtml" "text")))
58 #t))))))
59 (license license:expat)
60 extra-fields ...))
61
62 (define-public python-leather
63 (wireservice-package
64 (name "python-leather")
65 (version "0.3.3")
66 (source (origin
67 (method git-fetch)
68 (uri (git-reference
69 (url "https://github.com/wireservice/leather.git")
70 (commit version)))
71 (file-name (git-file-name name version))
72 (sha256
73 (base32
74 "1ck3dplni99sv4s117cbm07ydwwjsrxkhdy19rnk0iglia1d4s5i"))))
75 (native-inputs
76 `(("python-nose" ,python-nose)
77 ("python-sphinx" ,python-sphinx)
78 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
79 ("python-csselect" ,python-cssselect)
80 ("python-lxml" ,python-lxml)))
81 (propagated-inputs
82 `(("python-six" ,python-six)))
83 (home-page "https://leather.rtfd.org")
84 (synopsis "Python charting for 80% of humans")
85 (description "Leather is a Python charting library for those who need
86 charts now and don't care if they're perfect.")))
87
88 (define-public python-agate
89 (wireservice-package
90 (name "python-agate")
91 (version "1.6.1")
92 (source (origin
93 (method git-fetch)
94 (uri (git-reference
95 (url "https://github.com/wireservice/agate.git")
96 (commit version)))
97 (file-name (git-file-name name version))
98 (sha256
99 (base32
100 "077zj8xad8hsa3nqywvf7ircirmx3krxdipl8wr3dynv3l3khcpl"))))
101 (native-inputs
102 `(("python-nose" ,python-nose)
103 ("python-sphinx" ,python-sphinx)
104 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
105 ("python-csselect" ,python-cssselect)
106 ("python-lxml" ,python-lxml)))
107 (propagated-inputs
108 `(("python-babel" ,python-babel)
109 ("python-isodate" ,python-isodate)
110 ("python-leather" ,python-leather)
111 ("python-parsedatetime" ,python-parsedatetime)
112 ("python-pytimeparse" ,python-pytimeparse)
113 ("python-six" ,python-six)
114 ("python-slugify" ,python-slugify)))
115 (home-page "https://agate.rtfd.org")
116 (synopsis "Data analysis library")
117 (description "Agate is a Python data analysis library. It is an
118 alternative to numpy and pandas that solves real-world problems with readable
119 code. Agate was previously known as journalism.")))
120
121 (define-public python-agate-sql
122 (wireservice-package
123 (name "python-agate-sql")
124 (version "0.5.4")
125 (source (origin
126 (method git-fetch)
127 (uri (git-reference
128 (url "https://github.com/wireservice/agate-sql.git")
129 (commit version)))
130 (file-name (git-file-name name version))
131 (sha256
132 (base32
133 "16q0b211n5b1qmhzkfl2jr56lda0rvyh5j1wzw26h2n4pm4wxlx2"))))
134 (native-inputs
135 `(("python-nose" ,python-nose)
136 ("python-sphinx" ,python-sphinx)
137 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
138 (propagated-inputs
139 `(("python-agate" ,python-agate)
140 ("python-crate" ,python-crate)
141 ("python-sqlalchemy" ,python-sqlalchemy)))
142 (home-page "https://agate-sql.rtfd.org")
143 (synopsis "SQL read/write support to agate")
144 (description "@code{agatesql} uses a monkey patching pattern to add SQL
145 support to all @code{agate.Table} instances.")))
146
147 (define-public python-agate-dbf
148 (wireservice-package
149 (name "python-agate-dbf")
150 (version "0.2.1")
151 (source (origin
152 (method git-fetch)
153 (uri (git-reference
154 (url "https://github.com/wireservice/agate-dbf.git")
155 (commit version)))
156 (file-name (git-file-name name version))
157 (sha256
158 (base32
159 "1y49fi6pmm7gzhajvqmfpcca2sqnwj24fqnsvzwk7r1hg2iaa2gi"))))
160 (native-inputs
161 `(("python-nose" ,python-nose)
162 ("python-sphinx" ,python-sphinx)
163 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
164 (propagated-inputs
165 `(("python-agate" ,python-agate)
166 ("python-dbfread" ,python-dbfread)))
167 (home-page "https://agate-dbf.rtfd.org")
168 (synopsis "Add read support for dbf files to agate")
169 (description "@code{agatedbf} uses a monkey patching pattern to add read
170 for dbf files support to all @code{agate.Table} instances.")))
171
172 (define-public python-agate-excel
173 (wireservice-package
174 (name "python-agate-excel")
175 (version "0.2.3")
176 (source (origin
177 (method git-fetch)
178 (uri (git-reference
179 (url "https://github.com/wireservice/agate-excel.git")
180 (commit version)))
181 (file-name (git-file-name name version))
182 (sha256
183 (base32
184 "1k5lv21k19s7kgbj5srd1xgrkqvxqqs49qwj33zncs9l7851afy7"))))
185 (native-inputs
186 `(("python-nose" ,python-nose)
187 ("python-sphinx" ,python-sphinx)
188 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
189 (propagated-inputs
190 `(("python-agate" ,python-agate)
191 ("python-openpyxl" ,python-openpyxl)
192 ("python-xlrd" ,python-xlrd)))
193 (home-page "https://agate-excel.rtfd.org")
194 (synopsis "Add read support for Excel files (xls and xlsx) to agate")
195 (description "@code{agateexcel} uses a monkey patching pattern to add read
196 for xls and xlsx files support to all @code{agate.Table} instances.")))
197
198 (define-public csvkit
199 (package
200 (name "csvkit")
201 (version "1.0.4")
202 (source (origin
203 (method url-fetch)
204 (uri (pypi-uri "csvkit" version))
205 (sha256
206 (base32
207 "1830lb95rh1iyi3drlwxzb6y3pqkii0qiyzd40c1kvhvaf1s6lqk"))
208 (patches (search-patches "csvkit-fix-tests.patch"))))
209 (build-system python-build-system)
210 (native-inputs
211 `(("python-psycopg2" ,python-psycopg2) ;; Used to test PostgreSQL support.
212 ("python-sphinx" ,python-sphinx)
213 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
214 (inputs
215 `(("python-agate-dbf" ,python-agate-dbf)
216 ("python-agate-excel" ,python-agate-excel)
217 ("python-agate-sql" ,python-agate-sql)
218 ("python-six" ,python-six)))
219 (arguments
220 `(#:phases
221 (modify-phases %standard-phases
222 (add-after 'install 'install-docs
223 (lambda* (#:key outputs #:allow-other-keys)
224 (let* ((out (assoc-ref outputs "out"))
225 (man1 (string-append out "/share/man/man1")))
226 (with-directory-excursion "docs"
227 (invoke "make" "man")
228 (copy-recursively "_build/man" man1))
229 #t))))))
230 (home-page "https://csvkit.rtfd.org")
231 (synopsis "Command-line tools for working with CSV")
232 (description "csvkit is a suite of command-line tools for converting to
233 and working with CSV. It provides the following commands:
234 @itemize
235 @item Input:
236 @itemize
237 @item @command{in2csv}: Convert various formats to CSV.
238 @item @command{sql2csv}: Execute SQL commands on a database and return the
239 data as CSV.
240 @end itemize
241 @item Processing:
242 @itemize
243 @item @command{csvclean}: Remove common syntax errors.
244 @item @command{csvcut}: Filter and truncate CSV files.
245 @item @command{csvgrep}: Filter tabular data to only those rows where
246 certain columns contain a given value or match a regular expression.
247 @item @command{csvjoin}: Merges two or more CSV tables together using a
248 method analogous to SQL JOIN operation.
249 @item @command{csvsort}: Sort CSV files.
250 @item @command{csvstack}: Stack up the rows from multiple CSV files,
251 optionally adding a grouping value to each row.
252 @end itemize
253 @item Output and analysis:
254 @itemize
255 @item @command{csvformat}: Convert a CSV file to a custom output format.
256 @item @command{csvjson}: Converts a CSV file into JSON or GeoJSON.
257 @item @command{csvlook}: Renders a CSV to the command line in a
258 Markdown-compatible, fixed-width format.
259 @item @command{csvpy}: Loads a CSV file into a @code{agate.csv.Reader}
260 object and then drops into a Python shell so the user can inspect the data
261 however they see fit.
262 @item @command{csvsql}: Generate SQL statements for a CSV file or execute
263 those statements directly on a database.
264 @item @command{csvstat}: Prints descriptive statistics for all columns in a
265 CSV file.
266 @end itemize
267 @end itemize")
268 (license license:expat)))