projects/guix·blob version-1.5.0 · refs

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