projects/guix·blob hurd-team · refs

1175 lines · 41.2 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: 742 passed, 1 skipped, 2 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 ;; This test fails nondeterministically.
298 "--deselect=tests/test_variants.py::test_variants_decompress_into[zlib-Buffer-File]")
299 #:imported-modules `(,@%cargo-build-system-modules
300 ,@%pyproject-build-system-modules)
301 #:modules '(((guix build cargo-build-system) #:prefix cargo:)
302 (guix build pyproject-build-system)
303 (guix build utils))
304 #:phases
305 #~(modify-phases %standard-phases
306 (add-after 'unpack 'prepare-cargo-build-system
307 (lambda args
308 (for-each (lambda (phase)
309 (format #t "Running cargo phase: ~a~%" phase)
310 (apply (assoc-ref cargo:%standard-phases phase)
311 #:cargo-target #$(cargo-triplet)
312 args))
313 '(unpack-rust-crates
314 configure
315 check-for-pregenerated-files
316 patch-cargo-checksums))))
317 (add-before 'check 'configure-tests
318 (lambda _
319 ;; XXX: Otherwise some flaky tests seem to fail with
320 ;; SyntaxError: could not convert string to float
321 (setenv "CI" "1"))))))
322 (native-inputs
323 (append
324 (list maturin
325 pkg-config
326 python-pytest
327 python-pytest-xdist
328 python-numpy
329 python-hypothesis
330 rust
331 `(,rust "cargo"))
332 (or (and=> (%current-target-system)
333 (compose list make-rust-sysroot))
334 '())))
335 (inputs
336 (cons* libdeflate
337 lz4
338 `(,zstd "lib")
339 (cargo-inputs 'python-cramjam)))
340 (home-page "https://github.com/milesgranger/cramjam")
341 (synopsis "Python bindings to compression algorithms in Rust")
342 (description
343 "This package provides thin Python bindings to compression and
344decomporession algorithms implemented in Rust. This allows for using
345algorithms such as Snappy without additional system dependencies. The
346following algorithms are available:
347
348@itemize
349@item Snappy
350@item Brotli
351@item Bzip2
352@item LZ4
353@item Gzip
354@item Deflate
355@item Zstd
356@end itemize")
357 (license license:expat)))
358
359(define-public python-ewah-bool-utils
360 (package
361 (name "python-ewah-bool-utils")
362 (version "1.2.2")
363 (source
364 (origin
365 (method url-fetch)
366 (uri (pypi-uri "ewah_bool_utils" version))
367 (sha256
368 (base32 "1hvs1fvf3g7kq6hnzxyxfrwvmykw503cmxf1l3irs67gr931z47b"))))
369 (build-system pyproject-build-system)
370 (arguments
371 (list
372 #:phases
373 #~(modify-phases %standard-phases
374 (add-before 'check 'build-extensions
375 (lambda _
376 (invoke "python" "setup.py" "build_ext" "--inplace"))))))
377 (native-inputs
378 (list python-cython
379 python-pytest
380 python-setuptools
381 python-wheel))
382 (propagated-inputs
383 (list python-numpy))
384 (home-page "https://github.com/yt-project/ewah_bool_utils")
385 (synopsis "EWAH Bool Array compression")
386 (description "This package provide a Python wrapper to @acronym{EWAH,
387 Enhanced Word-Aligned Hybrid} compression bitarray method.")
388 (license (list
389 ;; LICENSE: for Python code.
390 license:bsd-3
391 ;; XXX: Check if it's possible to have it as a dedicated package
392 ;; and link here..
393 ;; ewah_bool_utils/cpp/LICENSE: for C++ bundle, sourced from
394 ;; <https://github.com/lemire/EWAHBoolArray>.
395 license:asl2.0))))
396
397(define-public python-pybcj
398 (package
399 (name "python-pybcj")
400 (version "1.0.1")
401 (source (origin
402 (method url-fetch)
403 (uri (pypi-uri "pybcj" version))
404 (sha256
405 (base32
406 "1hvm3c3mb20z25kmbzyyn6pr5inx50z0ignl8b0bggxaik82ws4b"))))
407 (build-system pyproject-build-system)
408 (native-inputs
409 (list python-pytest
410 python-setuptools
411 python-setuptools-scm))
412 (home-page "https://codeberg.org/miurahr/pybcj")
413 (synopsis "BCJ filter library")
414 (description "In data compression, BCJ, short for Branch-Call-Jump, refers
415to a technique that improves the compression of machine code of executable
416binaries by replacing relative branch addresses with absolute ones. This
417allows a LZMA compressor to identify duplicate targets and archive higher
418compression rate. BCJ is used in the 7-zip compression utility as the default
419filter for executable binaries.
420
421pybcj provides Python bindings to a BCJ implementation in C.")
422 (license license:lgpl2.1+)))
423
424;; XXX: Project is archived and not maintained since 2021.
425(define-public python-bcj-cffi
426 (package
427 (name "python-bcj-cffi")
428 (version "0.5.1")
429 (source
430 (origin
431 (method url-fetch)
432 (uri (pypi-uri "bcj-cffi" version))
433 (sha256
434 (base32 "1k6h9x8j65hssbgmvhl71sdjj9aq8d81drdibrdflaz7a895sjib"))))
435 (build-system pyproject-build-system)
436 (native-inputs
437 (list python-pytest
438 python-pytest-cov
439 python-setuptools
440 python-setuptools-scm))
441 (propagated-inputs
442 (list python-cffi))
443 (home-page "https://github.com/miurahr/bcj-cffi")
444 (synopsis "Branch / Call /Jump CFFI library in Python")
445 (description "This package provides an implementation of the Branch / Call /
446Jump conversion filter by CFFI for Python.")
447 (license license:lgpl2.1+)))
448
449(define-public python-brotlicffi
450 (package
451 (name "python-brotlicffi")
452 (version "1.1.0.0")
453 (source
454 (origin
455 (method url-fetch)
456 (uri (pypi-uri "brotlicffi" version))
457 (sha256
458 (base32 "04rw11qllb43si8g6gnliy41gavkna9hnc8mg7w46lchi6k2fy5p"))
459 (snippet
460 #~(begin
461 (use-modules (guix build utils))
462 (delete-file-recursively "libbrotli")))))
463 (build-system pyproject-build-system)
464 (arguments
465 (list
466 #:phases
467 #~(modify-phases %standard-phases
468 (add-after 'unpack 'use-shared-brotli
469 (lambda _
470 (setenv "USE_SHARED_BROTLI" "1")))
471 (add-before 'check 'set-brotli-source
472 (lambda _
473 (let* ((brotli-source
474 #+(package-source (this-package-input "brotli")))
475 (brotli-test-data
476 (string-append brotli-source "/tests/testdata"))
477 (brotli-version-source
478 (string-append brotli-source "/c/common/version.h")))
479 (substitute* "test/conftest.py"
480 (("TEST_DATA_DIR = .*")
481 (format #f "TEST_DATA_DIR = ~s~%" brotli-test-data)))
482 (substitute* "test/test_compatibility.py"
483 (("open\\(version_h\\)")
484 (format #f "open(~s)" brotli-version-source)))))))))
485 (native-inputs
486 (list python-pytest
487 python-setuptools
488 python-wheel))
489 (inputs
490 (list brotli))
491 (propagated-inputs
492 (list python-cffi))
493 (home-page "https://github.com/python-hyper/brotlicffi")
494 (synopsis "Python CFFI bindings to the Brotli library")
495 (description
496 "This package provides Python CFFI bindings to the Brotli library.")
497 (license license:expat)))
498
499(define-public python-inflate64
500 (package
501 (name "python-inflate64")
502 (version "1.0.3")
503 (source (origin
504 (method url-fetch)
505 (uri (pypi-uri "inflate64" version))
506 (sha256
507 (base32
508 "1vhj7qhghyc6bvwqval471d2rnsm2pzk2byklp1s1v9ndi0xv7m8"))))
509 (build-system pyproject-build-system)
510 (native-inputs
511 (list python-pytest python-setuptools python-setuptools-scm))
512 (home-page "https://pypi.org/project/inflate64/")
513 (synopsis "Compression/decompression library")
514 (description "The @code{inflate64} package provides @code{Deflater} and
515@code{Inflater} classes to compress and decompress with the Enhanced Deflate
516compression algorithm.")
517 (license license:lgpl2.1+)))
518
519(define-public python-isal
520 (package
521 (name "python-isal")
522 (version "1.8.0")
523 (source
524 (origin
525 (method url-fetch)
526 (uri (pypi-uri "isal" version))
527 (sha256
528 (base32 "1d7j30922v547vnif171yhk1jml9cv14izda0w506qhslglk6hhj"))
529 ;; Remove bundled isa-l source code
530 (modules '((guix build utils)))
531 (snippet
532 #~(delete-file-recursively "src/isal/isa-l"))))
533 (build-system pyproject-build-system)
534 (arguments
535 (list
536 #:phases
537 #~(modify-phases %standard-phases
538 (add-after 'unpack 'use-dynamic-linking
539 (lambda _
540 (setenv "PYTHON_ISAL_LINK_DYNAMIC" "1"))))))
541 (inputs (list isa-l))
542 (native-inputs
543 (list python-cython
544 python-pytest
545 python-setuptools
546 python-setuptools-scm))
547 (home-page "https://github.com/pycompression/python-isal")
548 (synopsis "Python bindings for the ISA-L compression library")
549 (description
550 "This package aims to provide faster zlib and gzip compatible compression
551and decompression by implementing Python bindings for the ISA-L library.")
552 (license license:expat)))
553
554(define-public python-pylsqpack
555 (package
556 (name "python-pylsqpack")
557 (version "0.3.22")
558 (source (origin
559 (method url-fetch)
560 (uri (pypi-uri "pylsqpack" version))
561 (sha256
562 (base32
563 "1npcdj416gqc5zvlkyh9z808k381lrm56zvz1zsdjw437hdp2zxn"))))
564 ;; FIXME: Unbundle ls-qpack and xxhash!
565 (build-system pyproject-build-system)
566 (native-inputs (list python-pytest python-setuptools python-wheel))
567 (home-page "https://github.com/aiortc/pylsqpack")
568 (synopsis "Python bindings for @code{ls-qpack}")
569 (description
570 "@code{pylsqpack} is a wrapper around the @code{ls-qpack} library.
571It provides Python Decoder and Encoder objects to read or write HTTP/3
572headers compressed with QPACK.")
573 (license license:expat)))
574
575(define-public python-pyppmd
576 (package
577 (name "python-pyppmd")
578 (version "1.2.0")
579 (source (origin
580 (method url-fetch)
581 (uri (pypi-uri "pyppmd" version))
582 (sha256
583 (base32
584 "1z91l54ncsdglqv49fajaixld5kwnbgkjd4njvn32s6jy69ay16c"))))
585 (build-system pyproject-build-system)
586 (arguments
587 (list #:test-flags #~(list "--ignore=tests/test_benchmark.py")))
588 (native-inputs
589 (list python-pytest
590 python-pytest-benchmark
591 python-setuptools
592 python-setuptools-scm))
593 (home-page "https://github.com/miurahr/pyppmd")
594 (synopsis "PPMd compression/decompression library")
595 (description "Pyppmd provides classes and functions for compressing and
596decompressing text data, using the @dfn{Prediction by partial matching} (PPM)
597compression algorithm variation H and I.2. It provides an API similar to
598Python's zlib/bz2/lzma modules.")
599 (license license:lgpl2.1+)))
600
601;; XXX: Project is archived and not maintained since 2022.
602(define-public python-ppmd-cffi
603 (package
604 (name "python-ppmd-cffi")
605 (version "0.5.0")
606 (source
607 (origin
608 (method url-fetch)
609 (uri (pypi-uri "ppmd-cffi" version))
610 (sha256
611 (base32
612 "0vprpl29fkflqx0m6anfpx7q7i4cw0d0qxcdm91k4pl82dcad81g"))))
613 (build-system pyproject-build-system)
614 (arguments
615 (list
616 ;; AssertionError: assert False
617 #:test-flags #~(list "--deselect=tests/test_cli.py::test_cli_help")))
618 (propagated-inputs
619 (list python-cffi))
620 (native-inputs
621 (list python-pytest
622 python-pytest-cov
623 python-setuptools
624 python-setuptools-scm))
625 (home-page "https://github.com/miurahr/ppmd")
626 (synopsis "Prediction by Partial Matching compression library")
627 (description "PPMd is a compression algorithm library using the Prediction
628by Partial Matching statistical technique. It is used in RAR and 7-Zip as one of
629several possible methods.")
630 (license license:lgpl2.1+)))
631
632(define-public python-py7zr
633 (package
634 (name "python-py7zr")
635 (version "1.0.0rc3")
636 (source
637 (origin
638 (method url-fetch)
639 (uri (pypi-uri "py7zr" version))
640 (sha256
641 (base32
642 "04ff0jc0d0b4r2r5yidcfnx30qabi41k5s04v4h4y7rfb6yd40ac"))))
643 (build-system pyproject-build-system)
644 (arguments
645 (list
646 #:test-flags
647 #~(list "--ignore=tests/test_benchmark.py")
648 #:phases
649 #~(modify-phases %standard-phases
650 (add-after 'unpack 'relax-requirements
651 (lambda _
652 (substitute* "pyproject.toml"
653 (("(brotli|brotlicffi)>=.*;" _ name)
654 (string-append name ";"))))))))
655 (propagated-inputs
656 (list python-brotli
657 python-brotlicffi
658 python-inflate64
659 python-multivolumefile
660 python-psutil
661 python-pybcj
662 python-pycryptodomex
663 python-pyppmd
664 python-pyzstd
665 python-texttable))
666 (native-inputs
667 (list python-libarchive-c
668 python-py-cpuinfo
669 python-pypa-build
670 python-pytest
671 python-pytest-benchmark
672 python-pytest-httpserver
673 python-pytest-remotedata
674 python-pytest-timeout
675 python-setuptools
676 python-setuptools-scm))
677 (home-page "https://github.com/miurahr/py7zr")
678 (synopsis "7-zip in Python")
679 (description "This package provides py7zr, which implements 7-zip
680archive compression, decompression, encryption and decryption in
681Python.")
682 (license license:lgpl2.1+)))
683
684(define-public python-lzo
685 (package
686 (name "python-lzo")
687 (version "1.15")
688 (source
689 (origin
690 (method url-fetch)
691 (uri (pypi-uri "python-lzo" version))
692 (sha256
693 (base32 "0jbv6853p8flk65ks0nw37f6f5v0ryi6nhppv5fm3863ql0alym5"))))
694 (build-system pyproject-build-system)
695 (arguments
696 (list
697 #:phases
698 #~(modify-phases %standard-phases
699 (add-after 'unpack 'patch-setuppy
700 (lambda* (#:key inputs #:allow-other-keys)
701 (substitute* "setup.py"
702 (("include_dirs.append\\(.*\\)")
703 (format #f "include_dirs.append(~s)"
704 (search-input-directory inputs "include/lzo")))))))))
705 (native-inputs (list python-pytest python-setuptools python-wheel))
706 (inputs (list lzo))
707 (home-page "https://github.com/jd-boyd/python-lzo")
708 (synopsis "Python bindings for the LZO data compression library")
709 (description
710 "Python-LZO provides Python bindings for LZO, i.e. you can access
711the LZO library from your Python scripts thereby compressing ordinary
712Python strings.")
713 (license license:gpl2+)))
714
715(define-public python-lz4
716 (package
717 (name "python-lz4")
718 (version "4.4.4")
719 (source
720 (origin
721 (method url-fetch)
722 (uri (pypi-uri "lz4" version))
723 (sha256
724 (base32
725 "1nmb757fx3k30zsjiaz7nj6cgp4zxl44w28s4l8k0ff4grid03q7"))
726 (modules '((guix build utils)))
727 (snippet '(begin
728 ;; Remove bundled copy of lz4.
729 (delete-file-recursively "lz4libs")))))
730 (build-system pyproject-build-system)
731 (arguments
732 ;; Taken from tox.ini (excludes experimental tests).
733 (list #:test-flags #~(list "tests/block" "tests/frame")))
734 (native-inputs
735 (list pkg-config
736 python-pytest
737 python-pkgconfig
738 python-setuptools
739 python-setuptools-scm
740 python-psutil))
741 (inputs
742 (list lz4))
743 (home-page "https://github.com/python-lz4/python-lz4")
744 (synopsis "LZ4 bindings for Python")
745 (description
746 "This package provides python bindings for the lz4 compression library
747by Yann Collet. The project contains bindings for the LZ4 block format and
748the LZ4 frame format.")
749 (license license:bsd-3)))
750
751(define-public python-lzstring
752 (package
753 (name "python-lzstring")
754 (version "1.0.4")
755 (source
756 (origin
757 (method url-fetch)
758 (uri (pypi-uri "lzstring" version))
759 (sha256
760 (base32 "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs"))))
761 (build-system pyproject-build-system)
762 (arguments
763 ;; No tests in PyPI, this project is a fork of
764 ;; <https://github.com/eduardtomasek/lz-string-python> and doesn't provide
765 ;; tags.
766 (list #:tests? #f))
767 (native-inputs
768 (list python-setuptools))
769 (propagated-inputs
770 (list python-future))
771 (home-page "https://github.com/gkovacs/lz-string-python")
772 (synopsis "String compression")
773 (description "Lz-string is a string compressor library for Python.")
774 (license license:expat)))
775
776(define-public python-python-snappy
777 (package
778 ;; PyPI contains both `snappy' and `python-snappy' as completely distinct
779 ;; packages. To avoid a name collision in Guix, we use the variable name
780 ;; `python-python-snappy' for the package called `python-snappy' on PyPI.
781 (name "python-python-snappy")
782 (version "0.7.3")
783 (source
784 (origin
785 (method url-fetch)
786 (uri (pypi-uri "python_snappy" version))
787 (sha256
788 (base32 "1qyfhsaagpzgrw5n2zklx670zi0f3lm1djqyg2n3hbgvmldnq8a0"))))
789 (build-system pyproject-build-system)
790 (arguments
791 (list #:test-backend #~'unittest))
792 (native-inputs (list python-setuptools))
793 (inputs
794 (list snappy))
795 (propagated-inputs (list python-cramjam))
796 (home-page "https://github.com/intake/python-snappy")
797 (synopsis "Python bindings for the Snappy compression library")
798 (description
799 "@code{python-python-snappy} provides bindings to the Snappy library and
800can be used to compress and decompress files and streams. It can also be used
801directly from the command line.")
802 (license license:bsd-3)))
803
804(define-public python-bitshuffle
805 (package
806 (name "python-bitshuffle")
807 (version "0.5.2")
808 (source (origin
809 (method url-fetch)
810 (uri (pypi-uri "bitshuffle" version))
811 (sha256
812 (base32
813 "139xz3m2m8sal8riicvmb9i0sq4085s2hc6c148bwhmzpnvky3nw"))
814 (modules '((guix build utils)))
815 (snippet
816 '(begin
817 ;; TODO Remove bundled libraries: lz4, lzf, and zstd.
818 ;; Remove generated Cython files.
819 (delete-file "bitshuffle/h5.c")
820 (delete-file "bitshuffle/ext.c")))))
821 (build-system pyproject-build-system)
822 (arguments
823 (list
824 #:test-flags
825 ;; FileNotFoundError: [Errno 2] Unable to synchronously open file
826 ;; (unable to open file: name =
827 ;; '/tmp/<...>/tests/data/regression_0.1.3.h5', errno = 2, error message
828 ;; = 'No such file or directory', flags = 0, o_flags = 0)
829 #~(list "--deselect=tests/test_regression.py::TestAll::test_regression")
830 #:phases
831 #~(modify-phases %standard-phases
832 (add-before 'build 'pre-build
833 ;; TODO: Check how to build on other architectures.
834 ;; Taken form .github/workflows/wheels.yml.
835 (lambda _
836 #$@(if (target-x86-64?)
837 '((setenv "BITSHUFFLE_ARCH" "haswell")
838 (setenv "CIBW_SKIP" "pp* *musllinux* cp311-macosx*")
839 (setenv "CIBW_ARCHS" "x86_64"))
840 '())
841 (setenv "HDF5_DIR" #$(this-package-input "hdf5")))))))
842 (native-inputs
843 (list python-cython
844 python-pytest
845 python-setuptools))
846 (inputs
847 (list python-numpy
848 python-h5py
849 hdf5))
850 (home-page "https://github.com/kiyo-masui/bitshuffle")
851 (synopsis "Filter for improving compression of typed binary data")
852 (description "Bitshuffle is an algorithm that rearranges typed, binary data
853for improving compression, as well as a python/C package that implements this
854algorithm within the Numpy framework.")
855 (license license:expat)))
856
857(define-public bitshuffle-for-snappy
858 (package/inherit python-bitshuffle
859 (name "bitshuffle-for-snappy")
860 (build-system gnu-build-system)
861 (arguments
862 (list
863 #:tests? #f
864 #:phases
865 #~(modify-phases %standard-phases
866 (replace 'configure
867 (lambda _
868 (with-output-to-file "Makefile"
869 (lambda _
870 (format #t "\
871libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
872\tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
873
874%.o: %.c
875\tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
876
877PREFIX:=~a
878LIBDIR:=$(PREFIX)/lib
879INCLUDEDIR:=$(PREFIX)/include
880
881install: libbitshuffle.so
882\tinstall -dm755 $(LIBDIR)
883\tinstall -dm755 $(INCLUDEDIR)
884\tinstall -m755 libbitshuffle.so $(LIBDIR)
885\tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
886\tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
887\tinstall -m644 src/iochain.h $(INCLUDEDIR)
888\tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
889" #$output))))))))
890 (inputs '())
891 (native-inputs '())))
892
893(define-public python-uncompresspy
894 (package
895 (name "python-uncompresspy")
896 (version "0.4.0")
897 (source
898 (origin
899 (method url-fetch)
900 (uri (pypi-uri "uncompresspy" version))
901 (sha256
902 (base32 "1110dipshnijhq6dk5dxzxx3zpynm6dx5kcc430fw24b8xwlc9in"))))
903 (build-system pyproject-build-system)
904 (arguments
905 (list #:tests? #f)) ;no tests
906 (native-inputs
907 (list python-setuptools))
908 (home-page "https://github.com/kYwzor/uncompresspy")
909 (synopsis "Uncompressing LZW files in Python")
910 (description
911 "This package implement a pure Python module for uncompressing LZW
912files (.Z), such as the ones created by Unix's shell tool compress.")
913 (license license:bsd-3)))
914
915(define-public python-unix-ar
916 (package
917 (name "python-unix-ar")
918 (version "0.2.1")
919 (source
920 (origin
921 (method url-fetch)
922 (uri (pypi-uri "unix_ar" version))
923 (sha256
924 (base32 "0kicwxsh28x8r34a7cgzv2i65gsd4qjw2vf29pwq4fpsf3n2i4xz"))))
925 (build-system pyproject-build-system)
926 (arguments
927 ;; These tests have timestamp-related issues.
928 (list #:test-flags
929 #~(list "-m" "unittest" "-k" "not test_add and not test_addfile")
930 #:phases
931 #~(modify-phases %standard-phases
932 (replace 'check
933 (lambda* (#:key tests? test-flags #:allow-other-keys)
934 (apply invoke "python" test-flags))))))
935 (native-inputs (list python-pytest python-setuptools python-wheel))
936 (home-page "https://github.com/getninjas/unix_ar")
937 (synopsis "AR file handling in Python")
938 (description "This package provides utilities to handle AR files in
939Python.")
940 (license license:bsd-3)))
941
942(define-public python-zipfile2
943 (package
944 (name "python-zipfile2")
945 (version "0.0.12")
946 (source
947 (origin
948 (method git-fetch)
949 (uri (git-reference
950 (url "https://github.com/itziakos/zipfile2/")
951 (commit (string-append "v" version))))
952 (file-name (git-file-name name version))
953 (sha256
954 (base32 "1hmq33r3ffrrvm5nggsp69cjdbgjbwn6zbcrs2rhmb8pds0h81q7"))))
955 (build-system pyproject-build-system)
956 (native-inputs
957 (list python-pytest
958 python-setuptools))
959 (home-page "https://github.com/itziakos/zipfile2/")
960 (synopsis "Improved @code{ZipFile} Python class")
961 (description
962 "Zipfile2 is a backward compatible replacement to @code{ZipFile}. It
963provides handling of symlinks, and exception management.")
964 (license license:psfl)))
965
966(define-public python-zipp
967 (package
968 (name "python-zipp")
969 (version "3.23.0")
970 (source
971 (origin
972 (method url-fetch)
973 (uri (pypi-uri "zipp" version))
974 (sha256
975 (base32 "0rj182i2d7d2bz067zrk39s19j09xsxkzprl82fqql8ji9c5fwd0"))))
976 (build-system pyproject-build-system)
977 (arguments (list #:tests? #f)) ;TODO: Tests require extra packaging
978 (native-inputs
979 (list ;; python-big-o
980 ;; python-coherent-licensed
981 ;; python-jaraco-functools ; introduces cycle
982 ;; python-jaraco-itertools
983 ;; python-jaraco-test ; introduces cycle
984 python-more-itertools
985 python-pytest
986 ;; python-pytest-ignore-flaky
987 python-setuptools
988 python-setuptools-scm
989 python-wheel))
990 (home-page "https://github.com/jaraco/zipp")
991 (synopsis
992 "Backport of pathlib-compatible object wrapper for zip files")
993 (description
994 "This package provides a @code{pathlib}-compatible @code{Zipfile} object
995wrapper. It provides a backport of the @code{Path} object.")
996 (license license:expat)))
997
998(define-public python-deflate
999 (package
1000 (name "python-deflate")
1001 (version "0.8.0")
1002 (source
1003 (origin
1004 (method url-fetch)
1005 (uri (pypi-uri "deflate" version))
1006 (sha256
1007 (base32 "0cgk118r3sglrjqirr22y7mr7fnhijhwd3v6isykjbf2m2dqyy41"))))
1008 (build-system pyproject-build-system)
1009 (arguments
1010 (list
1011 #:phases #~(modify-phases %standard-phases
1012 (add-after 'unpack 'libdeflate-prefix
1013 (lambda _
1014 (setenv "LIBDEFLATE_PREFIX"
1015 #$(this-package-input "libdeflate")))))))
1016 (native-inputs (list cmake-minimal python-pytest python-scikit-build-core))
1017 (inputs (list libdeflate))
1018 (home-page "https://github.com/dcwatson/deflate")
1019 (synopsis "Python wrapper for @code{libdeflate}")
1020 (description "This package contains a very thin Python wrapper for
1021@code{libdeflate}.")
1022 (license license:expat)))
1023
1024(define-public python-xopen
1025 (package
1026 (name "python-xopen")
1027 ;; TODO: Newer versions require zlib-ng:
1028 ;; <https://github.com/zlib-ng/zlib-ng>,
1029 ;; <https://github.com/pycompression/python-zlib-ng>.
1030 (version "1.8.0")
1031 (source
1032 (origin
1033 (method url-fetch)
1034 (uri (pypi-uri "xopen" version))
1035 (sha256
1036 (base32 "0h08wpd5zwnlzwnbbbhahbcs69kzsfbaaigqw0viq6ri8n4zrh00"))))
1037 (build-system pyproject-build-system)
1038 ;; tests: 343 passed, 5 skipped
1039 (native-inputs
1040 (list python-pytest
1041 python-pytest-timeout
1042 python-setuptools
1043 python-setuptools-scm))
1044 (propagated-inputs
1045 (list pigz python-isal))
1046 (home-page "https://github.com/marcelm/xopen/")
1047 (synopsis "Open compressed files transparently")
1048 (description "This module provides an @code{xopen} function that works
1049like Python's built-in @code{open} function, but can also deal with compressed
1050files. Supported compression formats are gzip, bzip2 and, xz, and are
1051automatically recognized by their file extensions. The focus is on being as
1052efficient as possible on all supported Python versions.")
1053 (license license:expat)))
1054
1055(define-public python-zipstream-ng
1056 (package
1057 (name "python-zipstream-ng")
1058 (version "1.9.0")
1059 (source
1060 (origin
1061 (method url-fetch)
1062 (uri (pypi-uri "zipstream_ng" version))
1063 (sha256
1064 (base32 "1snsczv5v2fvndxi8hbgd42ghhiwc20cdz8dz3xpw4rdh8q41nd0"))))
1065 (build-system pyproject-build-system)
1066 (native-inputs
1067 (list python-pytest python-pytest-cov python-setuptools python-wheel))
1068 (home-page "https://github.com/pR0Ps/zipstream-ng")
1069 (synopsis "Streamable zip file generator")
1070 (description
1071 "This package provides a modern and easy to use streamable zip file
1072generator")
1073 (license license:lgpl3)))
1074
1075(define-public python-zopfli
1076 (package
1077 (name "python-zopfli")
1078 (version "0.4.0")
1079 (source
1080 (origin
1081 (method git-fetch)
1082 (uri (git-reference
1083 (url "https://github.com/fonttools/py-zopfli")
1084 (commit (string-append "v" version))))
1085 (file-name (git-file-name name version))
1086 (sha256
1087 (base32 "1figk175w1q8ww8ryh2ypg7jjlkjbnry3gwhn8d56xh5icwgwi5g"))))
1088 (build-system pyproject-build-system)
1089 (arguments
1090 (list
1091 #:phases
1092 #~(modify-phases %standard-phases
1093 (add-after 'unpack 'use-system-zopfli
1094 (lambda _
1095 (setenv "USE_SYSTEM_ZOPFLI" "1"))))))
1096 (native-inputs
1097 (list python-pytest
1098 python-setuptools
1099 python-setuptools-scm))
1100 (inputs
1101 (list zopfli))
1102 (home-page "https://github.com/fonttools/py-zopfli")
1103 (synopsis "Python bindings for Zopfli")
1104 (description "@code{pyzopfli} is a straight forward wrapper around the
1105@code{ZlibCompress} method of the the @code{zopfli} library.")
1106 (license license:asl2.0)))
1107
1108(define-public python-zstandard
1109 (package
1110 (name "python-zstandard")
1111 (version "0.23.0")
1112 (source
1113 (origin
1114 (method url-fetch)
1115 (uri (pypi-uri "zstandard" version))
1116 (sha256
1117 (base32 "02dwqq5dw73zypvwpadscra8x6rwbglblh57yxl5y9g710nwdn5j"))))
1118 (build-system pyproject-build-system)
1119 ;; TODO: Unbunle zstd.
1120 (arguments
1121 (list
1122 #:phases
1123 #~(modify-phases %standard-phases
1124 (add-after 'unpack 'patch-build-system
1125 (lambda _
1126 (substitute* "pyproject.toml"
1127 ((":__legacy__") ""))))
1128 (add-before 'check 'build-extensions
1129 (lambda _
1130 (invoke "python" "setup.py" "build_ext" "--inplace"))))))
1131 (native-inputs
1132 (list python-pytest python-setuptools))
1133 (propagated-inputs
1134 (list python-cffi))
1135 (home-page "https://github.com/indygreg/python-zstandard")
1136 (synopsis "Zstandard bindings for Python")
1137 (description "This project provides Python bindings for interfacing with
1138the Zstandard compression library. A C extension and CFFI interface are
1139provided.")
1140 (license license:bsd-3)))
1141
1142(define-public python-pyzstd
1143 (package
1144 (name "python-pyzstd")
1145 (version "0.18.0")
1146 (source
1147 (origin
1148 (method git-fetch)
1149 (uri (git-reference
1150 (url "https://github.com/Rogdham/pyzstd")
1151 (commit version)))
1152 (file-name (git-file-name name version))
1153 (sha256
1154 (base32 "08ih7vr3rzwrzpzwhk1k94z5nm9mmvls7c6w8wsqncf0kyl8d7yp"))
1155 (modules '((guix build utils)))
1156 (snippet '(begin
1157 ;; Remove a bundled copy of the zstd sources.
1158 (delete-file-recursively "zstd")
1159 (mkdir "zstd")
1160 (call-with-output-file "zstd/LICENSE"
1161 (const #t))))))
1162 (build-system pyproject-build-system)
1163 (arguments
1164 (list
1165 #:configure-flags
1166 #~'(("--build-option" . "--dynamic-link-zstd"))))
1167 (inputs (list `(,zstd "lib")))
1168 (native-inputs (list python-pytest python-setuptools))
1169 (propagated-inputs (list python-typing-extensions))
1170 (home-page "https://github.com/Rogdham/pyzstd")
1171 (synopsis "Zstandard bindings for Python")
1172 (description
1173 "This package provides Python bindings to the Zstandard (zstd)
1174compression library. The API is similar to Python's bz2/lzma/zlib module.")
1175 (license license:bsd-3)))