projects/guix·blob wip-postfix · refs

601 lines · 20.8 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017, 2018, 2023 Tobias Geerinckx-Rice <[email protected]>
3;;; Copyright © 2017, 2019, 2021, 2022 Ricardo Wurmus <[email protected]>
4;;; Copyright © 2017 Nikita <[email protected]>
5;;; Copyright © 2017 Julien Lepiller <[email protected]>
6;;; Copyright © 2018-2020, 2022 Efraim Flashner <[email protected]>
7;;; Copyright © 2020 Nicolas Goaziou <[email protected]>
8;;; Copyright © 2020, 2022 Marius Bakke <[email protected]>
9;;; Copyright © 2021 Brendan Tildesley <[email protected]>
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 (guix build-system pyproject)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages libffi)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages check)
39 #:use-module (gnu packages maths)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages python-build)
43 #:use-module (gnu packages python-check)
44 #:use-module (gnu packages python-crypto)
45 #:use-module (gnu packages python-xyz)
46 #:use-module (gnu packages sphinx))
47
48(define-public python-multivolumefile
49 (package
50 (name "python-multivolumefile")
51 (version "0.2.3")
52 (source
53 (origin
54 (method url-fetch)
55 (uri (pypi-uri "multivolumefile" version))
56 (sha256
57 (base32
58 "1mh9sz50s1p8ik83a455pqd57syprad7xhfmk28yb5mwmw58sr50"))))
59 (build-system pyproject-build-system)
60 (native-inputs
61 (list python-setuptools-scm
62 python-coverage
63 python-coveralls
64 python-hypothesis
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
71file-object abstraction, making it possible to use multiple files as if they
72were a single file.")
73 (license license:lgpl2.1+)))
74
75(define-public python-pybcj
76 (package
77 (name "python-pybcj")
78 (version "1.0.1")
79 (source (origin
80 (method url-fetch)
81 (uri (pypi-uri "pybcj" version))
82 (sha256
83 (base32
84 "1hvm3c3mb20z25kmbzyyn6pr5inx50z0ignl8b0bggxaik82ws4b"))))
85 (build-system pyproject-build-system)
86 (propagated-inputs (list python-importlib-metadata))
87 (native-inputs
88 (list python-coverage
89 python-hypothesis
90 python-pytest
91 python-pytest-cov
92 python-setuptools-scm))
93 (home-page "https://codeberg.org/miurahr/pybcj")
94 (synopsis "BCJ filter library")
95 (description "In data compression, BCJ, short for Branch-Call-Jump, refers
96to a technique that improves the compression of machine code of executable
97binaries by replacing relative branch addresses with absolute ones. This
98allows a LZMA compressor to identify duplicate targets and archive higher
99compression rate. BCJ is used in the 7-zip compression utility as the default
100filter for executable binaries.
101
102pybcj provides Python bindings to a BCJ implementation in C.")
103 (license license:lgpl2.1+)))
104
105(define-public python-bcj-cffi
106 (package
107 (name "python-bcj-cffi")
108 (version "0.5.0")
109 (source
110 (origin
111 (method url-fetch)
112 (uri (pypi-uri "bcj-cffi" version))
113 (sha256
114 (base32
115 "1jcczrb8zgg6w7v76w1wpz3nw75fghk3xwxkn09ll7kck7sdf68d"))))
116 (build-system python-build-system)
117 (propagated-inputs
118 (list python-cffi python-toml python-setuptools-scm))
119 (native-inputs
120 (list python-setuptools python-coverage python-pytest
121 python-pytest-cov))
122 (home-page "https://github.com/miurahr/bcj-cffi")
123 (synopsis "Branch / Call /Jump CFFI library in Python")
124 (description "This package provides an implementation of the Branch / Call /
125Jump conversion filter by CFFI for Python.")
126 (license license:lgpl2.1+)))
127
128(define-public python-brotlicffi
129 (package
130 (name "python-brotlicffi")
131 (version "1.0.9.2")
132 (source (origin
133 (method url-fetch)
134 (uri (pypi-uri "brotlicffi" version))
135 (sha256
136 (base32
137 "15kxgdiqcg0cm6h5xq3vkbhw7674673hcx3n2yicd3wx29l8l90c"))
138 (snippet
139 #~(begin
140 (use-modules (guix build utils))
141 (delete-file-recursively "libbrotli")))))
142 (build-system pyproject-build-system)
143 (arguments
144 (list
145 #:phases
146 #~(modify-phases %standard-phases
147 (add-after 'unpack 'use-shared-brotli
148 (lambda _
149 (setenv "USE_SHARED_BROTLI" "1"))))))
150 (propagated-inputs (list python-cffi))
151 (inputs (list brotli))
152 (home-page "https://github.com/python-hyper/brotlicffi")
153 (synopsis "Python CFFI bindings to the Brotli library")
154 (description "This package provides Python CFFI bindings to the Brotli
155library.")
156 (license license:expat)))
157
158(define-public python-inflate64
159 (package
160 (name "python-inflate64")
161 (version "0.3.1")
162 (source (origin
163 (method url-fetch)
164 (uri (pypi-uri "inflate64" version))
165 (sha256
166 (base32
167 "0767j35gkwaykl1iq9qn8rc25j1ggv56x3d1vzjpk89bzpzdhbdm"))))
168 (build-system pyproject-build-system)
169 (propagated-inputs (list python-importlib-metadata))
170 (native-inputs
171 (list python-pyannotate
172 python-pytest
173 python-setuptools-scm))
174 (home-page "https://pypi.org/project/inflate64/")
175 (synopsis "deflate64 compression/decompression library")
176 (description "The @code{inflate64} package provides @code{Deflater} and
177@code{Inflater} classes to compress and decompress with the Enhanced Deflate
178compression algorithm.")
179 (license license:lgpl2.1+)))
180
181(define-public python-isal
182 (package
183 (name "python-isal")
184 (version "1.1.0")
185 (source
186 (origin
187 (method url-fetch)
188 (uri (pypi-uri "isal" version))
189 (sha256
190 (base32 "01914gwfrb95dagz9sqnsmvc0hssg2pb6aj204fdamss4piz8r0k"))
191 ;; Remove bundled isa-l source code
192 (modules '((guix build utils)))
193 (snippet
194 '(delete-file-recursively "src/isal/isa-l"))))
195 (build-system pyproject-build-system)
196 (arguments
197 `(#:phases
198 (modify-phases %standard-phases
199 (add-after 'unpack 'use-dynamic-linking
200 (lambda _ (setenv "PYTHON_ISAL_LINK_DYNAMIC" "1"))))))
201 (inputs (list isa-l))
202 (native-inputs (list python-cython))
203 (home-page "https://github.com/pycompression/python-isal")
204 (synopsis "Python bindings for the ISA-L compression library")
205 (description
206 "This package aims to provide faster zlib and gzip compatible compression
207and decompression by implementing Python bindings for the ISA-L library.")
208 (license license:expat)))
209
210(define-public python-pyppmd
211 (package
212 (name "python-pyppmd")
213 (version "1.0.0")
214 (source (origin
215 (method url-fetch)
216 (uri (pypi-uri "pyppmd" version))
217 (sha256
218 (base32
219 "03w4x26mar0ha73c3v39psn1i0k6xrzwmaxfsxysic73jz99np07"))))
220 (build-system pyproject-build-system)
221 (native-inputs
222 (list python-coverage
223 python-hypothesis
224 python-pytest
225 python-pytest-benchmark
226 python-pytest-cov
227 python-pytest-timeout
228 python-setuptools-scm))
229 (home-page "https://github.com/miurahr/pyppmd")
230 (synopsis "PPMd compression/decompression library")
231 (description "Pyppmd provides classes and functions for compressing and
232decompressing text data, using the @dfn{Prediction by partial matching} (PPM)
233compression algorithm variation H and I.2. It provides an API similar to
234Python's zlib/bz2/lzma modules.")
235 (license license:lgpl2.1+)))
236
237(define-public python-ppmd-cffi
238 (package
239 (name "python-ppmd-cffi")
240 (version "0.5.0")
241 (source
242 (origin
243 (method url-fetch)
244 (uri (pypi-uri "ppmd-cffi" version))
245 (sha256
246 (base32
247 "0vprpl29fkflqx0m6anfpx7q7i4cw0d0qxcdm91k4pl82dcad81g"))))
248 (build-system python-build-system)
249 (propagated-inputs
250 (list python-cffi))
251 (native-inputs
252 (list python-hypothesis
253 python-setuptools-scm
254 python-coverage
255 python-pytest
256 python-pytest-cov))
257 (home-page "https://github.com/miurahr/ppmd")
258 (synopsis "Prediction by Partial Matching compression library")
259 (description "PPMd is a compression algorithm library using the Prediction
260by Partial Matching statistical technique. It is used in RAR and 7-Zip as one of
261several possible methods.")
262 (license license:lgpl2.1+)))
263
264(define-public python-py7zr
265 (package
266 (name "python-py7zr")
267 (version "0.20.2")
268 (source
269 (origin
270 (method url-fetch)
271 (uri (pypi-uri "py7zr" version))
272 (sha256
273 (base32
274 "0lwniinfr3rb10n0c203a09vz06vxnnj637yqn8ipdlml89gj7kr"))))
275 (build-system pyproject-build-system)
276 (propagated-inputs
277 (list python-brotli
278 python-brotlicffi
279 python-importlib-metadata
280 python-inflate64
281 python-multivolumefile
282 python-psutil
283 python-pybcj
284 python-pycryptodomex
285 python-pyppmd
286 python-pyzstd
287 python-texttable))
288 (native-inputs
289 (list python-setuptools
290 python-setuptools-scm
291 python-coverage
292 python-coveralls
293 python-libarchive-c
294 python-py-cpuinfo
295 python-pyannotate
296 python-pytest
297 python-pytest-benchmark
298 python-pytest-cov
299 python-pytest-remotedata
300 python-pytest-timeout))
301 (home-page "https://github.com/miurahr/py7zr")
302 (synopsis "7-zip in Python")
303 (description "This package provides py7zr, which implements 7-zip
304archive compression, decompression, encryption and decryption in
305Python.")
306 (license license:lgpl2.1+)))
307
308(define-public python-lzo
309 (package
310 (name "python-lzo")
311 (version "1.14")
312 (source
313 (origin
314 (method url-fetch)
315 (uri (pypi-uri "python-lzo" version))
316 (sha256
317 (base32 "0315nq6r39n51n8qqamb7xv0ib0qrh76q7g3a1977172mbndijw3"))))
318 (build-system python-build-system)
319 (arguments
320 (list
321 #:test-target "check"
322 #:phases
323 #~(modify-phases %standard-phases
324 (add-after 'unpack 'patch-setuppy
325 (lambda _
326 (substitute* "setup.py"
327 (("include_dirs.append\\(.*\\)")
328 (string-append "include_dirs.append('"
329 #$(this-package-input "lzo")
330 "/include/lzo"
331 "')"))))))))
332 (inputs
333 (list lzo))
334 (home-page "https://github.com/jd-boyd/python-lzo")
335 (synopsis "Python bindings for the LZO data compression library")
336 (description
337 "Python-LZO provides Python bindings for LZO, i.e. you can access
338the LZO library from your Python scripts thereby compressing ordinary
339Python strings.")
340 (license license:gpl2+)))
341
342(define-public python-lz4
343 (package
344 (name "python-lz4")
345 (version "4.3.2")
346 (source
347 (origin
348 (method url-fetch)
349 (uri (pypi-uri "lz4" version))
350 (sha256
351 (base32
352 "1nmc36j5xnk7mvwwpm0nb1sddjk5iv77h877fdkkxcngm621shz1"))
353 (modules '((guix build utils)))
354 (snippet '(begin
355 ;; Remove bundled copy of lz4.
356 (delete-file-recursively "lz4libs")))))
357 (build-system python-build-system)
358 (arguments
359 (list #:phases
360 #~(modify-phases %standard-phases
361 (replace 'check
362 (lambda* (#:key tests? #:allow-other-keys)
363 (when tests?
364 ;; Taken from tox.ini (excludes experimental tests).
365 (invoke "pytest" "-vv" "tests/block" "tests/frame")))))))
366 (native-inputs
367 (list pkg-config python-pytest python-pkgconfig python-setuptools-scm
368 ;; For tests.
369 python-psutil))
370 (inputs
371 (list lz4))
372 (home-page "https://github.com/python-lz4/python-lz4")
373 (synopsis "LZ4 bindings for Python")
374 (description
375 "This package provides python bindings for the lz4 compression library
376by Yann Collet. The project contains bindings for the LZ4 block format and
377the LZ4 frame format.")
378 (license license:bsd-3)))
379
380(define-public python-lzstring
381 (package
382 (name "python-lzstring")
383 (version "1.0.4")
384 (source
385 (origin
386 (method url-fetch)
387 (uri (pypi-uri "lzstring" version))
388 (sha256
389 (base32
390 "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs"))))
391 (build-system python-build-system)
392 (propagated-inputs
393 (list python-future))
394 (home-page "https://github.com/gkovacs/lz-string-python")
395 (synopsis "String compression")
396 (description "Lz-string is a string compressor library for Python.")
397 (license license:expat)))
398
399(define-public bitshuffle
400 (package
401 (name "bitshuffle")
402 (version "0.3.5")
403 (source (origin
404 (method url-fetch)
405 (uri (pypi-uri "bitshuffle" version))
406 (sha256
407 (base32
408 "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy"))
409 (modules '((guix build utils)))
410 (snippet
411 '(begin
412 ;; Remove generated Cython files.
413 (delete-file "bitshuffle/h5.c")
414 (delete-file "bitshuffle/ext.c")
415 #t))))
416 (build-system python-build-system)
417 (arguments
418 `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769
419 #:phases
420 (modify-phases %standard-phases
421 (add-after 'unpack 'fix-neon-detection
422 ;; Neon is only for aarch64 ATM
423 ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73
424 (lambda _
425 (substitute* "src/bitshuffle_core.c"
426 (("#define USEARMNEON")
427 "#ifdef __aarch64__\n#define USEARMNEON\n#endif"))
428 #t))
429 (add-after 'unpack 'dont-build-native
430 (lambda _
431 (substitute* "setup.py"
432 (("'-march=native', ") ""))
433 #t)))))
434 (inputs
435 `(("numpy" ,python-numpy)
436 ("h5py" ,python-h5py)
437 ("hdf5" ,hdf5)))
438 (native-inputs
439 `(("cython" ,python-cython)))
440 (home-page "https://github.com/kiyo-masui/bitshuffle")
441 (synopsis "Filter for improving compression of typed binary data")
442 (description "Bitshuffle is an algorithm that rearranges typed, binary data
443for improving compression, as well as a python/C package that implements this
444algorithm within the Numpy framework.")
445 (license license:expat)))
446
447(define-public bitshuffle-for-snappy
448 (package/inherit bitshuffle
449 (name "bitshuffle-for-snappy")
450 (build-system gnu-build-system)
451 (arguments
452 (substitute-keyword-arguments (package-arguments bitshuffle)
453 ((#:tests? _ #f) #f)
454 ((#:phases phases)
455 `(modify-phases %standard-phases
456 (replace 'configure
457 (lambda* (#:key outputs #:allow-other-keys)
458 (with-output-to-file "Makefile"
459 (lambda _
460 (format #t "\
461libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
462\tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
463
464%.o: %.c
465\tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
466
467PREFIX:=~a
468LIBDIR:=$(PREFIX)/lib
469INCLUDEDIR:=$(PREFIX)/include
470
471install: libbitshuffle.so
472\tinstall -dm755 $(LIBDIR)
473\tinstall -dm755 $(INCLUDEDIR)
474\tinstall -m755 libbitshuffle.so $(LIBDIR)
475\tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
476\tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
477\tinstall -m644 src/iochain.h $(INCLUDEDIR)
478\tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
479" (assoc-ref outputs "out"))))
480 #t))))))
481 (inputs '())
482 (native-inputs '())))
483
484(define-public python-zipp
485 (package
486 (name "python-zipp")
487 (version "1.0.0")
488 (source
489 (origin
490 (method url-fetch)
491 (uri (pypi-uri "zipp" version))
492 (sha256
493 (base32
494 "0v3qayhqv7vyzydpydwcp51bqciw8p2ajddw68x5k8zppc0vx3yk"))))
495 (build-system python-build-system)
496 (propagated-inputs
497 (list python-more-itertools))
498 (native-inputs
499 (list python-setuptools-scm))
500 (home-page "https://github.com/jaraco/zipp")
501 (synopsis
502 "Backport of pathlib-compatible object wrapper for zip files")
503 (description
504 "This package provides a @code{pathlib}-compatible @code{Zipfile} object
505wrapper. It provides a backport of the @code{Path} object.")
506 (license license:expat)))
507
508(define-public python-zopfli
509 (package
510 (name "python-zopfli")
511 (version "0.2.2")
512 (source
513 (origin
514 (method url-fetch)
515 (uri (pypi-uri "zopfli" version ".zip"))
516 (sha256
517 (base32 "1z1akqx3fjnwa75insch9p08hafikqdvqkj6mxv1k6fr81sxnj9d"))))
518 (build-system python-build-system)
519 (arguments
520 (list
521 #:phases #~(modify-phases %standard-phases
522 (add-after 'unpack 'use-system-zopfli
523 (lambda _
524 (setenv "USE_SYSTEM_ZOPFLI" "1")))
525 (add-before 'build 'set-version
526 (lambda _
527 (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version)))
528 (replace 'check
529 (lambda* (#:key tests? #:allow-other-keys)
530 (when tests?
531 (invoke "pytest" "-vv")))))))
532 (native-inputs (list unzip python-pytest python-setuptools-scm))
533 (inputs (list zopfli))
534 (home-page "https://github.com/fonttools/py-zopfli")
535 (synopsis "Python bindings for Zopfli")
536 (description "@code{pyzopfli} is a straight forward wrapper around the
537@code{ZlibCompress} method of the the @code{zopfli} library.")
538 (license license:asl2.0)))
539
540(define-public python-zstandard
541 (package
542 (name "python-zstandard")
543 (version "0.19.0")
544 (source
545 (origin
546 (method url-fetch)
547 (uri (pypi-uri "zstandard" version))
548 (sha256
549 (base32 "0qvqhs121spk7yc1l20samflxx47waxv3xm55ksxpn1djk6jzl9i"))))
550 (build-system python-build-system)
551 (propagated-inputs
552 (list python-cffi))
553 (native-inputs
554 (list python-hypothesis))
555 (home-page "https://github.com/indygreg/python-zstandard")
556 (synopsis "Zstandard bindings for Python")
557 (description "This project provides Python bindings for interfacing with
558the Zstandard compression library. A C extension and CFFI interface are
559provided.")
560 (license license:bsd-3)))
561
562(define-public python-pyzstd
563 (package
564 (name "python-pyzstd")
565 (version "0.15.9")
566 (source
567 (origin
568 (method url-fetch)
569 (uri (pypi-uri "pyzstd" version))
570 (sha256
571 (base32 "1iycfmif15v1jhv0gsza1hyd1hn3sz0vn9s1y79abzv8axndxzfb"))
572 (modules '((guix build utils)))
573 (snippet
574 '(begin
575 ;; Remove a bundled copy of the zstd sources.
576 (delete-file-recursively "zstd")))))
577 (build-system python-build-system)
578 (arguments
579 (list
580 #:configure-flags
581 #~(list "--dynamic-link-zstd")
582 #:phases
583 #~(modify-phases %standard-phases
584 (replace 'build
585 ;; The python-build-system's phase doesn't honour configure-flags.
586 (lambda* (#:key configure-flags #:allow-other-keys)
587 (apply invoke "python" "./setup.py" "build"
588 configure-flags)))
589 (replace 'check
590 ;; The python-build-system's phase doesn't honour configure-flags.
591 (lambda* (#:key tests? test-target configure-flags
592 #:allow-other-keys)
593 (when tests?
594 (apply invoke "python" "./setup.py" test-target
595 configure-flags)))))))
596 (inputs (list `(,zstd "lib")))
597 (home-page "https://github.com/animalize/pyzstd")
598 (synopsis "Zstandard bindings for Python")
599 (description "This package provides Python bindings to the Zstandard (zstd)
600compression library. The API is similar to Python's bz2/lzma/zlib module.")
601 (license license:bsd-3)))