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>
11 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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 build-system gnu)
32 #:use-module (guix build-system python)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages libffi)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages maths)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages python)
40 #:use-module (gnu packages python-build)
41 #:use-module (gnu packages python-check)
42 #:use-module (gnu packages python-crypto)
43 #:use-module (gnu packages python-xyz)
44 #:use-module (gnu packages sphinx))
46 (define-public python-multivolumefile
48 (name "python-multivolumefile")
53 (uri (pypi-uri "multivolumefile" version))
56 "0j46wab4b09s3favjzp3zs1cn2sn8pr7qyngs5wn31hpqqxbbz76"))))
57 (build-system python-build-system)
59 `(("python-pep517" ,python-pep517)
60 ("python-setuptools" ,python-setuptools)
61 ("python-setuptools-scm" ,python-setuptools-scm/next)
62 ("python-coverage" ,python-coverage)
63 ("python-coveralls" ,python-coveralls)
64 ("python-pyannotate" ,python-pyannotate)
65 ("python-pytest" ,python-pytest)
66 ("python-pytest-cov" ,python-pytest-cov)))
67 (home-page "https://github.com/miurahr/multivolume")
68 (synopsis "Treat multiple files as one")
69 (description "MultiVolumefile is a Python library that provides a
70 file-object abstraction, making it possible to use multiple files as if they
72 (license license:lgpl2.1+)))
74 (define-public python-bcj-cffi
76 (name "python-bcj-cffi")
81 (uri (pypi-uri "bcj-cffi" version))
84 "1jcczrb8zgg6w7v76w1wpz3nw75fghk3xwxkn09ll7kck7sdf68d"))))
85 (build-system python-build-system)
87 `(("python-cffi" ,python-cffi)
88 ("python-toml" ,python-toml)
89 ("python-setuptools-scm" ,python-setuptools-scm/next)))
91 `(("python-setuptools" ,python-setuptools)
92 ("python-coverage" ,python-coverage)
93 ("python-pytest" ,python-pytest)
94 ("python-pytest-cov" ,python-pytest-cov)))
95 (home-page "https://github.com/miurahr/bcj-cffi")
96 (synopsis "Branch / Call /Jump CFFI library in Python")
97 (description "This package provides an implementation of the Branch / Call /
98 Jump conversion filter by CFFI for Python.")
99 (license license:lgpl2.1+)))
101 (define-public python-ppmd-cffi
103 (name "python-ppmd-cffi")
108 (uri (pypi-uri "ppmd-cffi" version))
111 "01wcd9l6pp6hivdmd275qh9dhcwficjqfl67hxix5n07vvq7jzz0"))))
112 (build-system python-build-system)
114 `(("python-cffi" ,python-cffi)))
116 `(("python-setuptools" ,python-setuptools)
117 ("python-setuptools-scm" ,python-setuptools-scm/next)
118 ("python-pep517" ,python-pep517)
119 ("python-coverage" ,python-coverage)
120 ("python-pytest" ,python-pytest)
121 ("python-pytest-cov" ,python-pytest-cov)))
122 (home-page "https://github.com/miurahr/ppmd")
123 (synopsis "Prediction by Partial Matching compression library")
124 (description "PPMd is a compression algorithm library using the Prediction
125 by Partial Matching statistical technique. It is used in RAR and 7-Zip as one of
126 several possible methods.")
127 (license license:lgpl2.1+)))
129 (define-public python-py7zr
131 (name "python-py7zr")
136 (uri (pypi-uri "py7zr" version))
139 "1zmgp7yax328fj8yj8pj4l7yh78hp727j6wk12vfi6nmi82wl32i"))))
140 (build-system python-build-system)
142 `(("python-bcj-cffi" ,python-bcj-cffi)
143 ("python-multivolumefile" ,python-multivolumefile)
144 ("python-ppmd-cffi" ,python-ppmd-cffi)
145 ("python-pycryptodome" ,python-pycryptodome)
146 ("python-pyzstd" ,python-pyzstd)
147 ("python-texttable" ,python-texttable)
148 ("python-zstandard" ,python-zstandard)))
150 `(("python-setuptools" ,python-setuptools)
151 ("python-setuptools-scm" ,python-setuptools-scm/next)
152 ("python-coverage" ,python-coverage)
153 ("python-coveralls" ,python-coveralls)
154 ("python-libarchive-c" ,python-libarchive-c)
155 ("python-py-cpuinfo" ,python-py-cpuinfo)
156 ("python-pyannotate" ,python-pyannotate)
157 ("python-pytest" ,python-pytest)
158 ("python-pytest-benchmark" ,python-pytest-benchmark)
159 ("python-pytest-cov" ,python-pytest-cov)
160 ("python-pytest-remotedata" ,python-pytest-remotedata)
161 ("python-pytest-timeout" ,python-pytest-timeout)))
162 (home-page "https://github.com/miurahr/py7zr")
163 (synopsis "7-zip in Python")
164 (description "This package provides py7zr, which implements 7-zip
165 archive compression, decompression, encryption and decryption in
167 (license license:lgpl2.1+)))
169 (define-public python-lzo
176 (uri (pypi-uri "python-lzo" version))
179 "0iakqgd51n1cd7r3lpdylm2rgbmd16y74cra9kcapwg84mlf9a4p"))))
180 (build-system python-build-system)
182 `(#:test-target "check"
184 (modify-phases %standard-phases
185 (add-after 'unpack 'patch-setuppy
187 (substitute* "setup.py"
188 (("include_dirs.append\\(.*\\)")
189 (string-append "include_dirs.append('"
190 (assoc-ref %build-inputs "lzo")
196 (home-page "https://github.com/jd-boyd/python-lzo")
197 (synopsis "Python bindings for the LZO data compression library")
199 "Python-LZO provides Python bindings for LZO, i.e. you can access
200 the LZO library from your Python scripts thereby compressing ordinary
202 (license license:gpl2+)))
204 (define-public python2-lzo
205 (package-with-python2 python-lzo))
207 (define-public python-lz4
214 (uri (pypi-uri "lz4" version))
217 "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0"))
218 (modules '((guix build utils)))
221 ;; Remove bundled copy of lz4.
222 (delete-file-recursively "lz4libs")
224 (build-system python-build-system)
226 `(("pkg-config" ,pkg-config)
227 ("python-nose" ,python-nose)
228 ("python-setuptools-scm" ,python-setuptools-scm)))
231 (home-page "https://github.com/python-lz4/python-lz4")
232 (synopsis "LZ4 bindings for Python")
234 "This package provides python bindings for the lz4 compression library
235 by Yann Collet. The project contains bindings for the LZ4 block format and
236 the LZ4 frame format.")
237 (license license:bsd-3)))
239 (define-public python2-lz4
240 (package-with-python2 python-lz4))
242 (define-public python-lzstring
244 (name "python-lzstring")
249 (uri (pypi-uri "lzstring" version))
252 "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs"))))
253 (build-system python-build-system)
255 `(("python-future" ,python-future)))
256 (home-page "https://github.com/gkovacs/lz-string-python")
257 (synopsis "String compression")
258 (description "Lz-string is a string compressor library for Python.")
259 (license license:expat)))
261 (define-public python2-lzstring
262 (package-with-python2 python-lzstring))
264 (define-public python-brotli
266 (name "python-brotli")
271 (uri (pypi-uri "Brotli" version ".zip"))
274 "0f4433s4wv9masc303kkb1s0a09x81xwr8pdvj0kyxzdl05826sd"))))
275 (build-system python-build-system)
278 (home-page "https://github.com/google/brotli")
279 (synopsis "Python bindings for the Brotli compression library")
281 "This package provides python bindings for the Brotli compression library.")
282 (license license:asl2.0)))
284 (define-public bitshuffle
290 (uri (pypi-uri "bitshuffle" version))
293 "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy"))
294 (modules '((guix build utils)))
297 ;; Remove generated Cython files.
298 (delete-file "bitshuffle/h5.c")
299 (delete-file "bitshuffle/ext.c")
301 (build-system python-build-system)
303 `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769
305 (modify-phases %standard-phases
306 (add-after 'unpack 'fix-neon-detection
307 ;; Neon is only for aarch64 ATM
308 ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73
310 (substitute* "src/bitshuffle_core.c"
311 (("#define USEARMNEON")
312 "#ifdef __aarch64__\n#define USEARMNEON\n#endif"))
314 (add-after 'unpack 'dont-build-native
316 (substitute* "setup.py"
317 (("'-march=native', ") ""))
320 `(("numpy" ,python-numpy)
321 ("h5py" ,python-h5py)
324 `(("cython" ,python-cython)))
325 (home-page "https://github.com/kiyo-masui/bitshuffle")
326 (synopsis "Filter for improving compression of typed binary data")
327 (description "Bitshuffle is an algorithm that rearranges typed, binary data
328 for improving compression, as well as a python/C package that implements this
329 algorithm within the Numpy framework.")
330 (license license:expat)))
332 (define-public bitshuffle-for-snappy
333 (package/inherit bitshuffle
334 (name "bitshuffle-for-snappy")
335 (build-system gnu-build-system)
337 (substitute-keyword-arguments (package-arguments bitshuffle)
340 `(modify-phases %standard-phases
342 (lambda* (#:key outputs #:allow-other-keys)
343 (with-output-to-file "Makefile"
346 libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
347 \tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
350 \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
353 LIBDIR:=$(PREFIX)/lib
354 INCLUDEDIR:=$(PREFIX)/include
356 install: libbitshuffle.so
357 \tinstall -dm755 $(LIBDIR)
358 \tinstall -dm755 $(INCLUDEDIR)
359 \tinstall -m755 libbitshuffle.so $(LIBDIR)
360 \tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
361 \tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
362 \tinstall -m644 src/iochain.h $(INCLUDEDIR)
363 \tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
364 " (assoc-ref outputs "out"))))
367 (native-inputs '())))
369 (define-public python-zipp
376 (uri (pypi-uri "zipp" version))
379 "0v3qayhqv7vyzydpydwcp51bqciw8p2ajddw68x5k8zppc0vx3yk"))))
380 (build-system python-build-system)
382 `(("python-more-itertools" ,python-more-itertools)))
384 `(("python-setuptools-scm" ,python-setuptools-scm)))
385 (home-page "https://github.com/jaraco/zipp")
387 "Backport of pathlib-compatible object wrapper for zip files")
389 "This package provides a @code{pathlib}-compatible @code{Zipfile} object
390 wrapper. It provides a backport of the @code{Path} object.")
391 (properties `((python2-variant . ,(delay python2-zipp))))
392 (license license:expat)))
394 (define-public python2-zipp
395 (let ((base (package-with-python2 (strip-python2-variant python-zipp))))
399 `(("python-contextlib2" ,python2-contextlib2)
400 ("python-pathlib2" ,python2-pathlib2)
401 ("python-unittest2" ,python2-unittest2)
402 ,@(package-native-inputs base))))))
404 ;; This package is used to bootstrap pytest, via importlib-metadata.
405 (define-public python2-zipp-bootstrap
409 (name "python2-zipp-bootstrap")
412 ,@(package-arguments python2-zipp)))
414 `(("python-setuptools-scm" ,python2-setuptools-scm))))))
416 (define-public python-zstandard
418 (name "python-zstandard")
423 (uri (pypi-uri "zstandard" version))
425 (base32 "0by9z7nxnkzhmza075q6q91rs8lnpf91129k8ppv7kymbwshipjj"))))
426 (build-system python-build-system)
428 `(("python-hypothesis" ,python-hypothesis)))
429 (home-page "https://github.com/indygreg/python-zstandard")
430 (synopsis "Zstandard bindings for Python")
431 (description "This project provides Python bindings for interfacing with
432 the Zstandard compression library. A C extension and CFFI interface are
434 (license license:bsd-3)))
436 (define-public python-pyzstd
438 (name "python-pyzstd")
443 (uri (pypi-uri "pyzstd" version))
446 "1d3mngs45w2p490vrq5ymd2wz4lp15phmks1ilcx4k7amgibml3d"))))
447 (build-system python-build-system)
448 (home-page "https://github.com/animalize/pyzstd")
449 (synopsis "Zstandard bindings for Python")
450 (description "This package provides Python bindings to the Zstandard (zstd)
451 compression library. The API is similar to Python's bz2/lzma/zlib module.")
452 (license license:bsd-3)))