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>
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 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))
47 (define-public python-multivolumefile
49 (name "python-multivolumefile")
54 (uri (pypi-uri "multivolumefile" version))
57 "0j46wab4b09s3favjzp3zs1cn2sn8pr7qyngs5wn31hpqqxbbz76"))))
58 (build-system python-build-system)
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
73 (license license:lgpl2.1+)))
75 (define-public python-bcj-cffi
77 (name "python-bcj-cffi")
82 (uri (pypi-uri "bcj-cffi" version))
85 "1jcczrb8zgg6w7v76w1wpz3nw75fghk3xwxkn09ll7kck7sdf68d"))))
86 (build-system python-build-system)
88 (list python-cffi python-toml python-setuptools-scm))
90 (list python-setuptools python-coverage python-pytest
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+)))
98 (define-public python-isal
105 (uri (pypi-uri "isal" version))
107 (base32 "1bxj7r24p974pqfgym485s90ydhzji9q7zyfg3sf8fycm9ya01wd"))
108 ;; Remove bundles isa-l source code
109 (modules '((guix build utils)))
111 '(delete-file-recursively "src/isal/isa-l"))))
112 (build-system python-build-system)
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")
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)))
127 (define-public python-ppmd-cffi
129 (name "python-ppmd-cffi")
134 (uri (pypi-uri "ppmd-cffi" version))
137 "01wcd9l6pp6hivdmd275qh9dhcwficjqfl67hxix5n07vvq7jzz0"))))
138 (build-system python-build-system)
142 (list python-setuptools
143 python-setuptools-scm
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+)))
155 (define-public python-py7zr
157 (name "python-py7zr")
162 (uri (pypi-uri "py7zr" version))
165 "1zmgp7yax328fj8yj8pj4l7yh78hp727j6wk12vfi6nmi82wl32i"))))
166 (build-system python-build-system)
168 (list python-bcj-cffi
169 python-multivolumefile
176 (list python-setuptools
177 python-setuptools-scm
184 python-pytest-benchmark
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
193 (license license:lgpl2.1+)))
195 (define-public python-lzo
202 (uri (pypi-uri "python-lzo" version))
204 (base32 "0315nq6r39n51n8qqamb7xv0ib0qrh76q7g3a1977172mbndijw3"))))
205 (build-system python-build-system)
208 #:test-target "check"
210 #~(modify-phases %standard-phases
211 (add-after 'unpack 'patch-setuppy
213 (substitute* "setup.py"
214 (("include_dirs.append\\(.*\\)")
215 (string-append "include_dirs.append('"
216 #$(this-package-input "lzo")
221 (home-page "https://github.com/jd-boyd/python-lzo")
222 (synopsis "Python bindings for the LZO data compression library")
224 "Python-LZO provides Python bindings for LZO, i.e. you can access
225 the LZO library from your Python scripts thereby compressing ordinary
227 (license license:gpl2+)))
229 (define-public python-lz4
236 (uri (pypi-uri "lz4" version))
239 "16vj2bnhhdkcz2a2ai2mx2kf9ngx1cjr18636yp1514kq9r72fq8"))
240 (modules '((guix build utils)))
243 ;; Remove bundled copy of lz4.
244 (delete-file-recursively "lz4libs")
246 (build-system python-build-system)
249 #~(modify-phases %standard-phases
251 (lambda* (#:key tests? #:allow-other-keys)
253 ;; Taken from tox.ini (excludes experimental tests).
254 (invoke "pytest" "-vv" "tests/block" "tests/frame")))))))
256 (list pkg-config python-pytest python-pkgconfig python-setuptools-scm
261 (home-page "https://github.com/python-lz4/python-lz4")
262 (synopsis "LZ4 bindings for Python")
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)))
269 (define-public python-lzstring
271 (name "python-lzstring")
276 (uri (pypi-uri "lzstring" version))
279 "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs"))))
280 (build-system python-build-system)
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)))
288 (define-public bitshuffle
294 (uri (pypi-uri "bitshuffle" version))
297 "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy"))
298 (modules '((guix build utils)))
301 ;; Remove generated Cython files.
302 (delete-file "bitshuffle/h5.c")
303 (delete-file "bitshuffle/ext.c")
305 (build-system python-build-system)
307 `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769
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
314 (substitute* "src/bitshuffle_core.c"
315 (("#define USEARMNEON")
316 "#ifdef __aarch64__\n#define USEARMNEON\n#endif"))
318 (add-after 'unpack 'dont-build-native
320 (substitute* "setup.py"
321 (("'-march=native', ") ""))
324 `(("numpy" ,python-numpy)
325 ("h5py" ,python-h5py)
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)))
336 (define-public bitshuffle-for-snappy
337 (package/inherit bitshuffle
338 (name "bitshuffle-for-snappy")
339 (build-system gnu-build-system)
341 (substitute-keyword-arguments (package-arguments bitshuffle)
344 `(modify-phases %standard-phases
346 (lambda* (#:key outputs #:allow-other-keys)
347 (with-output-to-file "Makefile"
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 $^
354 \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
357 LIBDIR:=$(PREFIX)/lib
358 INCLUDEDIR:=$(PREFIX)/include
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"))))
371 (native-inputs '())))
373 (define-public python-zipp
380 (uri (pypi-uri "zipp" version))
383 "0v3qayhqv7vyzydpydwcp51bqciw8p2ajddw68x5k8zppc0vx3yk"))))
384 (build-system python-build-system)
386 (list python-more-itertools))
388 (list python-setuptools-scm))
389 (home-page "https://github.com/jaraco/zipp")
391 "Backport of pathlib-compatible object wrapper for zip files")
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)))
397 (define-public python-zopfli
399 (name "python-zopfli")
404 (uri (pypi-uri "zopfli" version ".zip"))
406 (base32 "1ipjkcgdbplsrhr31ypk48px8cax4cm9gcjj7yrcrhg20ql3s9p5"))))
407 (build-system python-build-system)
410 #:phases #~(modify-phases %standard-phases
411 (add-after 'unpack 'use-system-zopfli
413 (setenv "USE_SYSTEM_ZOPFLI" "1")))
414 (add-before 'build 'set-version
416 (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version)))
418 (lambda* (#:key tests? #:allow-other-keys)
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)))
429 (define-public python-zstandard
431 (name "python-zstandard")
436 (uri (pypi-uri "zstandard" version))
438 (base32 "0by9z7nxnkzhmza075q6q91rs8lnpf91129k8ppv7kymbwshipjj"))))
439 (build-system python-build-system)
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
447 (license license:bsd-3)))
449 (define-public python-pyzstd
451 (name "python-pyzstd")
456 (uri (pypi-uri "pyzstd" version))
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)))