projects/guix·blob perlssl · refs

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