gnu: r-biocviews: Update to 1.64.1.
[jackhill/guix/guix.git] / gnu / packages / python-compression.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
3 ;;; Copyright © 2017, 2019, 2021 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, 2022 Marius Bakke <marius@gnu.org>
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
26 (define-module (gnu packages python-compression)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix utils)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix gexp)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system python)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages libffi)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages maths)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages python)
41 #:use-module (gnu packages python-build)
42 #:use-module (gnu packages python-check)
43 #:use-module (gnu packages python-crypto)
44 #:use-module (gnu packages python-xyz)
45 #:use-module (gnu packages sphinx))
46
47 (define-public python-multivolumefile
48 (package
49 (name "python-multivolumefile")
50 (version "0.2.2")
51 (source
52 (origin
53 (method url-fetch)
54 (uri (pypi-uri "multivolumefile" version))
55 (sha256
56 (base32
57 "0j46wab4b09s3favjzp3zs1cn2sn8pr7qyngs5wn31hpqqxbbz76"))))
58 (build-system python-build-system)
59 (native-inputs
60 (list python-pep517
61 python-setuptools
62 python-setuptools-scm
63 python-coverage
64 python-coveralls
65 python-pyannotate
66 python-pytest
67 python-pytest-cov))
68 (home-page "https://github.com/miurahr/multivolume")
69 (synopsis "Treat multiple files as one")
70 (description "MultiVolumefile is a Python library that provides a
71 file-object abstraction, making it possible to use multiple files as if they
72 were a single file.")
73 (license license:lgpl2.1+)))
74
75 (define-public python-bcj-cffi
76 (package
77 (name "python-bcj-cffi")
78 (version "0.5.0")
79 (source
80 (origin
81 (method url-fetch)
82 (uri (pypi-uri "bcj-cffi" version))
83 (sha256
84 (base32
85 "1jcczrb8zgg6w7v76w1wpz3nw75fghk3xwxkn09ll7kck7sdf68d"))))
86 (build-system python-build-system)
87 (propagated-inputs
88 (list python-cffi python-toml python-setuptools-scm))
89 (native-inputs
90 (list python-setuptools python-coverage python-pytest
91 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
98 (define-public python-isal
99 (package
100 (name "python-isal")
101 (version "0.11.1")
102 (source
103 (origin
104 (method url-fetch)
105 (uri (pypi-uri "isal" version))
106 (sha256
107 (base32 "1bxj7r24p974pqfgym485s90ydhzji9q7zyfg3sf8fycm9ya01wd"))
108 ;; Remove bundles isa-l source code
109 (modules '((guix build utils)))
110 (snippet
111 '(delete-file-recursively "src/isal/isa-l"))))
112 (build-system python-build-system)
113 (arguments
114 `(#:phases
115 (modify-phases %standard-phases
116 (add-after 'unpack 'use-dynamic-linking
117 (lambda _ (setenv "PYTHON_ISAL_LINK_DYNAMIC" "1"))))))
118 (inputs (list isa-l))
119 (native-inputs (list python-cython))
120 (home-page "https://github.com/pycompression/python-isal")
121 (synopsis "Python bindings for the ISA-L compression library")
122 (description
123 "This package aims to provide faster zlib and gzip compatible compression
124 and decompression by implementing Python bindings for the ISA-L library.")
125 (license license:expat)))
126
127 (define-public python-ppmd-cffi
128 (package
129 (name "python-ppmd-cffi")
130 (version "0.3.3")
131 (source
132 (origin
133 (method url-fetch)
134 (uri (pypi-uri "ppmd-cffi" version))
135 (sha256
136 (base32
137 "01wcd9l6pp6hivdmd275qh9dhcwficjqfl67hxix5n07vvq7jzz0"))))
138 (build-system python-build-system)
139 (propagated-inputs
140 (list python-cffi))
141 (native-inputs
142 (list python-setuptools
143 python-setuptools-scm
144 python-pep517
145 python-coverage
146 python-pytest
147 python-pytest-cov))
148 (home-page "https://github.com/miurahr/ppmd")
149 (synopsis "Prediction by Partial Matching compression library")
150 (description "PPMd is a compression algorithm library using the Prediction
151 by Partial Matching statistical technique. It is used in RAR and 7-Zip as one of
152 several possible methods.")
153 (license license:lgpl2.1+)))
154
155 (define-public python-py7zr
156 (package
157 (name "python-py7zr")
158 (version "0.14.1")
159 (source
160 (origin
161 (method url-fetch)
162 (uri (pypi-uri "py7zr" version))
163 (sha256
164 (base32
165 "1zmgp7yax328fj8yj8pj4l7yh78hp727j6wk12vfi6nmi82wl32i"))))
166 (build-system python-build-system)
167 (propagated-inputs
168 (list python-bcj-cffi
169 python-multivolumefile
170 python-ppmd-cffi
171 python-pycryptodome
172 python-pyzstd
173 python-texttable
174 python-zstandard))
175 (native-inputs
176 (list python-setuptools
177 python-setuptools-scm
178 python-coverage
179 python-coveralls
180 python-libarchive-c
181 python-py-cpuinfo
182 python-pyannotate
183 python-pytest
184 python-pytest-benchmark
185 python-pytest-cov
186 python-pytest-remotedata
187 python-pytest-timeout))
188 (home-page "https://github.com/miurahr/py7zr")
189 (synopsis "7-zip in Python")
190 (description "This package provides py7zr, which implements 7-zip
191 archive compression, decompression, encryption and decryption in
192 Python.")
193 (license license:lgpl2.1+)))
194
195 (define-public python-lzo
196 (package
197 (name "python-lzo")
198 (version "1.14")
199 (source
200 (origin
201 (method url-fetch)
202 (uri (pypi-uri "python-lzo" version))
203 (sha256
204 (base32 "0315nq6r39n51n8qqamb7xv0ib0qrh76q7g3a1977172mbndijw3"))))
205 (build-system python-build-system)
206 (arguments
207 (list
208 #:test-target "check"
209 #:phases
210 #~(modify-phases %standard-phases
211 (add-after 'unpack 'patch-setuppy
212 (lambda _
213 (substitute* "setup.py"
214 (("include_dirs.append\\(.*\\)")
215 (string-append "include_dirs.append('"
216 #$(this-package-input "lzo")
217 "/include/lzo"
218 "')"))))))))
219 (inputs
220 (list lzo))
221 (home-page "https://github.com/jd-boyd/python-lzo")
222 (synopsis "Python bindings for the LZO data compression library")
223 (description
224 "Python-LZO provides Python bindings for LZO, i.e. you can access
225 the LZO library from your Python scripts thereby compressing ordinary
226 Python strings.")
227 (license license:gpl2+)))
228
229 (define-public python-lz4
230 (package
231 (name "python-lz4")
232 (version "4.0.2")
233 (source
234 (origin
235 (method url-fetch)
236 (uri (pypi-uri "lz4" version))
237 (sha256
238 (base32
239 "16vj2bnhhdkcz2a2ai2mx2kf9ngx1cjr18636yp1514kq9r72fq8"))
240 (modules '((guix build utils)))
241 (snippet
242 '(begin
243 ;; Remove bundled copy of lz4.
244 (delete-file-recursively "lz4libs")
245 #t))))
246 (build-system python-build-system)
247 (arguments
248 (list #:phases
249 #~(modify-phases %standard-phases
250 (replace 'check
251 (lambda* (#:key tests? #:allow-other-keys)
252 (when tests?
253 ;; Taken from tox.ini (excludes experimental tests).
254 (invoke "pytest" "-vv" "tests/block" "tests/frame")))))))
255 (native-inputs
256 (list pkg-config python-pytest python-pkgconfig python-setuptools-scm
257 ;; For tests.
258 python-psutil))
259 (inputs
260 (list lz4))
261 (home-page "https://github.com/python-lz4/python-lz4")
262 (synopsis "LZ4 bindings for Python")
263 (description
264 "This package provides python bindings for the lz4 compression library
265 by Yann Collet. The project contains bindings for the LZ4 block format and
266 the LZ4 frame format.")
267 (license license:bsd-3)))
268
269 (define-public python-lzstring
270 (package
271 (name "python-lzstring")
272 (version "1.0.4")
273 (source
274 (origin
275 (method url-fetch)
276 (uri (pypi-uri "lzstring" version))
277 (sha256
278 (base32
279 "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs"))))
280 (build-system python-build-system)
281 (propagated-inputs
282 (list python-future))
283 (home-page "https://github.com/gkovacs/lz-string-python")
284 (synopsis "String compression")
285 (description "Lz-string is a string compressor library for Python.")
286 (license license:expat)))
287
288 (define-public bitshuffle
289 (package
290 (name "bitshuffle")
291 (version "0.3.5")
292 (source (origin
293 (method url-fetch)
294 (uri (pypi-uri "bitshuffle" version))
295 (sha256
296 (base32
297 "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy"))
298 (modules '((guix build utils)))
299 (snippet
300 '(begin
301 ;; Remove generated Cython files.
302 (delete-file "bitshuffle/h5.c")
303 (delete-file "bitshuffle/ext.c")
304 #t))))
305 (build-system python-build-system)
306 (arguments
307 `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769
308 #:phases
309 (modify-phases %standard-phases
310 (add-after 'unpack 'fix-neon-detection
311 ;; Neon is only for aarch64 ATM
312 ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73
313 (lambda _
314 (substitute* "src/bitshuffle_core.c"
315 (("#define USEARMNEON")
316 "#ifdef __aarch64__\n#define USEARMNEON\n#endif"))
317 #t))
318 (add-after 'unpack 'dont-build-native
319 (lambda _
320 (substitute* "setup.py"
321 (("'-march=native', ") ""))
322 #t)))))
323 (inputs
324 `(("numpy" ,python-numpy)
325 ("h5py" ,python-h5py)
326 ("hdf5" ,hdf5)))
327 (native-inputs
328 `(("cython" ,python-cython)))
329 (home-page "https://github.com/kiyo-masui/bitshuffle")
330 (synopsis "Filter for improving compression of typed binary data")
331 (description "Bitshuffle is an algorithm that rearranges typed, binary data
332 for improving compression, as well as a python/C package that implements this
333 algorithm within the Numpy framework.")
334 (license license:expat)))
335
336 (define-public bitshuffle-for-snappy
337 (package/inherit bitshuffle
338 (name "bitshuffle-for-snappy")
339 (build-system gnu-build-system)
340 (arguments
341 (substitute-keyword-arguments (package-arguments bitshuffle)
342 ((#:tests? _ #f) #f)
343 ((#:phases phases)
344 `(modify-phases %standard-phases
345 (replace 'configure
346 (lambda* (#:key outputs #:allow-other-keys)
347 (with-output-to-file "Makefile"
348 (lambda _
349 (format #t "\
350 libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
351 \tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
352
353 %.o: %.c
354 \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
355
356 PREFIX:=~a
357 LIBDIR:=$(PREFIX)/lib
358 INCLUDEDIR:=$(PREFIX)/include
359
360 install: libbitshuffle.so
361 \tinstall -dm755 $(LIBDIR)
362 \tinstall -dm755 $(INCLUDEDIR)
363 \tinstall -m755 libbitshuffle.so $(LIBDIR)
364 \tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
365 \tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
366 \tinstall -m644 src/iochain.h $(INCLUDEDIR)
367 \tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
368 " (assoc-ref outputs "out"))))
369 #t))))))
370 (inputs '())
371 (native-inputs '())))
372
373 (define-public python-zipp
374 (package
375 (name "python-zipp")
376 (version "1.0.0")
377 (source
378 (origin
379 (method url-fetch)
380 (uri (pypi-uri "zipp" version))
381 (sha256
382 (base32
383 "0v3qayhqv7vyzydpydwcp51bqciw8p2ajddw68x5k8zppc0vx3yk"))))
384 (build-system python-build-system)
385 (propagated-inputs
386 (list python-more-itertools))
387 (native-inputs
388 (list python-setuptools-scm))
389 (home-page "https://github.com/jaraco/zipp")
390 (synopsis
391 "Backport of pathlib-compatible object wrapper for zip files")
392 (description
393 "This package provides a @code{pathlib}-compatible @code{Zipfile} object
394 wrapper. It provides a backport of the @code{Path} object.")
395 (license license:expat)))
396
397 (define-public python-zopfli
398 (package
399 (name "python-zopfli")
400 (version "0.2.1")
401 (source
402 (origin
403 (method url-fetch)
404 (uri (pypi-uri "zopfli" version ".zip"))
405 (sha256
406 (base32 "1ipjkcgdbplsrhr31ypk48px8cax4cm9gcjj7yrcrhg20ql3s9p5"))))
407 (build-system python-build-system)
408 (arguments
409 (list
410 #:phases #~(modify-phases %standard-phases
411 (add-after 'unpack 'use-system-zopfli
412 (lambda _
413 (setenv "USE_SYSTEM_ZOPFLI" "1")))
414 (add-before 'build 'set-version
415 (lambda _
416 (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version)))
417 (replace 'check
418 (lambda* (#:key tests? #:allow-other-keys)
419 (when tests?
420 (invoke "pytest" "-vv")))))))
421 (native-inputs (list unzip python-pytest python-setuptools-scm))
422 (inputs (list zopfli))
423 (home-page "https://github.com/fonttools/py-zopfli")
424 (synopsis "Python bindings for Zopfli")
425 (description "@code{pyzopfli} is a straight forward wrapper around the
426 @code{ZlibCompress} method of the the @code{zopfli} library.")
427 (license license:asl2.0)))
428
429 (define-public python-zstandard
430 (package
431 (name "python-zstandard")
432 (version "0.15.2")
433 (source
434 (origin
435 (method url-fetch)
436 (uri (pypi-uri "zstandard" version))
437 (sha256
438 (base32 "0by9z7nxnkzhmza075q6q91rs8lnpf91129k8ppv7kymbwshipjj"))))
439 (build-system python-build-system)
440 (native-inputs
441 (list python-hypothesis))
442 (home-page "https://github.com/indygreg/python-zstandard")
443 (synopsis "Zstandard bindings for Python")
444 (description "This project provides Python bindings for interfacing with
445 the Zstandard compression library. A C extension and CFFI interface are
446 provided.")
447 (license license:bsd-3)))
448
449 (define-public python-pyzstd
450 (package
451 (name "python-pyzstd")
452 (version "0.14.3")
453 (source
454 (origin
455 (method url-fetch)
456 (uri (pypi-uri "pyzstd" version))
457 (sha256
458 (base32
459 "1d3mngs45w2p490vrq5ymd2wz4lp15phmks1ilcx4k7amgibml3d"))))
460 (build-system python-build-system)
461 (home-page "https://github.com/animalize/pyzstd")
462 (synopsis "Zstandard bindings for Python")
463 (description "This package provides Python bindings to the Zstandard (zstd)
464 compression library. The API is similar to Python's bz2/lzma/zlib module.")
465 (license license:bsd-3)))