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