wireservice.scm 10 KB

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