projects/guix·blob graal · refs

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