projects/guix·blob audio-team · refs

1259 lines · 44.5 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016, 2017, 2018, 2023 Tobias Geerinckx-Rice <[email protected]>
3;;; Copyright © 2017, 2018, 2019, 2021, 2022, 2023 Ricardo Wurmus <[email protected]>
4;;; Copyright © 2017 Nikita <[email protected]>
5;;; Copyright © 2017 Julien Lepiller <[email protected]>
6;;; Copyright © 2018-2020, 2022, 2023 Efraim Flashner <[email protected]>
7;;; Copyright © 2020 Nicolas Goaziou <[email protected]>
8;;; Copyright © 2020, 2022, 2023 Marius Bakke <[email protected]>
9;;; Copyright © 2021, 2025 Brendan Tildesley <[email protected]>
10;;; Copyright © 2023, 2024 Troy Figiel <[email protected]>
11;;; Copyright © 2024 TakeV <[email protected]>
12;;; Copyright © 2023 Ivan Vilata i Balaguer <[email protected]>
13;;; Copyright © 2024 Maxim Cournoyer <[email protected]>
14;;; Copyright © 2025 Nicolas Graves <[email protected]>
15;;; Copyright © 2025 Vinicius Monego <[email protected]>
16;;;
17;;; This file is part of GNU Guix.
18;;;
19;;; GNU Guix is free software; you can redistribute it and/or modify it
20;;; under the terms of the GNU General Public License as published by
21;;; the Free Software Foundation; either version 3 of the License, or (at
22;;; your option) any later version.
23;;;
24;;; GNU Guix is distributed in the hope that it will be useful, but
25;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;;; GNU General Public License for more details.
28;;;
29;;; You should have received a copy of the GNU General Public License
30;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32(define-module (gnu packages python-compression)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix utils)
35 #:use-module (guix packages)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module (guix gexp)
39 #:use-module (guix build-system cargo)
40 #:use-module (guix build-system gnu)
41 #:use-module (guix build-system pyproject)
42 #:use-module (gnu packages)
43 #:use-module (gnu packages build-tools)
44 #:use-module (gnu packages libffi)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages cmake)
47 #:use-module (gnu packages check)
48 #:use-module (gnu packages machine-learning)
49 #:use-module (gnu packages maths)
50 #:use-module (gnu packages pkg-config)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages python-build)
53 #:use-module (gnu packages python-check)
54 #:use-module (gnu packages python-crypto)
55 #:use-module (gnu packages python-science)
56 #:use-module (gnu packages python-web)
57 #:use-module (gnu packages python-xyz)
58 #:use-module (gnu packages rust)
59 #:use-module (gnu packages rust-apps)
60 #:use-module (gnu packages sphinx))
61
62(define-public python-backports-zstd
63 (package
64 (name "python-backports-zstd")
65 (version "1.2.0")
66 (source
67 (origin
68 (method git-fetch)
69 (uri (git-reference
70 (url "https://github.com/rogdham/backports.zstd")
71 (commit (string-append "v" version))))
72 (file-name (git-file-name name version))
73 (sha256
74 (base32 "08dlr3zfk6fsn9g99msy2ap43c740hmc1l1c4xccigkrkjn9p0sp"))))
75 (build-system pyproject-build-system)
76 (arguments
77 (list
78 ;; tests: 1249 passed
79 #:test-backend #~'unittest
80 #:test-flags #~(list "discover" "tests")
81 #:phases
82 #~(modify-phases %standard-phases
83 (add-after 'unpack 'use-system-zstd
84 (lambda _
85 (substitute* "setup.py"
86 (("_SYSTEM_ZSTD = False")
87 "_SYSTEM_ZSTD = True"))))
88 (add-after 'unpack 'skip-copy-of-zstd-license
89 (lambda _
90 (substitute* "setup.py"
91 (("f.write.*read_text.*")
92 ""))))
93 (add-after 'unpack 'skip-tests-requiring-root
94 (lambda _
95 (substitute* "tests/test/test_tarfile.py"
96 (("import pwd, grp")
97 "return False"))))
98 (add-before 'check 'pre-check
99 (lambda _
100 ;; Skip tests that may fail when using the system library.
101 (setenv "BACKPORTSZSTD_SKIP_EXTENSION_TEST" "1"))))))
102 (native-inputs
103 (list pythoncapi-compat
104 python-setuptools))
105 (inputs
106 (list (list zstd "lib")))
107 (home-page "https://peps.python.org/pep-0784/")
108 (synopsis "Backport of compression.zstd for Python")
109 (description
110 "This package provides a backport of the compression.zstd module for
111Python versions below 3.14.")
112 (license license:psfl)))
113
114(define-public python-blosc
115 (package
116 (name "python-blosc")
117 (version "1.11.4")
118 (source
119 (origin
120 (method url-fetch)
121 (uri (pypi-uri "blosc" version))
122 (sha256
123 (base32
124 "0dqxyk87xwmj2g1midp29zpibf58vxqavx2sqy9ylfjdapci5cz0"))
125 (snippet
126 #~(begin (use-modules (guix build utils))
127 (delete-file-recursively "blosc/c-blosc")))))
128 (build-system pyproject-build-system)
129 (arguments
130 (list
131 #:test-backend #~'custom
132 #:test-flags #~(list "-m" "blosc.test")
133 #:phases
134 #~(modify-phases %standard-phases
135 (add-after 'unpack 'find-blosc
136 (lambda _
137 (setenv "USE_SYSTEM_BLOSC" "1")
138 (setenv "Blosc_ROOT" #$(this-package-input "c-blosc")))))))
139 (native-inputs
140 (list cmake-minimal
141 ninja/pinned
142 python-numpy
143 python-psutil
144 python-py-cpuinfo
145 python-scikit-build
146 python-setuptools))
147 (inputs
148 (list c-blosc))
149 (home-page "https://github.com/blosc/python-blosc")
150 (synopsis "Python wrapper for the Blosc data compressor library")
151 (description "Blosc is a high performance compressor optimized for binary
152data. It has been designed to transmit data to the processor cache faster
153than the traditional, non-compressed, direct memory fetch approach via a
154@code{memcpy()} system call.
155
156Blosc works well for compressing numerical arrays that contains data with
157relatively low entropy, like sparse data, time series, grids with
158regular-spaced values, etc.
159
160This Python package wraps the Blosc library.")
161 (license license:bsd-3)))
162
163(define-public python-blosc2
164 (package
165 (name "python-blosc2")
166 (version "3.12.2")
167 (source
168 (origin
169 (method url-fetch)
170 (uri (pypi-uri "blosc2" version))
171 (sha256
172 (base32 "17z3byk0q79rf7j8nh4k0qls1mwdrlylgi85qayqirvk9df92bx4"))))
173 (build-system pyproject-build-system)
174 (arguments
175 (list
176 ;; tests: 8192 passed, 7466 deselected
177 #:test-flags
178 ;; Network access is requited: OSError: Could not find a suitable TLS CA
179 ;; certificate bundle, invalid path: /etc/ssl/certs/ca-certificates.crt
180 #~(list "--deselect=tests/test_embed_store.py::test_with_remote"
181 "tests")
182 #:phases
183 #~(modify-phases %standard-phases
184 (add-before 'build 'configure
185 (lambda _
186 (setenv "USE_SYSTEM_BLOSC2" "ON"))))))
187 (native-inputs
188 (list cmake-minimal
189 pkg-config
190 python-cython
191 python-psutil
192 python-pytest
193 python-pytorch ;XXX: hard dependency to run tests
194 python-scikit-build-core
195 python-setuptools))
196 (inputs
197 (list c-blosc2))
198 (propagated-inputs
199 (list python-msgpack
200 python-ndindex
201 python-numexpr
202 python-numpy
203 python-platformdirs
204 python-py-cpuinfo
205 python-requests))
206 (home-page "https://github.com/blosc/python-blosc2")
207 (synopsis "Python wrapper for the Blosc2 data compressor library")
208 (description
209 "Blosc2 is a high performance compressor optimized for binary
210data. It has been designed to transmit data to the processor cache faster
211than the traditional, non-compressed, direct memory fetch approach via a
212@code{memcpy()} system call.
213
214Python-Blosc2 wraps the C-Blosc2 library, and it aims to leverage its new API
215so as to support super-chunks, multi-dimensional arrays, serialization and
216other features introduced in C-Blosc2.
217
218Python-Blosc2 also reproduces the API of Python-Blosc and is meant to be able
219to access its data, so it can be used as a drop-in replacement.")
220 (license license:bsd-3)))
221
222(define-public python-brotli
223 (package
224 (name "python-brotli")
225 (version "1.0.9")
226 (source
227 (origin
228 (method git-fetch)
229 (uri (git-reference
230 (url "https://github.com/google/brotli")
231 (commit (string-append "v" version))))
232 (file-name (git-file-name name version))
233 (sha256
234 (base32 "1fikasxf7r2dwlk8mv8w7nmjkn0jw5ic31ky3mvpkdzwgd4xfndl"))
235 (modules '((guix build utils)))
236 (snippet
237 #~(begin
238 ;; Cherry-picked from upstream since the latest release
239 ;; https://github.com/google/brotli/commit/09b0992b6acb7faa6fd3b23f9bc036ea117230fc
240 (substitute* (find-files "scripts" "^lib.*pc\\.in")
241 (("-R\\$\\{libdir\\} ") ""))))))
242 (build-system pyproject-build-system)
243 (native-inputs
244 (list python-pytest
245 python-setuptools))
246 (home-page "https://github.com/google/brotli")
247 (synopsis "Python interface to Brotli")
248 (description "This package provides a Python interface to the @code{brotli}
249package, an implementation of the Brotli lossless compression algorithm.")
250 (license license:expat)))
251
252(define-public python-multivolumefile
253 (package
254 (name "python-multivolumefile")
255 (version "0.2.3")
256 (source
257 (origin
258 (method url-fetch)
259 (uri (pypi-uri "multivolumefile" version))
260 (sha256
261 (base32
262 "1mh9sz50s1p8ik83a455pqd57syprad7xhfmk28yb5mwmw58sr50"))))
263 (build-system pyproject-build-system)
264 (native-inputs
265 (list python-pytest
266 python-setuptools
267 python-setuptools-scm))
268 (home-page "https://github.com/miurahr/multivolume")
269 (synopsis "Treat multiple files as one")
270 (description "MultiVolumefile is a Python library that provides a
271file-object abstraction, making it possible to use multiple files as if they
272were a single file.")
273 (license license:lgpl2.1+)))
274
275(define-public python-cramjam
276 (package
277 (name "python-cramjam")
278 (version "2.11.0.post1")
279 (source
280 (origin
281 (method git-fetch)
282 (uri (git-reference
283 (url "https://github.com/milesgranger/cramjam")
284 (commit (string-append "v" version))))
285 (file-name (git-file-name name version))
286 (sha256
287 (base32 "1028aydcjy7917vsgg67v6cnskzw0wk4x1vz017mar99yiq7z349"))))
288 (build-system pyproject-build-system)
289 (arguments
290 (list
291 ;; tests: 740 passed, 1 skipped, 4 deselected
292 #:test-flags
293 #~(list "--ignore=benchmarks/test_bench.py"
294 #$@(map (lambda (test)
295 (string-append "--deselect=tests/test_variants.py::"
296 test))
297 ;; FIXME: Did not raise cramjam.DecompressionError
298 (list "test_variants_raise_exception[deflate]"
299 ;; This test fails nondeterministically.
300 "test_variants_decompress_into[zlib-Buffer-File]"
301 ;; could not convert string to float: '<' -
302 ;; Consider hexadecimal for huge integer literals
303 ;; to avoid decimal conversion limits.
304 "test_variants_decompress_into[lz4-numpy-bytes]"
305 ;; could not convert string to float: 'M' -
306 ;; Consider hexadecimal for huge integer literals
307 ;; to avoid decimal conversion limits.
308 "test_variants_decompress_into[zstd-File-Buffer]")))
309 #:imported-modules `(,@%cargo-build-system-modules
310 ,@%pyproject-build-system-modules)
311 #:modules '(((guix build cargo-build-system) #:prefix cargo:)
312 (guix build pyproject-build-system)
313 (guix build utils))
314 #:phases
315 #~(modify-phases %standard-phases
316 (add-after 'unpack 'prepare-cargo-build-system
317 (lambda args
318 (for-each (lambda (phase)
319 (format #t "Running cargo phase: ~a~%" phase)
320 (apply (assoc-ref cargo:%standard-phases phase)
321 #:cargo-target #$(cargo-triplet)
322 args))
323 '(unpack-rust-crates
324 configure
325 check-for-pregenerated-files
326 patch-cargo-checksums))))
327 (add-before 'check 'configure-tests
328 (lambda _
329 ;; XXX: Otherwise some flaky tests seem to fail with
330 ;; SyntaxError: could not convert string to float
331 (setenv "CI" "1"))))))
332 (native-inputs
333 (append
334 (list maturin
335 pkg-config
336 python-pytest
337 python-pytest-xdist
338 python-numpy
339 python-hypothesis
340 rust
341 `(,rust "cargo"))
342 (or (and=> (%current-target-system)
343 (compose list make-rust-sysroot))
344 '())))
345 (inputs
346 (cons* libdeflate
347 lz4
348 `(,zstd "lib")
349 (cargo-inputs 'python-cramjam)))
350 (home-page "https://github.com/milesgranger/cramjam")
351 (synopsis "Python bindings to compression algorithms in Rust")
352 (description
353 "This package provides thin Python bindings to compression and
354decomporession algorithms implemented in Rust. This allows for using
355algorithms such as Snappy without additional system dependencies. The
356following algorithms are available:
357
358@itemize
359@item Snappy
360@item Brotli
361@item Bzip2
362@item LZ4
363@item Gzip
364@item Deflate
365@item Zstd
366@end itemize")
367 (license license:expat)))
368
369(define-public python-ewah-bool-utils
370 (package
371 (name "python-ewah-bool-utils")
372 (version "1.2.2")
373 (source
374 (origin
375 (method url-fetch)
376 (uri (pypi-uri "ewah_bool_utils" version))
377 (sha256
378 (base32 "1hvs1fvf3g7kq6hnzxyxfrwvmykw503cmxf1l3irs67gr931z47b"))))
379 (build-system pyproject-build-system)
380 (arguments
381 (list
382 #:phases
383 #~(modify-phases %standard-phases
384 (add-before 'check 'build-extensions
385 (lambda _
386 (invoke "python" "setup.py" "build_ext" "--inplace"))))))
387 (native-inputs
388 (list python-cython
389 python-pytest
390 python-setuptools
391 python-wheel))
392 (propagated-inputs
393 (list python-numpy))
394 (home-page "https://github.com/yt-project/ewah_bool_utils")
395 (synopsis "EWAH Bool Array compression")
396 (description "This package provide a Python wrapper to @acronym{EWAH,
397 Enhanced Word-Aligned Hybrid} compression bitarray method.")
398 (license (list
399 ;; LICENSE: for Python code.
400 license:bsd-3
401 ;; XXX: Check if it's possible to have it as a dedicated package
402 ;; and link here..
403 ;; ewah_bool_utils/cpp/LICENSE: for C++ bundle, sourced from
404 ;; <https://github.com/lemire/EWAHBoolArray>.
405 license:asl2.0))))
406
407(define-public python-pybcj
408 (package
409 (name "python-pybcj")
410 (version "1.0.7")
411 (source
412 (origin
413 (method git-fetch)
414 (uri (git-reference
415 (url "https://github.com/miurahr/pybcj")
416 (commit (string-append "v" version))))
417 (file-name (git-file-name name version))
418 (sha256
419 (base32 "1w5c706l0nhqrh1ms3m01w7pbd4vsm3jv84gxwlgrpr0w7d8hq7p"))))
420 (build-system pyproject-build-system)
421 (native-inputs
422 (list python-hypothesis
423 python-pytest
424 python-setuptools
425 python-setuptools-scm))
426 (home-page "https://github.com/miurahr/pybcj")
427 (synopsis "BCJ filter library")
428 (description "In data compression, BCJ, short for Branch-Call-Jump, refers
429to a technique that improves the compression of machine code of executable
430binaries by replacing relative branch addresses with absolute ones. This
431allows a LZMA compressor to identify duplicate targets and archive higher
432compression rate. BCJ is used in the 7-zip compression utility as the default
433filter for executable binaries.
434
435pybcj provides Python bindings to a BCJ implementation in C.")
436 (license license:lgpl2.1+)))
437
438;; XXX: Project is archived and not maintained since 2021.
439(define-public python-bcj-cffi
440 (package
441 (name "python-bcj-cffi")
442 (version "0.5.1")
443 (source
444 (origin
445 (method url-fetch)
446 (uri (pypi-uri "bcj-cffi" version))
447 (sha256
448 (base32 "1k6h9x8j65hssbgmvhl71sdjj9aq8d81drdibrdflaz7a895sjib"))))
449 (build-system pyproject-build-system)
450 (native-inputs
451 (list python-pytest python-setuptools python-setuptools-scm))
452 (propagated-inputs
453 (list python-cffi))
454 (home-page "https://github.com/miurahr/bcj-cffi")
455 (synopsis "Branch / Call /Jump CFFI library in Python")
456 (description "This package provides an implementation of the Branch / Call /
457Jump conversion filter by CFFI for Python.")
458 (license license:lgpl2.1+)))
459
460(define-public python-brotlicffi
461 (package
462 (name "python-brotlicffi")
463 (version "1.1.0.0")
464 (source
465 (origin
466 (method url-fetch)
467 (uri (pypi-uri "brotlicffi" version))
468 (sha256
469 (base32 "04rw11qllb43si8g6gnliy41gavkna9hnc8mg7w46lchi6k2fy5p"))
470 (snippet
471 #~(begin
472 (use-modules (guix build utils))
473 (delete-file-recursively "libbrotli")))))
474 (build-system pyproject-build-system)
475 (arguments
476 (list
477 #:phases
478 #~(modify-phases %standard-phases
479 (add-after 'unpack 'use-shared-brotli
480 (lambda _
481 (setenv "USE_SHARED_BROTLI" "1")))
482 (add-before 'check 'set-brotli-source
483 (lambda _
484 (let* ((brotli-source
485 #+(package-source (this-package-input "brotli")))
486 (brotli-test-data
487 (string-append brotli-source "/tests/testdata"))
488 (brotli-version-source
489 (string-append brotli-source "/c/common/version.h")))
490 (substitute* "test/conftest.py"
491 (("TEST_DATA_DIR = .*")
492 (format #f "TEST_DATA_DIR = ~s~%" brotli-test-data)))
493 (substitute* "test/test_compatibility.py"
494 (("open\\(version_h\\)")
495 (format #f "open(~s)" brotli-version-source)))))))))
496 (native-inputs
497 (list python-pytest
498 python-setuptools
499 python-wheel))
500 (inputs
501 (list brotli))
502 (propagated-inputs
503 (list python-cffi))
504 (home-page "https://github.com/python-hyper/brotlicffi")
505 (synopsis "Python CFFI bindings to the Brotli library")
506 (description
507 "This package provides Python CFFI bindings to the Brotli library.")
508 (license license:expat)))
509
510(define-public python-inflate64
511 (package
512 (name "python-inflate64")
513 (version "1.0.4")
514 (source (origin
515 (method url-fetch)
516 (uri (pypi-uri "inflate64" version))
517 (sha256
518 (base32
519 "1kh7nkvm6r6ccxkbygzwdjaxnspnhqd2ivf0mxvrf0hcjs3cd65k"))))
520 (build-system pyproject-build-system)
521 (native-inputs
522 (list python-pytest python-setuptools python-setuptools-scm))
523 (home-page "https://pypi.org/project/inflate64/")
524 (synopsis "Compression/decompression library")
525 (description "The @code{inflate64} package provides @code{Deflater} and
526@code{Inflater} classes to compress and decompress with the Enhanced Deflate
527compression algorithm.")
528 (license license:lgpl2.1+)))
529
530(define-public python-isal
531 (package
532 (name "python-isal")
533 (version "1.8.0")
534 (source
535 (origin
536 (method url-fetch)
537 (uri (pypi-uri "isal" version))
538 (sha256
539 (base32 "1d7j30922v547vnif171yhk1jml9cv14izda0w506qhslglk6hhj"))
540 ;; Remove bundled isa-l source code
541 (modules '((guix build utils)))
542 (snippet
543 #~(delete-file-recursively "src/isal/isa-l"))))
544 (build-system pyproject-build-system)
545 (arguments
546 (list
547 #:phases
548 #~(modify-phases %standard-phases
549 (add-after 'unpack 'use-dynamic-linking
550 (lambda _
551 (setenv "PYTHON_ISAL_LINK_DYNAMIC" "1"))))))
552 (inputs (list isa-l))
553 (native-inputs
554 (list python-cython
555 python-pytest
556 python-setuptools
557 python-setuptools-scm))
558 (home-page "https://github.com/pycompression/python-isal")
559 (synopsis "Python bindings for the ISA-L compression library")
560 (description
561 "This package aims to provide faster zlib and gzip compatible compression
562and decompression by implementing Python bindings for the ISA-L library.")
563 (license license:expat)))
564
565(define-public python-jaraco-stream
566 (package
567 (name "python-jaraco-stream")
568 (version "3.0.4")
569 (source
570 (origin
571 (method git-fetch)
572 (uri (git-reference
573 (url "https://github.com/jaraco/jaraco.stream")
574 (commit (string-append "v" version))))
575 (file-name (git-file-name name version))
576 (sha256
577 (base32 "0jsmyh37m78gfk70n3j5k5djh6pajn96sbkfi987sjil3r3ix854"))))
578 (build-system pyproject-build-system)
579 (native-inputs
580 (list python-pytest
581 python-setuptools
582 python-setuptools-scm))
583 (propagated-inputs
584 (list python-more-itertools))
585 (home-page "https://github.com/jaraco/jaraco.stream")
586 (synopsis "Routines for dealing with data streams")
587 (description
588 "This package includes a set of generators for dynamically loading gzip
589data. It is geared towards dealing with data streams.")
590 (license license:expat)))
591
592(define-public python-pylsqpack
593 (package
594 (name "python-pylsqpack")
595 (version "0.3.22")
596 (source (origin
597 (method url-fetch)
598 (uri (pypi-uri "pylsqpack" version))
599 (sha256
600 (base32
601 "1npcdj416gqc5zvlkyh9z808k381lrm56zvz1zsdjw437hdp2zxn"))))
602 ;; FIXME: Unbundle ls-qpack and xxhash!
603 (build-system pyproject-build-system)
604 (native-inputs (list python-pytest python-setuptools python-wheel))
605 (home-page "https://github.com/aiortc/pylsqpack")
606 (synopsis "Python bindings for @code{ls-qpack}")
607 (description
608 "@code{pylsqpack} is a wrapper around the @code{ls-qpack} library.
609It provides Python Decoder and Encoder objects to read or write HTTP/3
610headers compressed with QPACK.")
611 (license license:expat)))
612
613(define-public python-pyppmd
614 (package
615 (name "python-pyppmd")
616 (version "1.2.0")
617 (source
618 (origin
619 (method git-fetch)
620 (uri (git-reference
621 (url "https://github.com/miurahr/pyppmd")
622 (commit (string-append "v" version))))
623 (file-name (git-file-name name version))
624 (sha256
625 (base32 "1a3cqa6l1ip3kdd9d2h94znzrmgrhdbica83b494m9i3vl4i3glz"))))
626 (build-system pyproject-build-system)
627 (arguments
628 (list #:test-flags #~(list "--benchmark-disable")))
629 (native-inputs
630 (list python-hypothesis
631 python-pytest
632 python-pytest-benchmark
633 python-pytest-timeout
634 python-setuptools
635 python-setuptools-scm))
636 (home-page "https://github.com/miurahr/pyppmd")
637 (synopsis "PPMd compression/decompression library")
638 (description "Pyppmd provides classes and functions for compressing and
639decompressing text data, using the @dfn{Prediction by partial matching} (PPM)
640compression algorithm variation H and I.2. It provides an API similar to
641Python's zlib/bz2/lzma modules.")
642 (license license:lgpl2.1+)))
643
644;; XXX: Project is archived and not maintained since 2022.
645(define-public python-ppmd-cffi
646 (package
647 (name "python-ppmd-cffi")
648 (version "0.5.0")
649 (source
650 (origin
651 (method url-fetch)
652 (uri (pypi-uri "ppmd-cffi" version))
653 (sha256
654 (base32
655 "0vprpl29fkflqx0m6anfpx7q7i4cw0d0qxcdm91k4pl82dcad81g"))))
656 (build-system pyproject-build-system)
657 (arguments
658 (list
659 ;; AssertionError: assert False
660 #:test-flags #~(list "--deselect=tests/test_cli.py::test_cli_help")))
661 (propagated-inputs
662 (list python-cffi))
663 (native-inputs
664 (list python-pytest python-setuptools python-setuptools-scm))
665 (home-page "https://github.com/miurahr/ppmd")
666 (synopsis "Prediction by Partial Matching compression library")
667 (description "PPMd is a compression algorithm library using the Prediction
668by Partial Matching statistical technique. It is used in RAR and 7-Zip as one of
669several possible methods.")
670 (license license:lgpl2.1+)))
671
672(define-public python-py7zr
673 (package
674 (name "python-py7zr")
675 ;; Last version that still works with python-brotli 1.0.9.
676 (version "1.0.0")
677 (source
678 (origin
679 (method git-fetch)
680 (uri (git-reference
681 (url "https://github.com/miurahr/py7zr")
682 (commit (string-append "v" version))))
683 (file-name (git-file-name name version))
684 (sha256
685 (base32
686 "15mjxf9168iq4gvzpygdm7pv04a7p4fdww6y3340nv6a8qfl6z06"))))
687 (build-system pyproject-build-system)
688 (arguments
689 (list
690 #:test-flags
691 #~(list "--ignore=tests/test_benchmark.py")
692 #:phases
693 #~(modify-phases %standard-phases
694 (add-after 'unpack 'relax-requirements
695 (lambda _
696 (substitute* "pyproject.toml"
697 (("(brotli|brotlicffi)>=.*;" _ name)
698 (string-append name ";"))))))))
699 (propagated-inputs
700 (list python-backports-zstd
701 python-brotli
702 python-brotlicffi
703 python-inflate64
704 python-multivolumefile
705 python-psutil
706 python-pybcj
707 python-pycryptodomex
708 python-pyppmd
709 python-pyzstd
710 python-texttable))
711 (native-inputs
712 (list python-libarchive-c
713 python-pytest
714 python-pytest-benchmark
715 python-pytest-httpserver
716 python-pytest-remotedata
717 python-pytest-timeout
718 python-setuptools
719 python-setuptools-scm))
720 (home-page "https://github.com/miurahr/py7zr")
721 (synopsis "7-zip in Python")
722 (description "This package provides py7zr, which implements 7-zip
723archive compression, decompression, encryption and decryption in
724Python.")
725 (license license:lgpl2.1+)))
726
727(define-public python-lzo
728 (package
729 (name "python-lzo")
730 (version "1.15")
731 (source
732 (origin
733 (method url-fetch)
734 (uri (pypi-uri "python-lzo" version))
735 (sha256
736 (base32 "0jbv6853p8flk65ks0nw37f6f5v0ryi6nhppv5fm3863ql0alym5"))))
737 (build-system pyproject-build-system)
738 (arguments
739 (list
740 #:phases
741 #~(modify-phases %standard-phases
742 (add-after 'unpack 'patch-setuppy
743 (lambda* (#:key inputs #:allow-other-keys)
744 (substitute* "setup.py"
745 (("include_dirs.append\\(.*\\)")
746 (format #f "include_dirs.append(~s)"
747 (search-input-directory inputs "include/lzo")))))))))
748 (native-inputs (list python-pytest python-setuptools python-wheel))
749 (inputs (list lzo))
750 (home-page "https://github.com/jd-boyd/python-lzo")
751 (synopsis "Python bindings for the LZO data compression library")
752 (description
753 "Python-LZO provides Python bindings for LZO, i.e. you can access
754the LZO library from your Python scripts thereby compressing ordinary
755Python strings.")
756 (license license:gpl2+)))
757
758(define-public python-lz4
759 (package
760 (name "python-lz4")
761 (version "4.4.4")
762 (source
763 (origin
764 (method url-fetch)
765 (uri (pypi-uri "lz4" version))
766 (sha256
767 (base32
768 "1nmb757fx3k30zsjiaz7nj6cgp4zxl44w28s4l8k0ff4grid03q7"))
769 (modules '((guix build utils)))
770 (snippet '(begin
771 ;; Remove bundled copy of lz4.
772 (delete-file-recursively "lz4libs")))))
773 (build-system pyproject-build-system)
774 (arguments
775 ;; Taken from tox.ini (excludes experimental tests).
776 (list #:test-flags #~(list "tests/block" "tests/frame")))
777 (native-inputs
778 (list pkg-config
779 python-pytest
780 python-pkgconfig
781 python-setuptools
782 python-setuptools-scm
783 python-psutil))
784 (inputs
785 (list lz4))
786 (home-page "https://github.com/python-lz4/python-lz4")
787 (synopsis "LZ4 bindings for Python")
788 (description
789 "This package provides python bindings for the lz4 compression library
790by Yann Collet. The project contains bindings for the LZ4 block format and
791the LZ4 frame format.")
792 (license license:bsd-3)))
793
794(define-public python-lzstring
795 (package
796 (name "python-lzstring")
797 (version "1.0.4")
798 (source
799 (origin
800 (method url-fetch)
801 (uri (pypi-uri "lzstring" version))
802 (sha256
803 (base32 "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs"))))
804 (build-system pyproject-build-system)
805 (arguments
806 ;; No tests in PyPI, this project is a fork of
807 ;; <https://github.com/eduardtomasek/lz-string-python> and doesn't provide
808 ;; tags.
809 (list #:tests? #f))
810 (native-inputs
811 (list python-setuptools))
812 (propagated-inputs
813 (list python-future))
814 (home-page "https://github.com/gkovacs/lz-string-python")
815 (synopsis "String compression")
816 (description "Lz-string is a string compressor library for Python.")
817 (license license:expat)))
818
819(define-public python-python-snappy
820 (package
821 ;; PyPI contains both `snappy' and `python-snappy' as completely distinct
822 ;; packages. To avoid a name collision in Guix, we use the variable name
823 ;; `python-python-snappy' for the package called `python-snappy' on PyPI.
824 (name "python-python-snappy")
825 (version "0.7.3")
826 (source
827 (origin
828 (method url-fetch)
829 (uri (pypi-uri "python_snappy" version))
830 (sha256
831 (base32 "1qyfhsaagpzgrw5n2zklx670zi0f3lm1djqyg2n3hbgvmldnq8a0"))))
832 (build-system pyproject-build-system)
833 (arguments
834 (list #:test-backend #~'unittest))
835 (native-inputs (list python-setuptools))
836 (inputs
837 (list snappy))
838 (propagated-inputs (list python-cramjam))
839 (home-page "https://github.com/intake/python-snappy")
840 (synopsis "Python bindings for the Snappy compression library")
841 (description
842 "@code{python-python-snappy} provides bindings to the Snappy library and
843can be used to compress and decompress files and streams. It can also be used
844directly from the command line.")
845 (license license:bsd-3)))
846
847(define-public python-bitshuffle
848 (package
849 (name "python-bitshuffle")
850 (version "0.5.2")
851 (source (origin
852 (method url-fetch)
853 (uri (pypi-uri "bitshuffle" version))
854 (sha256
855 (base32
856 "139xz3m2m8sal8riicvmb9i0sq4085s2hc6c148bwhmzpnvky3nw"))
857 (modules '((guix build utils)))
858 (snippet
859 '(begin
860 ;; TODO Remove bundled libraries: lz4, lzf, and zstd.
861 ;; Remove generated Cython files.
862 (delete-file "bitshuffle/h5.c")
863 (delete-file "bitshuffle/ext.c")))))
864 (build-system pyproject-build-system)
865 (arguments
866 (list
867 #:test-flags
868 ;; FileNotFoundError: [Errno 2] Unable to synchronously open file
869 ;; (unable to open file: name =
870 ;; '/tmp/<...>/tests/data/regression_0.1.3.h5', errno = 2, error message
871 ;; = 'No such file or directory', flags = 0, o_flags = 0)
872 #~(list "--deselect=tests/test_regression.py::TestAll::test_regression")
873 #:phases
874 #~(modify-phases %standard-phases
875 (add-before 'build 'pre-build
876 ;; TODO: Check how to build on other architectures.
877 ;; Taken form .github/workflows/wheels.yml.
878 (lambda _
879 #$@(if (target-x86-64?)
880 '((setenv "BITSHUFFLE_ARCH" "haswell")
881 (setenv "CIBW_SKIP" "pp* *musllinux* cp311-macosx*")
882 (setenv "CIBW_ARCHS" "x86_64"))
883 '())
884 (setenv "HDF5_DIR" #$(this-package-input "hdf5")))))))
885 (native-inputs
886 (list python-cython
887 python-pytest
888 python-setuptools))
889 (inputs
890 (list python-numpy
891 python-h5py
892 hdf5))
893 (home-page "https://github.com/kiyo-masui/bitshuffle")
894 (synopsis "Filter for improving compression of typed binary data")
895 (description "Bitshuffle is an algorithm that rearranges typed, binary data
896for improving compression, as well as a python/C package that implements this
897algorithm within the Numpy framework.")
898 (license license:expat)))
899
900(define-public bitshuffle-for-snappy
901 (package/inherit python-bitshuffle
902 (name "bitshuffle-for-snappy")
903 (build-system gnu-build-system)
904 (arguments
905 (list
906 #:tests? #f
907 #:phases
908 #~(modify-phases %standard-phases
909 (replace 'configure
910 (lambda _
911 (with-output-to-file "Makefile"
912 (lambda _
913 (format #t "\
914libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
915\tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
916
917%.o: %.c
918\tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
919
920PREFIX:=~a
921LIBDIR:=$(PREFIX)/lib
922INCLUDEDIR:=$(PREFIX)/include
923
924install: libbitshuffle.so
925\tinstall -dm755 $(LIBDIR)
926\tinstall -dm755 $(INCLUDEDIR)
927\tinstall -m755 libbitshuffle.so $(LIBDIR)
928\tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
929\tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
930\tinstall -m644 src/iochain.h $(INCLUDEDIR)
931\tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
932" #$output))))))))
933 (inputs '())
934 (native-inputs '())))
935
936(define-public python-uncompresspy
937 (package
938 (name "python-uncompresspy")
939 (version "0.4.0")
940 (source
941 (origin
942 (method url-fetch)
943 (uri (pypi-uri "uncompresspy" version))
944 (sha256
945 (base32 "1110dipshnijhq6dk5dxzxx3zpynm6dx5kcc430fw24b8xwlc9in"))))
946 (build-system pyproject-build-system)
947 (arguments
948 (list #:tests? #f)) ;no tests
949 (native-inputs
950 (list python-setuptools))
951 (home-page "https://github.com/kYwzor/uncompresspy")
952 (synopsis "Uncompressing LZW files in Python")
953 (description
954 "This package implement a pure Python module for uncompressing LZW
955files (.Z), such as the ones created by Unix's shell tool compress.")
956 (license license:bsd-3)))
957
958(define-public python-unix-ar
959 (package
960 (name "python-unix-ar")
961 (version "0.2.1")
962 (source
963 (origin
964 (method git-fetch)
965 (uri (git-reference
966 (url "https://github.com/getninjas/unix_ar")
967 (commit version)))
968 (file-name (git-file-name name version))
969 (sha256
970 (base32 "0bdxm7y0r7xz3d2iglxwmf1290pi3h05x3gjc0f0af01pl2j2pqn"))))
971 (build-system pyproject-build-system)
972 (arguments
973 (list
974 #:test-flags
975 ;; These tests have timestamp-related issues.
976 #~(list "tests.py" "-k" "not test_add and not test_addfile")))
977 (native-inputs (list python-pytest python-setuptools python-wheel))
978 (home-page "https://github.com/getninjas/unix_ar")
979 (synopsis "AR file handling in Python")
980 (description "This package provides utilities to handle AR files in
981Python.")
982 (license license:bsd-3)))
983
984(define-public python-zipfile2
985 (package
986 (name "python-zipfile2")
987 (version "0.0.12")
988 (source
989 (origin
990 (method git-fetch)
991 (uri (git-reference
992 (url "https://github.com/itziakos/zipfile2/")
993 (commit (string-append "v" version))))
994 (file-name (git-file-name name version))
995 (sha256
996 (base32 "1hmq33r3ffrrvm5nggsp69cjdbgjbwn6zbcrs2rhmb8pds0h81q7"))
997 ;; TODO: Remove in the next release:
998 ;; https://github.com/itziakos/zipfile2/commit/5ea38d6eaaa5
999 (patches (search-patches "python-zipfile2-python-3.12-support.patch"))))
1000 (build-system pyproject-build-system)
1001 (native-inputs
1002 (list python-pytest
1003 python-setuptools))
1004 (home-page "https://github.com/itziakos/zipfile2/")
1005 (synopsis "Improved @code{ZipFile} Python class")
1006 (description
1007 "Zipfile2 is a backward compatible replacement to @code{ZipFile}. It
1008provides handling of symlinks, and exception management.")
1009 (license license:psfl)))
1010
1011(define-public python-zipp
1012 (package
1013 (name "python-zipp")
1014 (version "3.23.0")
1015 (source
1016 (origin
1017 (method url-fetch)
1018 (uri (pypi-uri "zipp" version))
1019 (sha256
1020 (base32 "0rj182i2d7d2bz067zrk39s19j09xsxkzprl82fqql8ji9c5fwd0"))))
1021 (build-system pyproject-build-system)
1022 (arguments (list #:tests? #f)) ;TODO: Tests require extra packaging
1023 (native-inputs
1024 (list ;; python-big-o
1025 ;; python-coherent-licensed
1026 ;; python-jaraco-functools ; introduces cycle
1027 ;; python-jaraco-itertools
1028 ;; python-jaraco-test ; introduces cycle
1029 python-more-itertools
1030 python-pytest
1031 ;; python-pytest-ignore-flaky
1032 python-setuptools
1033 python-setuptools-scm
1034 python-wheel))
1035 (home-page "https://github.com/jaraco/zipp")
1036 (synopsis
1037 "Backport of pathlib-compatible object wrapper for zip files")
1038 (description
1039 "This package provides a @code{pathlib}-compatible @code{Zipfile} object
1040wrapper. It provides a backport of the @code{Path} object.")
1041 (license license:expat)))
1042
1043(define-public python-deflate
1044 (package
1045 (name "python-deflate")
1046 (version "0.8.0")
1047 (source
1048 (origin
1049 (method url-fetch)
1050 (uri (pypi-uri "deflate" version))
1051 (sha256
1052 (base32 "0cgk118r3sglrjqirr22y7mr7fnhijhwd3v6isykjbf2m2dqyy41"))))
1053 (build-system pyproject-build-system)
1054 (arguments
1055 (list
1056 #:phases #~(modify-phases %standard-phases
1057 (add-after 'unpack 'libdeflate-prefix
1058 (lambda _
1059 (setenv "LIBDEFLATE_PREFIX"
1060 #$(this-package-input "libdeflate")))))))
1061 (native-inputs (list cmake-minimal python-pytest python-scikit-build-core))
1062 (inputs (list libdeflate))
1063 (home-page "https://github.com/dcwatson/deflate")
1064 (synopsis "Python wrapper for @code{libdeflate}")
1065 (description "This package contains a very thin Python wrapper for
1066@code{libdeflate}.")
1067 (license license:expat)))
1068
1069(define-public python-xopen
1070 (package
1071 (name "python-xopen")
1072 ;; TODO: Newer versions require zlib-ng:
1073 ;; <https://github.com/zlib-ng/zlib-ng>,
1074 ;; <https://github.com/pycompression/python-zlib-ng>.
1075 (version "1.8.0")
1076 (source
1077 (origin
1078 (method url-fetch)
1079 (uri (pypi-uri "xopen" version))
1080 (sha256
1081 (base32 "0h08wpd5zwnlzwnbbbhahbcs69kzsfbaaigqw0viq6ri8n4zrh00"))))
1082 (build-system pyproject-build-system)
1083 ;; tests: 343 passed, 5 skipped
1084 (native-inputs
1085 (list python-pytest
1086 python-pytest-timeout
1087 python-setuptools
1088 python-setuptools-scm))
1089 (propagated-inputs
1090 (list pigz python-isal))
1091 (home-page "https://github.com/marcelm/xopen/")
1092 (synopsis "Open compressed files transparently")
1093 (description "This module provides an @code{xopen} function that works
1094like Python's built-in @code{open} function, but can also deal with compressed
1095files. Supported compression formats are gzip, bzip2 and, xz, and are
1096automatically recognized by their file extensions. The focus is on being as
1097efficient as possible on all supported Python versions.")
1098 (license license:expat)))
1099
1100(define-public python-zipstream-ng
1101 (package
1102 (name "python-zipstream-ng")
1103 (version "1.9.0")
1104 (source
1105 (origin
1106 (method url-fetch)
1107 (uri (pypi-uri "zipstream_ng" version))
1108 (sha256
1109 (base32 "1snsczv5v2fvndxi8hbgd42ghhiwc20cdz8dz3xpw4rdh8q41nd0"))))
1110 (build-system pyproject-build-system)
1111 (native-inputs
1112 (list python-pytest python-setuptools python-wheel))
1113 (home-page "https://github.com/pR0Ps/zipstream-ng")
1114 (synopsis "Streamable zip file generator")
1115 (description
1116 "This package provides a modern and easy to use streamable zip file
1117generator")
1118 (license license:lgpl3)))
1119
1120(define-public python-zlib-ng
1121 (package
1122 (name "python-zlib-ng")
1123 (version "1.0.0")
1124 (source
1125 (origin
1126 (method git-fetch)
1127 (uri (git-reference
1128 (url "https://github.com/pycompression/python-zlib-ng")
1129 (commit (string-append "v" version))))
1130 (file-name (git-file-name name version))
1131 (sha256
1132 (base32 "05s0023hhdk59339mmd20yycy6ldssa2kmxmzflkqlab5mpx5wxp"))))
1133 (build-system pyproject-build-system)
1134 (arguments
1135 (list
1136 #:phases
1137 #~(modify-phases %standard-phases
1138 (add-after 'unpack 'use-system-zlib-ng
1139 (lambda _
1140 (copy-recursively
1141 #$(package-source (this-package-input "zlib-ng"))
1142 "src/zlib_ng/zlib-ng")
1143 (setenv "PYTHON_ZLIB_NG_LINK_DYNAMIC " "true"))))))
1144 (native-inputs
1145 (list cmake-minimal
1146 python-pytest
1147 python-setuptools
1148 python-setuptools-scm))
1149 (inputs
1150 (list zlib-ng))
1151 (home-page "https://github.com/pycompression/python-zlib-ng")
1152 (synopsis "Drop-in replacement for zlib and gzip modules using zlib-ng")
1153 (description
1154 "This package provides a faster @code{zlib} and @code{gzip} compatible
1155compression and decompression by providing Python bindings for the
1156@code{zlib-ng} library.")
1157 (license license:psfl)))
1158
1159(define-public python-zopfli
1160 (package
1161 (name "python-zopfli")
1162 (version "0.4.0")
1163 (source
1164 (origin
1165 (method git-fetch)
1166 (uri (git-reference
1167 (url "https://github.com/fonttools/py-zopfli")
1168 (commit (string-append "v" version))))
1169 (file-name (git-file-name name version))
1170 (sha256
1171 (base32 "1figk175w1q8ww8ryh2ypg7jjlkjbnry3gwhn8d56xh5icwgwi5g"))))
1172 (build-system pyproject-build-system)
1173 (arguments
1174 (list
1175 #:phases
1176 #~(modify-phases %standard-phases
1177 (add-after 'unpack 'use-system-zopfli
1178 (lambda _
1179 (setenv "USE_SYSTEM_ZOPFLI" "1"))))))
1180 (native-inputs
1181 (list python-pytest
1182 python-setuptools
1183 python-setuptools-scm))
1184 (inputs
1185 (list zopfli))
1186 (home-page "https://github.com/fonttools/py-zopfli")
1187 (synopsis "Python bindings for Zopfli")
1188 (description "@code{pyzopfli} is a straight forward wrapper around the
1189@code{ZlibCompress} method of the the @code{zopfli} library.")
1190 (license license:asl2.0)))
1191
1192(define-public python-zstandard
1193 (package
1194 (name "python-zstandard")
1195 (version "0.23.0")
1196 (source
1197 (origin
1198 (method url-fetch)
1199 (uri (pypi-uri "zstandard" version))
1200 (sha256
1201 (base32 "02dwqq5dw73zypvwpadscra8x6rwbglblh57yxl5y9g710nwdn5j"))))
1202 (build-system pyproject-build-system)
1203 ;; TODO: Unbunle zstd.
1204 (arguments
1205 (list
1206 #:phases
1207 #~(modify-phases %standard-phases
1208 (add-after 'unpack 'patch-build-system
1209 (lambda _
1210 (substitute* "pyproject.toml"
1211 ((":__legacy__") ""))))
1212 (add-before 'check 'build-extensions
1213 (lambda _
1214 (invoke "python" "setup.py" "build_ext" "--inplace"))))))
1215 (native-inputs
1216 (list python-pytest python-setuptools))
1217 (propagated-inputs
1218 (list python-cffi))
1219 (home-page "https://github.com/indygreg/python-zstandard")
1220 (synopsis "Zstandard bindings for Python")
1221 (description "This project provides Python bindings for interfacing with
1222the Zstandard compression library. A C extension and CFFI interface are
1223provided.")
1224 (license license:bsd-3)))
1225
1226(define-public python-pyzstd
1227 (package
1228 (name "python-pyzstd")
1229 (version "0.18.0")
1230 (source
1231 (origin
1232 (method git-fetch)
1233 (uri (git-reference
1234 (url "https://github.com/Rogdham/pyzstd")
1235 (commit version)))
1236 (file-name (git-file-name name version))
1237 (sha256
1238 (base32 "08ih7vr3rzwrzpzwhk1k94z5nm9mmvls7c6w8wsqncf0kyl8d7yp"))
1239 (modules '((guix build utils)))
1240 (snippet '(begin
1241 ;; Remove a bundled copy of the zstd sources.
1242 (delete-file-recursively "zstd")
1243 (mkdir "zstd")
1244 (call-with-output-file "zstd/LICENSE"
1245 (const #t))))))
1246 (build-system pyproject-build-system)
1247 (arguments
1248 (list
1249 #:configure-flags
1250 #~'(("--build-option" . "--dynamic-link-zstd"))))
1251 (inputs (list `(,zstd "lib")))
1252 (native-inputs (list python-pytest python-setuptools))
1253 (propagated-inputs (list python-typing-extensions))
1254 (home-page "https://github.com/Rogdham/pyzstd")
1255 (synopsis "Zstandard bindings for Python")
1256 (description
1257 "This package provides Python bindings to the Zstandard (zstd)
1258compression library. The API is similar to Python's bz2/lzma/zlib module.")
1259 (license license:bsd-3)))