projects/guix·blob bootstrap-team · refs

1155 lines · 40.5 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016, 2017, 2018, 2023 Tobias Geerinckx-Rice <[email protected]>
3;;; Copyright © 2017, 2018, 2019, 2021, 2022, 2023 Ricardo Wurmus <[email protected]>
4;;; Copyright © 2017 Nikita <[email protected]>
5;;; Copyright © 2017 Julien Lepiller <[email protected]>
6;;; Copyright © 2018-2020, 2022, 2023 Efraim Flashner <[email protected]>
7;;; Copyright © 2020 Nicolas Goaziou <[email protected]>
8;;; Copyright © 2020, 2022, 2023 Marius Bakke <[email protected]>
9;;; Copyright © 2021, 2025 Brendan Tildesley <[email protected]>
10;;; Copyright © 2023, 2024 Troy Figiel <[email protected]>
11;;; Copyright © 2024 TakeV <[email protected]>
12;;; Copyright © 2023 Ivan Vilata i Balaguer <[email protected]>
13;;; Copyright © 2024 Maxim Cournoyer <[email protected]>
14;;; Copyright © 2025 Nicolas Graves <[email protected]>
15;;; Copyright © 2025 Vinicius Monego <[email protected]>
16;;;
17;;; This file is part of GNU Guix.
18;;;
19;;; GNU Guix is free software; you can redistribute it and/or modify it
20;;; under the terms of the GNU General Public License as published by
21;;; the Free Software Foundation; either version 3 of the License, or (at
22;;; your option) any later version.
23;;;
24;;; GNU Guix is distributed in the hope that it will be useful, but
25;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;;; GNU General Public License for more details.
28;;;
29;;; You should have received a copy of the GNU General Public License
30;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32(define-module (gnu packages python-compression)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix utils)
35 #:use-module (guix packages)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module (guix gexp)
39 #:use-module (guix build-system cargo)
40 #:use-module (guix build-system gnu)
41 #:use-module (guix build-system 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.3")
119 (source
120 (origin
121 (method url-fetch)
122 (uri (pypi-uri "blosc" version))
123 (sha256
124 (base32
125 "13h8ks58iy4h3ayk7havb4hmkma88598qkf4i4paj53qpa76bvc9"))
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 ;; See: <https://github.com/Blosc/python-blosc/issues/347>.
144 python-numpy-1
145 python-psutil
146 python-py-cpuinfo
147 python-scikit-build
148 python-setuptools))
149 (inputs
150 (list c-blosc))
151 (home-page "https://github.com/blosc/python-blosc")
152 (synopsis "Python wrapper for the Blosc data compressor library")
153 (description "Blosc is a high performance compressor optimized for binary
154data. It has been designed to transmit data to the processor cache faster
155than the traditional, non-compressed, direct memory fetch approach via a
156@code{memcpy()} system call.
157
158Blosc works well for compressing numerical arrays that contains data with
159relatively low entropy, like sparse data, time series, grids with
160regular-spaced values, etc.
161
162This Python package wraps the Blosc library.")
163 (license license:bsd-3)))
164
165(define-public python-blosc2
166 (package
167 (name "python-blosc2")
168 (version "3.12.2")
169 (source
170 (origin
171 (method url-fetch)
172 (uri (pypi-uri "blosc2" version))
173 (sha256
174 (base32 "17z3byk0q79rf7j8nh4k0qls1mwdrlylgi85qayqirvk9df92bx4"))))
175 (build-system pyproject-build-system)
176 (arguments
177 (list
178 ;; tests: 8192 passed, 7466 deselected
179 #:test-flags
180 ;; Network access is requited: OSError: Could not find a suitable TLS CA
181 ;; certificate bundle, invalid path: /etc/ssl/certs/ca-certificates.crt
182 #~(list "--deselect=tests/test_embed_store.py::test_with_remote"
183 "tests")
184 #:phases
185 #~(modify-phases %standard-phases
186 (add-before 'build 'configure
187 (lambda _
188 (setenv "USE_SYSTEM_BLOSC2" "ON"))))))
189 (native-inputs
190 (list cmake-minimal
191 pkg-config
192 python-cython
193 python-psutil
194 python-pytest
195 python-pytorch ;XXX: hard dependency to run tests
196 python-scikit-build-core
197 python-setuptools))
198 (inputs
199 (list c-blosc2))
200 (propagated-inputs
201 (list python-msgpack
202 python-ndindex
203 python-numexpr
204 python-numpy
205 python-platformdirs
206 python-py-cpuinfo
207 python-requests))
208 (home-page "https://github.com/blosc/python-blosc2")
209 (synopsis "Python wrapper for the Blosc2 data compressor library")
210 (description
211 "Blosc2 is a high performance compressor optimized for binary
212data. It has been designed to transmit data to the processor cache faster
213than the traditional, non-compressed, direct memory fetch approach via a
214@code{memcpy()} system call.
215
216Python-Blosc2 wraps the C-Blosc2 library, and it aims to leverage its new API
217so as to support super-chunks, multi-dimensional arrays, serialization and
218other features introduced in C-Blosc2.
219
220Python-Blosc2 also reproduces the API of Python-Blosc and is meant to be able
221to access its data, so it can be used as a drop-in replacement.")
222 (license license:bsd-3)))
223
224(define-public python-brotli
225 (package
226 (name "python-brotli")
227 (version "1.0.9")
228 (source
229 (origin
230 (method git-fetch)
231 (uri (git-reference
232 (url "https://github.com/google/brotli")
233 (commit (string-append "v" version))))
234 (file-name (git-file-name name version))
235 (sha256
236 (base32 "1fikasxf7r2dwlk8mv8w7nmjkn0jw5ic31ky3mvpkdzwgd4xfndl"))
237 (modules '((guix build utils)))
238 (snippet
239 #~(begin
240 ;; Cherry-picked from upstream since the latest release
241 ;; https://github.com/google/brotli/commit/09b0992b6acb7faa6fd3b23f9bc036ea117230fc
242 (substitute* (find-files "scripts" "^lib.*pc\\.in")
243 (("-R\\$\\{libdir\\} ") ""))))))
244 (build-system pyproject-build-system)
245 (native-inputs
246 (list python-pytest
247 python-setuptools))
248 (home-page "https://github.com/google/brotli")
249 (synopsis "Python interface to Brotli")
250 (description "This package provides a Python interface to the @code{brotli}
251package, an implementation of the Brotli lossless compression algorithm.")
252 (license license:expat)))
253
254(define-public python-multivolumefile
255 (package
256 (name "python-multivolumefile")
257 (version "0.2.3")
258 (source
259 (origin
260 (method url-fetch)
261 (uri (pypi-uri "multivolumefile" version))
262 (sha256
263 (base32
264 "1mh9sz50s1p8ik83a455pqd57syprad7xhfmk28yb5mwmw58sr50"))))
265 (build-system pyproject-build-system)
266 (native-inputs
267 (list python-pytest
268 python-setuptools
269 python-setuptools-scm))
270 (home-page "https://github.com/miurahr/multivolume")
271 (synopsis "Treat multiple files as one")
272 (description "MultiVolumefile is a Python library that provides a
273file-object abstraction, making it possible to use multiple files as if they
274were a single file.")
275 (license license:lgpl2.1+)))
276
277(define-public python-cramjam
278 (package
279 (name "python-cramjam")
280 (version "2.11.0.post1")
281 (source
282 (origin
283 (method git-fetch)
284 (uri (git-reference
285 (url "https://github.com/milesgranger/cramjam")
286 (commit (string-append "v" version))))
287 (file-name (git-file-name name version))
288 (sha256
289 (base32 "1028aydcjy7917vsgg67v6cnskzw0wk4x1vz017mar99yiq7z349"))))
290 (build-system pyproject-build-system)
291 (arguments
292 (list
293 ;; tests: 743 passed, 1 skipped, 1 deselected
294 #:test-flags
295 #~(list "--ignore=benchmarks/test_bench.py"
296 ;; FIXME: Did not raise cramjam.DecompressionError
297 "--deselect=tests/test_variants.py::test_variants_raise_exception[deflate]")
298 #:imported-modules `(,@%cargo-build-system-modules
299 ,@%pyproject-build-system-modules)
300 #:modules '(((guix build cargo-build-system) #:prefix cargo:)
301 (guix build pyproject-build-system)
302 (guix build utils))
303 #:phases
304 #~(modify-phases %standard-phases
305 (add-after 'unpack 'prepare-cargo-build-system
306 (lambda args
307 (for-each (lambda (phase)
308 (format #t "Running cargo phase: ~a~%" phase)
309 (apply (assoc-ref cargo:%standard-phases phase)
310 #:cargo-target #$(cargo-triplet)
311 args))
312 '(unpack-rust-crates
313 configure
314 check-for-pregenerated-files
315 patch-cargo-checksums))))
316 (add-before 'check 'configure-tests
317 (lambda _
318 ;; XXX: Otherwise some flaky tests seem to fail with
319 ;; SyntaxError: could not convert string to float
320 (setenv "CI" "1"))))))
321 (native-inputs
322 (append
323 (list maturin
324 pkg-config
325 python-pytest
326 python-pytest-xdist
327 python-numpy
328 python-hypothesis
329 rust
330 `(,rust "cargo"))
331 (or (and=> (%current-target-system)
332 (compose list make-rust-sysroot))
333 '())))
334 (inputs
335 (cons* libdeflate
336 lz4
337 `(,zstd "lib")
338 (cargo-inputs 'python-cramjam)))
339 (home-page "https://github.com/milesgranger/cramjam")
340 (synopsis "Python bindings to compression algorithms in Rust")
341 (description
342 "This package provides thin Python bindings to compression and
343decomporession algorithms implemented in Rust. This allows for using
344algorithms such as Snappy without additional system dependencies. The
345following algorithms are available:
346
347@itemize
348@item Snappy
349@item Brotli
350@item Bzip2
351@item LZ4
352@item Gzip
353@item Deflate
354@item Zstd
355@end itemize")
356 (license license:expat)))
357
358(define-public python-ewah-bool-utils
359 (package
360 (name "python-ewah-bool-utils")
361 (version "1.2.2")
362 (source
363 (origin
364 (method url-fetch)
365 (uri (pypi-uri "ewah_bool_utils" version))
366 (sha256
367 (base32 "1hvs1fvf3g7kq6hnzxyxfrwvmykw503cmxf1l3irs67gr931z47b"))))
368 (build-system pyproject-build-system)
369 (arguments
370 (list
371 #:phases
372 #~(modify-phases %standard-phases
373 (add-before 'check 'build-extensions
374 (lambda _
375 (invoke "python" "setup.py" "build_ext" "--inplace"))))))
376 (native-inputs
377 (list python-cython
378 python-pytest
379 python-setuptools
380 python-wheel))
381 (propagated-inputs
382 (list python-numpy))
383 (home-page "https://github.com/yt-project/ewah_bool_utils")
384 (synopsis "EWAH Bool Array compression")
385 (description "This package provide a Python wrapper to @acronym{EWAH,
386 Enhanced Word-Aligned Hybrid} compression bitarray method.")
387 (license (list
388 ;; LICENSE: for Python code.
389 license:bsd-3
390 ;; XXX: Check if it's possible to have it as a dedicated package
391 ;; and link here..
392 ;; ewah_bool_utils/cpp/LICENSE: for C++ bundle, sourced from
393 ;; <https://github.com/lemire/EWAHBoolArray>.
394 license:asl2.0))))
395
396(define-public python-pybcj
397 (package
398 (name "python-pybcj")
399 (version "1.0.1")
400 (source (origin
401 (method url-fetch)
402 (uri (pypi-uri "pybcj" version))
403 (sha256
404 (base32
405 "1hvm3c3mb20z25kmbzyyn6pr5inx50z0ignl8b0bggxaik82ws4b"))))
406 (build-system pyproject-build-system)
407 (propagated-inputs (list python-importlib-metadata))
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.0.9.2")
453 (source
454 (origin
455 (method url-fetch)
456 (uri (pypi-uri "brotlicffi" version))
457 (sha256
458 (base32 "15kxgdiqcg0cm6h5xq3vkbhw7674673hcx3n2yicd3wx29l8l90c"))
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
793 (list python-cramjam
794 python-setuptools))
795 (inputs
796 (list snappy))
797 (home-page "https://github.com/andrix/python-snappy")
798 (synopsis "Python bindings for the Snappy compression library")
799 (description
800 "@code{python-python-snappy} provides bindings to the Snappy library and
801can be used to compress and decompress files and streams. It can also be used
802directly from the command line.")
803 (license license:bsd-3)))
804
805(define-public python-bitshuffle
806 (package
807 (name "python-bitshuffle")
808 (version "0.5.2")
809 (source (origin
810 (method url-fetch)
811 (uri (pypi-uri "bitshuffle" version))
812 (sha256
813 (base32
814 "139xz3m2m8sal8riicvmb9i0sq4085s2hc6c148bwhmzpnvky3nw"))
815 (modules '((guix build utils)))
816 (snippet
817 '(begin
818 ;; TODO Remove bundled libraries: lz4, lzf, and zstd.
819 ;; Remove generated Cython files.
820 (delete-file "bitshuffle/h5.c")
821 (delete-file "bitshuffle/ext.c")))))
822 (build-system pyproject-build-system)
823 (arguments
824 (list
825 #:test-flags
826 ;; FileNotFoundError: [Errno 2] Unable to synchronously open file
827 ;; (unable to open file: name =
828 ;; '/tmp/<...>/tests/data/regression_0.1.3.h5', errno = 2, error message
829 ;; = 'No such file or directory', flags = 0, o_flags = 0)
830 #~(list "--deselect=tests/test_regression.py::TestAll::test_regression")
831 #:phases
832 #~(modify-phases %standard-phases
833 (add-before 'build 'pre-build
834 ;; TODO: Check how to build on other architectures.
835 ;; Taken form .github/workflows/wheels.yml.
836 (lambda _
837 #$@(if (target-x86-64?)
838 '((setenv "BITSHUFFLE_ARCH" "haswell")
839 (setenv "CIBW_SKIP" "pp* *musllinux* cp311-macosx*")
840 (setenv "CIBW_ARCHS" "x86_64"))
841 '())
842 (setenv "HDF5_DIR" #$(this-package-input "hdf5")))))))
843 (native-inputs
844 (list python-cython
845 python-pytest
846 python-setuptools))
847 (inputs
848 (list python-numpy
849 python-h5py
850 hdf5))
851 (home-page "https://github.com/kiyo-masui/bitshuffle")
852 (synopsis "Filter for improving compression of typed binary data")
853 (description "Bitshuffle is an algorithm that rearranges typed, binary data
854for improving compression, as well as a python/C package that implements this
855algorithm within the Numpy framework.")
856 (license license:expat)))
857
858(define-public bitshuffle-for-snappy
859 (package/inherit python-bitshuffle
860 (name "bitshuffle-for-snappy")
861 (build-system gnu-build-system)
862 (arguments
863 (list
864 #:tests? #f
865 #:phases
866 #~(modify-phases %standard-phases
867 (replace 'configure
868 (lambda _
869 (with-output-to-file "Makefile"
870 (lambda _
871 (format #t "\
872libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
873\tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
874
875%.o: %.c
876\tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
877
878PREFIX:=~a
879LIBDIR:=$(PREFIX)/lib
880INCLUDEDIR:=$(PREFIX)/include
881
882install: libbitshuffle.so
883\tinstall -dm755 $(LIBDIR)
884\tinstall -dm755 $(INCLUDEDIR)
885\tinstall -m755 libbitshuffle.so $(LIBDIR)
886\tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
887\tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
888\tinstall -m644 src/iochain.h $(INCLUDEDIR)
889\tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
890" #$output))))))))
891 (inputs '())
892 (native-inputs '())))
893
894(define-public python-uncompresspy
895 (package
896 (name "python-uncompresspy")
897 (version "0.4.0")
898 (source
899 (origin
900 (method url-fetch)
901 (uri (pypi-uri "uncompresspy" version))
902 (sha256
903 (base32 "1110dipshnijhq6dk5dxzxx3zpynm6dx5kcc430fw24b8xwlc9in"))))
904 (build-system pyproject-build-system)
905 (arguments
906 (list #:tests? #f)) ;no tests
907 (native-inputs
908 (list python-setuptools))
909 (home-page "https://github.com/kYwzor/uncompresspy")
910 (synopsis "Uncompressing LZW files in Python")
911 (description
912 "This package implement a pure Python module for uncompressing LZW
913files (.Z), such as the ones created by Unix's shell tool compress.")
914 (license license:bsd-3)))
915
916(define-public python-unix-ar
917 (package
918 (name "python-unix-ar")
919 (version "0.2.1")
920 (source
921 (origin
922 (method url-fetch)
923 (uri (pypi-uri "unix_ar" version))
924 (sha256
925 (base32 "0kicwxsh28x8r34a7cgzv2i65gsd4qjw2vf29pwq4fpsf3n2i4xz"))))
926 (build-system pyproject-build-system)
927 (arguments
928 ;; These tests have timestamp-related issues.
929 (list #:test-flags
930 #~(list "-m" "unittest" "-k" "not test_add and not test_addfile")
931 #:phases
932 #~(modify-phases %standard-phases
933 (replace 'check
934 (lambda* (#:key tests? test-flags #:allow-other-keys)
935 (apply invoke "python" test-flags))))))
936 (native-inputs (list python-pytest python-setuptools python-wheel))
937 (home-page "https://github.com/getninjas/unix_ar")
938 (synopsis "AR file handling in Python")
939 (description "This package provides utilities to handle AR files in
940Python.")
941 (license license:bsd-3)))
942
943(define-public python-zipp
944 (package
945 (name "python-zipp")
946 (version "3.23.0")
947 (source
948 (origin
949 (method url-fetch)
950 (uri (pypi-uri "zipp" version))
951 (sha256
952 (base32 "0rj182i2d7d2bz067zrk39s19j09xsxkzprl82fqql8ji9c5fwd0"))))
953 (build-system pyproject-build-system)
954 (arguments (list #:tests? #f)) ;TODO: Tests requrie extra packaging
955 (native-inputs
956 (list ;; python-big-o
957 ;; python-coherent-licensed
958 ;; python-jaraco-functools ; introduces cycle
959 ;; python-jaraco-itertools
960 ;; python-jaraco-test ; introduces cycle
961 python-more-itertools
962 python-pytest
963 ;; python-pytest-ignore-flaky
964 python-setuptools
965 python-setuptools-scm
966 python-wheel))
967 (home-page "https://github.com/jaraco/zipp")
968 (synopsis
969 "Backport of pathlib-compatible object wrapper for zip files")
970 (description
971 "This package provides a @code{pathlib}-compatible @code{Zipfile} object
972wrapper. It provides a backport of the @code{Path} object.")
973 (license license:expat)))
974
975(define-public python-deflate
976 (package
977 (name "python-deflate")
978 (version "0.8.0")
979 (source
980 (origin
981 (method url-fetch)
982 (uri (pypi-uri "deflate" version))
983 (sha256
984 (base32 "0cgk118r3sglrjqirr22y7mr7fnhijhwd3v6isykjbf2m2dqyy41"))))
985 (build-system pyproject-build-system)
986 (arguments
987 (list
988 #:phases #~(modify-phases %standard-phases
989 (add-after 'unpack 'libdeflate-prefix
990 (lambda _
991 (setenv "LIBDEFLATE_PREFIX"
992 #$(this-package-input "libdeflate")))))))
993 (native-inputs (list cmake-minimal python-pytest python-scikit-build-core))
994 (inputs (list libdeflate))
995 (home-page "https://github.com/dcwatson/deflate")
996 (synopsis "Python wrapper for @code{libdeflate}")
997 (description "This package contains a very thin Python wrapper for
998@code{libdeflate}.")
999 (license license:expat)))
1000
1001(define-public python-xopen
1002 (package
1003 (name "python-xopen")
1004 ;; TODO: Newer versions require zlib-ng:
1005 ;; <https://github.com/zlib-ng/zlib-ng>,
1006 ;; <https://github.com/pycompression/python-zlib-ng>.
1007 (version "1.8.0")
1008 (source
1009 (origin
1010 (method url-fetch)
1011 (uri (pypi-uri "xopen" version))
1012 (sha256
1013 (base32 "0h08wpd5zwnlzwnbbbhahbcs69kzsfbaaigqw0viq6ri8n4zrh00"))))
1014 (build-system pyproject-build-system)
1015 ;; tests: 343 passed, 5 skipped
1016 (native-inputs
1017 (list python-pytest
1018 python-pytest-timeout
1019 python-setuptools
1020 python-setuptools-scm))
1021 (propagated-inputs
1022 (list pigz python-isal))
1023 (home-page "https://github.com/marcelm/xopen/")
1024 (synopsis "Open compressed files transparently")
1025 (description "This module provides an @code{xopen} function that works
1026like Python's built-in @code{open} function, but can also deal with compressed
1027files. Supported compression formats are gzip, bzip2 and, xz, and are
1028automatically recognized by their file extensions. The focus is on being as
1029efficient as possible on all supported Python versions.")
1030 (license license:expat)))
1031
1032(define-public python-zipstream-ng
1033 (package
1034 (name "python-zipstream-ng")
1035 (version "1.9.0")
1036 (source
1037 (origin
1038 (method url-fetch)
1039 (uri (pypi-uri "zipstream_ng" version))
1040 (sha256
1041 (base32 "1snsczv5v2fvndxi8hbgd42ghhiwc20cdz8dz3xpw4rdh8q41nd0"))))
1042 (build-system pyproject-build-system)
1043 (native-inputs
1044 (list python-pytest python-pytest-cov python-setuptools python-wheel))
1045 (home-page "https://github.com/pR0Ps/zipstream-ng")
1046 (synopsis "Streamable zip file generator")
1047 (description
1048 "This package provides a modern and easy to use streamable zip file
1049generator")
1050 (license license:lgpl3)))
1051
1052(define-public python-zopfli
1053 (package
1054 (name "python-zopfli")
1055 (version "0.4.0")
1056 (source
1057 (origin
1058 (method git-fetch)
1059 (uri (git-reference
1060 (url "https://github.com/fonttools/py-zopfli")
1061 (commit (string-append "v" version))))
1062 (file-name (git-file-name name version))
1063 (sha256
1064 (base32 "1figk175w1q8ww8ryh2ypg7jjlkjbnry3gwhn8d56xh5icwgwi5g"))))
1065 (build-system pyproject-build-system)
1066 (arguments
1067 (list
1068 #:phases
1069 #~(modify-phases %standard-phases
1070 (add-after 'unpack 'use-system-zopfli
1071 (lambda _
1072 (setenv "USE_SYSTEM_ZOPFLI" "1")))
1073 (add-before 'build 'set-version
1074 (lambda _
1075 (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version))))))
1076 (native-inputs
1077 (list python-pytest
1078 python-setuptools
1079 python-setuptools-scm))
1080 (inputs
1081 (list zopfli))
1082 (home-page "https://github.com/fonttools/py-zopfli")
1083 (synopsis "Python bindings for Zopfli")
1084 (description "@code{pyzopfli} is a straight forward wrapper around the
1085@code{ZlibCompress} method of the the @code{zopfli} library.")
1086 (license license:asl2.0)))
1087
1088(define-public python-zstandard
1089 (package
1090 (name "python-zstandard")
1091 (version "0.23.0")
1092 (source
1093 (origin
1094 (method url-fetch)
1095 (uri (pypi-uri "zstandard" version))
1096 (sha256
1097 (base32 "02dwqq5dw73zypvwpadscra8x6rwbglblh57yxl5y9g710nwdn5j"))))
1098 (build-system pyproject-build-system)
1099 ;; TODO: Unbunle zstd.
1100 (arguments
1101 (list
1102 #:phases
1103 #~(modify-phases %standard-phases
1104 (add-after 'unpack 'patch-build-system
1105 (lambda _
1106 (substitute* "pyproject.toml"
1107 ((":__legacy__") ""))))
1108 (add-before 'check 'build-extensions
1109 (lambda _
1110 (invoke "python" "setup.py" "build_ext" "--inplace"))))))
1111 (native-inputs
1112 (list python-pytest python-setuptools))
1113 (propagated-inputs
1114 (list python-cffi))
1115 (home-page "https://github.com/indygreg/python-zstandard")
1116 (synopsis "Zstandard bindings for Python")
1117 (description "This project provides Python bindings for interfacing with
1118the Zstandard compression library. A C extension and CFFI interface are
1119provided.")
1120 (license license:bsd-3)))
1121
1122(define-public python-pyzstd
1123 (package
1124 (name "python-pyzstd")
1125 (version "0.18.0")
1126 (source
1127 (origin
1128 (method git-fetch)
1129 (uri (git-reference
1130 (url "https://github.com/Rogdham/pyzstd")
1131 (commit version)))
1132 (file-name (git-file-name name version))
1133 (sha256
1134 (base32 "08ih7vr3rzwrzpzwhk1k94z5nm9mmvls7c6w8wsqncf0kyl8d7yp"))
1135 (modules '((guix build utils)))
1136 (snippet '(begin
1137 ;; Remove a bundled copy of the zstd sources.
1138 (delete-file-recursively "zstd")
1139 (mkdir "zstd")
1140 (call-with-output-file "zstd/LICENSE"
1141 (const #t))))))
1142 (build-system pyproject-build-system)
1143 (arguments
1144 (list
1145 #:configure-flags
1146 #~'(("--build-option" . "--dynamic-link-zstd"))))
1147 (inputs (list `(,zstd "lib")))
1148 (native-inputs (list python-pytest python-setuptools))
1149 (propagated-inputs (list python-typing-extensions))
1150 (home-page "https://github.com/Rogdham/pyzstd")
1151 (synopsis "Zstandard bindings for Python")
1152 (description
1153 "This package provides Python bindings to the Zstandard (zstd)
1154compression library. The API is similar to Python's bz2/lzma/zlib module.")
1155 (license license:bsd-3)))