python-compression.scm 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  3. ;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
  4. ;;; Copyright © 2017 Nikita <nikita@n0.is>
  5. ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
  6. ;;; Copyright © 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
  7. ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
  8. ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
  9. ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
  10. ;;;
  11. ;;; This file is part of GNU Guix.
  12. ;;;
  13. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  14. ;;; under the terms of the GNU General Public License as published by
  15. ;;; the Free Software Foundation; either version 3 of the License, or (at
  16. ;;; your option) any later version.
  17. ;;;
  18. ;;; GNU Guix is distributed in the hope that it will be useful, but
  19. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  20. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. ;;; GNU General Public License for more details.
  22. ;;;
  23. ;;; You should have received a copy of the GNU General Public License
  24. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  25. (define-module (gnu packages python-compression)
  26. #:use-module ((guix licenses) #:prefix license:)
  27. #:use-module (guix utils)
  28. #:use-module (guix packages)
  29. #:use-module (guix download)
  30. #:use-module (guix build-system gnu)
  31. #:use-module (guix build-system python)
  32. #:use-module (gnu packages)
  33. #:use-module (gnu packages libffi)
  34. #:use-module (gnu packages compression)
  35. #:use-module (gnu packages check)
  36. #:use-module (gnu packages maths)
  37. #:use-module (gnu packages pkg-config)
  38. #:use-module (gnu packages python)
  39. #:use-module (gnu packages python-build)
  40. #:use-module (gnu packages python-check)
  41. #:use-module (gnu packages python-crypto)
  42. #:use-module (gnu packages python-xyz)
  43. #:use-module (gnu packages sphinx))
  44. (define-public python-multivolumefile
  45. (package
  46. (name "python-multivolumefile")
  47. (version "0.2.2")
  48. (source
  49. (origin
  50. (method url-fetch)
  51. (uri (pypi-uri "multivolumefile" version))
  52. (sha256
  53. (base32
  54. "0j46wab4b09s3favjzp3zs1cn2sn8pr7qyngs5wn31hpqqxbbz76"))))
  55. (build-system python-build-system)
  56. (native-inputs
  57. `(("python-pep517" ,python-pep517)
  58. ("python-setuptools" ,python-setuptools)
  59. ("python-setuptools-scm" ,python-setuptools-scm)
  60. ("python-coverage" ,python-coverage)
  61. ("python-coveralls" ,python-coveralls)
  62. ("python-pyannotate" ,python-pyannotate)
  63. ("python-pytest" ,python-pytest)
  64. ("python-pytest-cov" ,python-pytest-cov)))
  65. (home-page "https://github.com/miurahr/multivolume")
  66. (synopsis "Treat multiple files as one")
  67. (description "MultiVolumefile is a Python library that provides a
  68. file-object abstraction, making it possible to use multiple files as if they
  69. were a single file.")
  70. (license license:lgpl2.1+)))
  71. (define-public python-bcj-cffi
  72. (package
  73. (name "python-bcj-cffi")
  74. (version "0.5.0")
  75. (source
  76. (origin
  77. (method url-fetch)
  78. (uri (pypi-uri "bcj-cffi" version))
  79. (sha256
  80. (base32
  81. "1jcczrb8zgg6w7v76w1wpz3nw75fghk3xwxkn09ll7kck7sdf68d"))))
  82. (build-system python-build-system)
  83. (propagated-inputs
  84. `(("python-cffi" ,python-cffi)
  85. ("python-toml" ,python-toml)
  86. ("python-setuptools-scm" ,python-setuptools-scm)))
  87. (native-inputs
  88. `(("python-setuptools" ,python-setuptools)
  89. ("python-coverage" ,python-coverage)
  90. ("python-pytest" ,python-pytest)
  91. ("python-pytest-cov" ,python-pytest-cov)))
  92. (home-page "https://github.com/miurahr/bcj-cffi")
  93. (synopsis "Branch / Call /Jump CFFI library in Python")
  94. (description "This package provides an implementation of the Branch / Call /
  95. Jump conversion filter by CFFI for Python.")
  96. (license license:lgpl2.1+)))
  97. (define-public python-ppmd-cffi
  98. (package
  99. (name "python-ppmd-cffi")
  100. (version "0.3.3")
  101. (source
  102. (origin
  103. (method url-fetch)
  104. (uri (pypi-uri "ppmd-cffi" version))
  105. (sha256
  106. (base32
  107. "01wcd9l6pp6hivdmd275qh9dhcwficjqfl67hxix5n07vvq7jzz0"))))
  108. (build-system python-build-system)
  109. (propagated-inputs
  110. `(("python-cffi" ,python-cffi)))
  111. (native-inputs
  112. `(("python-setuptools" ,python-setuptools)
  113. ("python-setuptools-scm" ,python-setuptools-scm)
  114. ("python-pep517" ,python-pep517)
  115. ("python-coverage" ,python-coverage)
  116. ("python-pytest" ,python-pytest)
  117. ("python-pytest-cov" ,python-pytest-cov)))
  118. (home-page "https://github.com/miurahr/ppmd")
  119. (synopsis "Prediction by Partial Matching compression library")
  120. (description "PPMd is a compression algorithm library using the Prediction
  121. by Partial Matching statistical technique. It is used in RAR and 7-Zip as one of
  122. several possible methods.")
  123. (license license:lgpl2.1+)))
  124. (define-public python-py7zr
  125. (package
  126. (name "python-py7zr")
  127. (version "0.14.1")
  128. (source
  129. (origin
  130. (method url-fetch)
  131. (uri (pypi-uri "py7zr" version))
  132. (sha256
  133. (base32
  134. "1zmgp7yax328fj8yj8pj4l7yh78hp727j6wk12vfi6nmi82wl32i"))))
  135. (build-system python-build-system)
  136. (propagated-inputs
  137. `(("python-bcj-cffi" ,python-bcj-cffi)
  138. ("python-multivolumefile" ,python-multivolumefile)
  139. ("python-ppmd-cffi" ,python-ppmd-cffi)
  140. ("python-pycryptodome" ,python-pycryptodome)
  141. ("python-pyzstd" ,python-pyzstd)
  142. ("python-texttable" ,python-texttable)
  143. ("python-zstandard" ,python-zstandard)))
  144. (native-inputs
  145. `(("python-setuptools" ,python-setuptools)
  146. ("python-setuptools-scm" ,python-setuptools-scm)
  147. ("python-coverage" ,python-coverage)
  148. ("python-coveralls" ,python-coveralls)
  149. ("python-libarchive-c" ,python-libarchive-c)
  150. ("python-py-cpuinfo" ,python-py-cpuinfo)
  151. ("python-pyannotate" ,python-pyannotate)
  152. ("python-pytest" ,python-pytest)
  153. ("python-pytest-benchmark" ,python-pytest-benchmark)
  154. ("python-pytest-cov" ,python-pytest-cov)
  155. ("python-pytest-remotedata" ,python-pytest-remotedata)
  156. ("python-pytest-timeout" ,python-pytest-timeout)))
  157. (home-page "https://github.com/miurahr/py7zr")
  158. (synopsis "7-zip in Python")
  159. (description "This package provides py7zr, which implements 7-zip
  160. archive compression, decompression, encryption and decryption in
  161. Python.")
  162. (license license:lgpl2.1+)))
  163. (define-public python-lzo
  164. (package
  165. (name "python-lzo")
  166. (version "1.12")
  167. (source
  168. (origin
  169. (method url-fetch)
  170. (uri (pypi-uri "python-lzo" version))
  171. (sha256
  172. (base32
  173. "0iakqgd51n1cd7r3lpdylm2rgbmd16y74cra9kcapwg84mlf9a4p"))))
  174. (build-system python-build-system)
  175. (arguments
  176. `(#:test-target "check"
  177. #:phases
  178. (modify-phases %standard-phases
  179. (add-after 'unpack 'patch-setuppy
  180. (lambda _
  181. (substitute* "setup.py"
  182. (("include_dirs.append\\(.*\\)")
  183. (string-append "include_dirs.append('"
  184. (assoc-ref %build-inputs "lzo")
  185. "/include/lzo"
  186. "')")))
  187. #t)))))
  188. (inputs
  189. `(("lzo" ,lzo)))
  190. (home-page "https://github.com/jd-boyd/python-lzo")
  191. (synopsis "Python bindings for the LZO data compression library")
  192. (description
  193. "Python-LZO provides Python bindings for LZO, i.e. you can access
  194. the LZO library from your Python scripts thereby compressing ordinary
  195. Python strings.")
  196. (license license:gpl2+)))
  197. (define-public python2-lzo
  198. (package-with-python2 python-lzo))
  199. (define-public python-lz4
  200. (package
  201. (name "python-lz4")
  202. (version "0.10.1")
  203. (source
  204. (origin
  205. (method url-fetch)
  206. (uri (pypi-uri "lz4" version))
  207. (sha256
  208. (base32
  209. "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0"))
  210. (modules '((guix build utils)))
  211. (snippet
  212. '(begin
  213. ;; Remove bundled copy of lz4.
  214. (delete-file-recursively "lz4libs")
  215. #t))))
  216. (build-system python-build-system)
  217. (native-inputs
  218. `(("pkg-config" ,pkg-config)
  219. ("python-nose" ,python-nose)
  220. ("python-setuptools-scm" ,python-setuptools-scm)))
  221. (inputs
  222. `(("lz4" ,lz4)))
  223. (home-page "https://github.com/python-lz4/python-lz4")
  224. (synopsis "LZ4 bindings for Python")
  225. (description
  226. "This package provides python bindings for the lz4 compression library
  227. by Yann Collet. The project contains bindings for the LZ4 block format and
  228. the LZ4 frame format.")
  229. (license license:bsd-3)))
  230. (define-public python2-lz4
  231. (package-with-python2 python-lz4))
  232. (define-public python-lzstring
  233. (package
  234. (name "python-lzstring")
  235. (version "1.0.4")
  236. (source
  237. (origin
  238. (method url-fetch)
  239. (uri (pypi-uri "lzstring" version))
  240. (sha256
  241. (base32
  242. "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs"))))
  243. (build-system python-build-system)
  244. (propagated-inputs
  245. `(("python-future" ,python-future)))
  246. (home-page "https://github.com/gkovacs/lz-string-python")
  247. (synopsis "String compression")
  248. (description "Lz-string is a string compressor library for Python.")
  249. (license license:expat)))
  250. (define-public python2-lzstring
  251. (package-with-python2 python-lzstring))
  252. (define-public python-brotli
  253. (package
  254. (name "python-brotli")
  255. (version "1.0.9")
  256. (source
  257. (origin
  258. (method url-fetch)
  259. (uri (pypi-uri "Brotli" version ".zip"))
  260. (sha256
  261. (base32
  262. "0f4433s4wv9masc303kkb1s0a09x81xwr8pdvj0kyxzdl05826sd"))))
  263. (build-system python-build-system)
  264. (native-inputs
  265. `(("unzip" ,unzip)))
  266. (home-page "https://github.com/google/brotli")
  267. (synopsis "Python bindings for the Brotli compression library")
  268. (description
  269. "This package provides python bindings for the Brotli compression library.")
  270. (license license:asl2.0)))
  271. (define-public bitshuffle
  272. (package
  273. (name "bitshuffle")
  274. (version "0.3.5")
  275. (source (origin
  276. (method url-fetch)
  277. (uri (pypi-uri "bitshuffle" version))
  278. (sha256
  279. (base32
  280. "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy"))
  281. (modules '((guix build utils)))
  282. (snippet
  283. '(begin
  284. ;; Remove generated Cython files.
  285. (delete-file "bitshuffle/h5.c")
  286. (delete-file "bitshuffle/ext.c")
  287. #t))))
  288. (build-system python-build-system)
  289. (arguments
  290. `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769
  291. #:phases
  292. (modify-phases %standard-phases
  293. (add-after 'unpack 'fix-neon-detection
  294. ;; Neon is only for aarch64 ATM
  295. ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73
  296. (lambda _
  297. (substitute* "src/bitshuffle_core.c"
  298. (("#define USEARMNEON")
  299. "#ifdef __aarch64__\n#define USEARMNEON\n#endif"))
  300. #t))
  301. (add-after 'unpack 'dont-build-native
  302. (lambda _
  303. (substitute* "setup.py"
  304. (("'-march=native', ") ""))
  305. #t)))))
  306. (inputs
  307. `(("numpy" ,python-numpy)
  308. ("h5py" ,python-h5py)
  309. ("hdf5" ,hdf5)))
  310. (native-inputs
  311. `(("cython" ,python-cython)))
  312. (home-page "https://github.com/kiyo-masui/bitshuffle")
  313. (synopsis "Filter for improving compression of typed binary data")
  314. (description "Bitshuffle is an algorithm that rearranges typed, binary data
  315. for improving compression, as well as a python/C package that implements this
  316. algorithm within the Numpy framework.")
  317. (license license:expat)))
  318. (define-public bitshuffle-for-snappy
  319. (package/inherit bitshuffle
  320. (name "bitshuffle-for-snappy")
  321. (build-system gnu-build-system)
  322. (arguments
  323. (substitute-keyword-arguments (package-arguments bitshuffle)
  324. ((#:tests? _ #f) #f)
  325. ((#:phases phases)
  326. `(modify-phases %standard-phases
  327. (replace 'configure
  328. (lambda* (#:key outputs #:allow-other-keys)
  329. (with-output-to-file "Makefile"
  330. (lambda _
  331. (format #t "\
  332. libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
  333. \tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
  334. %.o: %.c
  335. \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
  336. PREFIX:=~a
  337. LIBDIR:=$(PREFIX)/lib
  338. INCLUDEDIR:=$(PREFIX)/include
  339. install: libbitshuffle.so
  340. \tinstall -dm755 $(LIBDIR)
  341. \tinstall -dm755 $(INCLUDEDIR)
  342. \tinstall -m755 libbitshuffle.so $(LIBDIR)
  343. \tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
  344. \tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
  345. \tinstall -m644 src/iochain.h $(INCLUDEDIR)
  346. \tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
  347. " (assoc-ref outputs "out"))))
  348. #t))))))
  349. (inputs '())
  350. (native-inputs '())))
  351. (define-public python-zipp
  352. (package
  353. (name "python-zipp")
  354. (version "1.0.0")
  355. (source
  356. (origin
  357. (method url-fetch)
  358. (uri (pypi-uri "zipp" version))
  359. (sha256
  360. (base32
  361. "0v3qayhqv7vyzydpydwcp51bqciw8p2ajddw68x5k8zppc0vx3yk"))))
  362. (build-system python-build-system)
  363. (propagated-inputs
  364. `(("python-more-itertools" ,python-more-itertools)))
  365. (native-inputs
  366. `(("python-setuptools-scm" ,python-setuptools-scm)))
  367. (home-page "https://github.com/jaraco/zipp")
  368. (synopsis
  369. "Backport of pathlib-compatible object wrapper for zip files")
  370. (description
  371. "This package provides a @code{pathlib}-compatible @code{Zipfile} object
  372. wrapper. It provides a backport of the @code{Path} object.")
  373. (properties `((python2-variant . ,(delay python2-zipp))))
  374. (license license:expat)))
  375. (define-public python2-zipp
  376. (let ((base (package-with-python2 (strip-python2-variant python-zipp))))
  377. (package/inherit
  378. base
  379. (native-inputs
  380. `(("python-contextlib2" ,python2-contextlib2)
  381. ("python-pathlib2" ,python2-pathlib2)
  382. ("python-unittest2" ,python2-unittest2)
  383. ,@(package-native-inputs base))))))
  384. ;; This package is used to bootstrap pytest, via importlib-metadata.
  385. (define-public python2-zipp-bootstrap
  386. (hidden-package
  387. (package/inherit
  388. python2-zipp
  389. (name "python2-zipp-bootstrap")
  390. (arguments
  391. `(#:tests? #f
  392. ,@(package-arguments python2-zipp)))
  393. (native-inputs
  394. `(("python-setuptools-scm" ,python2-setuptools-scm))))))
  395. (define-public python-zstandard
  396. (package
  397. (name "python-zstandard")
  398. (version "0.15.2")
  399. (source
  400. (origin
  401. (method url-fetch)
  402. (uri (pypi-uri "zstandard" version))
  403. (sha256
  404. (base32 "0by9z7nxnkzhmza075q6q91rs8lnpf91129k8ppv7kymbwshipjj"))))
  405. (build-system python-build-system)
  406. (native-inputs
  407. `(("python-hypothesis" ,python-hypothesis)))
  408. (home-page "https://github.com/indygreg/python-zstandard")
  409. (synopsis "Zstandard bindings for Python")
  410. (description "This project provides Python bindings for interfacing with
  411. the Zstandard compression library. A C extension and CFFI interface are
  412. provided.")
  413. (license license:bsd-3)))
  414. (define-public python-pyzstd
  415. (package
  416. (name "python-pyzstd")
  417. (version "0.14.3")
  418. (source
  419. (origin
  420. (method url-fetch)
  421. (uri (pypi-uri "pyzstd" version))
  422. (sha256
  423. (base32
  424. "1d3mngs45w2p490vrq5ymd2wz4lp15phmks1ilcx4k7amgibml3d"))))
  425. (build-system python-build-system)
  426. (home-page "https://github.com/animalize/pyzstd")
  427. (synopsis "Zstandard bindings for Python")
  428. (description "This package provides Python bindings to the Zstandard (zstd)
  429. compression library. The API is similar to Python's bz2/lzma/zlib module.")
  430. (license license:bsd-3)))