projects/guix·blob nckx-patch-1 · refs

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