projects/guix·blob master · refs

1351 lines · 47.7 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 digest)
49 #:use-module (gnu packages machine-learning)
50 #:use-module (gnu packages maths)
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 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.2.0")
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 "0vv7r7m7m6hqhbwb017s4rvc378mjxxvigg37r76imsqlyafbxvq"))
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-pgzip
408 (package
409 (name "python-pgzip")
410 (version "0.4.0")
411 (source
412 (origin
413 (method git-fetch)
414 (uri (git-reference
415 (url "https://github.com/pgzip/pgzip")
416 (commit (string-append "v" version))))
417 (file-name (git-file-name name version))
418 (sha256
419 (base32 "13fimy7jafc3h6771fagpa8lfp8kdy39wbnmns4lvc1hkf4vm8hz"))))
420 (build-system pyproject-build-system)
421 (native-inputs (list python-hatchling python-pytest))
422 (home-page "https://github.com/pgzip/pgzip")
423 (synopsis "Multi-threading implementation of Python gzip module")
424 (description
425 "This package provides a simple replacement of Python internal
426@code{gzip} module to provide a multiprocessing solution for gzip
427compression/decompression. Compression and decompression performance gains
428are made by parallelizing the usage of block indexing within a @code{gzip}
429file.")
430 (license license:expat)))
431
432(define-public python-pybcj
433 (package
434 (name "python-pybcj")
435 (version "1.0.7")
436 (source
437 (origin
438 (method git-fetch)
439 (uri (git-reference
440 (url "https://github.com/miurahr/pybcj")
441 (commit (string-append "v" version))))
442 (file-name (git-file-name name version))
443 (sha256
444 (base32 "1w5c706l0nhqrh1ms3m01w7pbd4vsm3jv84gxwlgrpr0w7d8hq7p"))))
445 (build-system pyproject-build-system)
446 (native-inputs
447 (list python-hypothesis
448 python-pytest
449 python-setuptools
450 python-setuptools-scm))
451 (home-page "https://github.com/miurahr/pybcj")
452 (synopsis "BCJ filter library")
453 (description "In data compression, BCJ, short for Branch-Call-Jump, refers
454to a technique that improves the compression of machine code of executable
455binaries by replacing relative branch addresses with absolute ones. This
456allows a LZMA compressor to identify duplicate targets and archive higher
457compression rate. BCJ is used in the 7-zip compression utility as the default
458filter for executable binaries.
459
460pybcj provides Python bindings to a BCJ implementation in C.")
461 (license license:lgpl2.1+)))
462
463;; XXX: Project is archived and not maintained since 2021.
464(define-public python-bcj-cffi
465 (package
466 (name "python-bcj-cffi")
467 (version "0.5.1")
468 (source
469 (origin
470 (method url-fetch)
471 (uri (pypi-uri "bcj-cffi" version))
472 (sha256
473 (base32 "1k6h9x8j65hssbgmvhl71sdjj9aq8d81drdibrdflaz7a895sjib"))))
474 (build-system pyproject-build-system)
475 (native-inputs
476 (list python-pytest python-setuptools python-setuptools-scm))
477 (propagated-inputs
478 (list python-cffi))
479 (home-page "https://github.com/miurahr/bcj-cffi")
480 (synopsis "Branch / Call /Jump CFFI library in Python")
481 (description "This package provides an implementation of the Branch / Call /
482Jump conversion filter by CFFI for Python.")
483 (license license:lgpl2.1+)))
484
485(define-public python-brotlicffi
486 (package
487 (name "python-brotlicffi")
488 (version "1.2.0.1")
489 (source
490 (origin
491 (method git-fetch)
492 (uri (git-reference
493 (url "https://github.com/python-hyper/brotlicffi")
494 (commit (string-append "v" version))))
495 (file-name (git-file-name name version))
496 (sha256
497 (base32 "1jal6gz3crca61gnmxjl37dycak0rsj46kvyfqhkmc15s17f64rm"))
498 (snippet
499 #~(begin
500 (use-modules (guix build utils))
501 (delete-file-recursively "libbrotli")))))
502 (build-system pyproject-build-system)
503 (arguments
504 (list
505 #:phases
506 #~(modify-phases %standard-phases
507 (add-after 'unpack 'use-shared-brotli
508 (lambda _
509 (setenv "USE_SHARED_BROTLI" "1")))
510 (add-before 'check 'set-brotli-source
511 (lambda _
512 (let* ((brotli-source
513 #+(package-source (this-package-input "brotli")))
514 (brotli-test-data
515 (string-append brotli-source "/tests/testdata"))
516 (brotli-version-source
517 (string-append brotli-source "/c/common/version.h")))
518 (substitute* "test/conftest.py"
519 (("TEST_DATA_DIR = .*")
520 (format #f "TEST_DATA_DIR = ~s~%" brotli-test-data)))
521 (substitute* "test/test_compatibility.py"
522 (("open\\(version_h\\)")
523 (format #f "open(~s)" brotli-version-source)))))))))
524 (native-inputs
525 (list python-pytest
526 python-setuptools))
527 (inputs
528 (list brotli))
529 (propagated-inputs
530 (list python-cffi))
531 (home-page "https://github.com/python-hyper/brotlicffi")
532 (synopsis "Python CFFI bindings to the Brotli library")
533 (description
534 "This package provides Python CFFI bindings to the Brotli library.")
535 (license license:expat)))
536
537(define-public python-inflate64
538 (package
539 (name "python-inflate64")
540 (version "1.0.4")
541 (source (origin
542 (method url-fetch)
543 (uri (pypi-uri "inflate64" version))
544 (sha256
545 (base32
546 "1kh7nkvm6r6ccxkbygzwdjaxnspnhqd2ivf0mxvrf0hcjs3cd65k"))))
547 (build-system pyproject-build-system)
548 (native-inputs
549 (list python-pytest python-setuptools python-setuptools-scm))
550 (home-page "https://pypi.org/project/inflate64/")
551 (synopsis "Compression/decompression library")
552 (description "The @code{inflate64} package provides @code{Deflater} and
553@code{Inflater} classes to compress and decompress with the Enhanced Deflate
554compression algorithm.")
555 (license license:lgpl2.1+)))
556
557(define-public python-isal
558 (package
559 (name "python-isal")
560 (version "1.8.0")
561 (source
562 (origin
563 (method url-fetch)
564 (uri (pypi-uri "isal" version))
565 (sha256
566 (base32 "1d7j30922v547vnif171yhk1jml9cv14izda0w506qhslglk6hhj"))
567 ;; Remove bundled isa-l source code
568 (modules '((guix build utils)))
569 (snippet
570 #~(delete-file-recursively "src/isal/isa-l"))))
571 (build-system pyproject-build-system)
572 (arguments
573 (list
574 #:phases
575 #~(modify-phases %standard-phases
576 (add-after 'unpack 'use-dynamic-linking
577 (lambda _
578 (setenv "PYTHON_ISAL_LINK_DYNAMIC" "1"))))))
579 (inputs (list isa-l))
580 (native-inputs
581 (list python-cython
582 python-pytest
583 python-setuptools
584 python-setuptools-scm))
585 (home-page "https://github.com/pycompression/python-isal")
586 (synopsis "Python bindings for the ISA-L compression library")
587 (description
588 "This package aims to provide faster zlib and gzip compatible compression
589and decompression by implementing Python bindings for the ISA-L library.")
590 (license license:expat)))
591
592(define-public python-jaraco-stream
593 (package
594 (name "python-jaraco-stream")
595 (version "3.0.4")
596 (source
597 (origin
598 (method git-fetch)
599 (uri (git-reference
600 (url "https://github.com/jaraco/jaraco.stream")
601 (commit (string-append "v" version))))
602 (file-name (git-file-name name version))
603 (sha256
604 (base32 "0jsmyh37m78gfk70n3j5k5djh6pajn96sbkfi987sjil3r3ix854"))))
605 (build-system pyproject-build-system)
606 (native-inputs
607 (list python-pytest
608 python-setuptools
609 python-setuptools-scm))
610 (propagated-inputs
611 (list python-more-itertools))
612 (home-page "https://github.com/jaraco/jaraco.stream")
613 (synopsis "Routines for dealing with data streams")
614 (description
615 "This package includes a set of generators for dynamically loading gzip
616data. It is geared towards dealing with data streams.")
617 (license license:expat)))
618
619(define-public python-pylsqpack
620 (package
621 (name "python-pylsqpack")
622 (version "0.3.24")
623 (source
624 (origin
625 (method git-fetch)
626 (uri (git-reference
627 (url "https://github.com/aiortc/pylsqpack")
628 (commit version)))
629 (file-name (git-file-name name version))
630 (sha256
631 (base32 "1mv48f6n2cflibjbkxx8cig6rblfdbpj969h5wm2s2nb1zbjmc54"))
632 (modules '((guix build utils)))
633 (snippet
634 #~(begin
635 (delete-file-recursively "vendor")))))
636 (build-system pyproject-build-system)
637 (arguments
638 (list
639 #:phases
640 #~(modify-phases %standard-phases
641 (add-before 'build 'use-system-libs
642 (lambda _
643 (mkdir-p "vendor/ls-qpack/deps/xxhash")
644 (copy-recursively
645 #$(package-source (this-package-native-input "ls-qpack"))
646 "vendor/ls-qpack")
647 (copy-recursively
648 #$(package-source (this-package-native-input "xxhash"))
649 "vendor/ls-qpack/deps/xxhash"))))))
650 (native-inputs
651 (list ls-qpack
652 python-pytest
653 python-setuptools
654 xxhash))
655 (home-page "https://github.com/aiortc/pylsqpack")
656 (synopsis "Python bindings for @code{ls-qpack}")
657 (description
658 "@code{pylsqpack} is a wrapper around the @code{ls-qpack} library.
659It provides Python Decoder and Encoder objects to read or write HTTP/3
660headers compressed with QPACK.")
661 (license license:expat)))
662
663(define-public python-pyppmd
664 (package
665 (name "python-pyppmd")
666 (version "1.3.1")
667 (source
668 (origin
669 (method git-fetch)
670 (uri (git-reference
671 (url "https://github.com/miurahr/pyppmd")
672 (commit (string-append "v" version))))
673 (file-name (git-file-name name version))
674 (sha256
675 (base32 "172b4x115sv10amlmjjg3g4nvq5vh8sqvkkdi04w6a3v7yh66rrp"))))
676 (build-system pyproject-build-system)
677 (arguments
678 (list #:test-flags #~(list "--benchmark-disable")))
679 (native-inputs
680 (list python-hypothesis
681 python-pytest
682 python-pytest-benchmark
683 python-pytest-timeout
684 python-setuptools
685 python-setuptools-scm))
686 (home-page "https://github.com/miurahr/pyppmd")
687 (synopsis "PPMd compression/decompression library")
688 (description "Pyppmd provides classes and functions for compressing and
689decompressing text data, using the @dfn{Prediction by partial matching} (PPM)
690compression algorithm variation H and I.2. It provides an API similar to
691Python's zlib/bz2/lzma modules.")
692 (license license:lgpl2.1+)))
693
694;; XXX: Project is archived and not maintained since 2022.
695(define-public python-ppmd-cffi
696 (package
697 (name "python-ppmd-cffi")
698 (version "0.5.0")
699 (source
700 (origin
701 (method url-fetch)
702 (uri (pypi-uri "ppmd-cffi" version))
703 (sha256
704 (base32
705 "0vprpl29fkflqx0m6anfpx7q7i4cw0d0qxcdm91k4pl82dcad81g"))))
706 (build-system pyproject-build-system)
707 (arguments
708 (list
709 ;; AssertionError: assert False
710 #:test-flags #~(list "--deselect=tests/test_cli.py::test_cli_help")))
711 (propagated-inputs
712 (list python-cffi))
713 (native-inputs
714 (list python-pytest python-setuptools python-setuptools-scm))
715 (home-page "https://github.com/miurahr/ppmd")
716 (synopsis "Prediction by Partial Matching compression library")
717 (description "PPMd is a compression algorithm library using the Prediction
718by Partial Matching statistical technique. It is used in RAR and 7-Zip as one of
719several possible methods.")
720 (license license:lgpl2.1+)))
721
722(define-public python-py7zr
723 (package
724 (name "python-py7zr")
725 (version "1.1.3")
726 (source
727 (origin
728 (method git-fetch)
729 (uri (git-reference
730 (url "https://github.com/miurahr/py7zr")
731 (commit (string-append "v" version))))
732 (file-name (git-file-name name version))
733 (sha256
734 (base32
735 "061m163ffcjc686bgz949cqajj61ncj532wx9vngd6kambzlm0a8"))))
736 (build-system pyproject-build-system)
737 (arguments
738 (list
739 #:test-flags
740 #~(list "--ignore=tests/test_benchmark.py")))
741 (propagated-inputs
742 (list python-backports-zstd
743 python-brotli
744 python-brotlicffi
745 python-inflate64
746 python-multivolumefile
747 python-psutil
748 python-pybcj
749 python-pycryptodomex
750 python-pyppmd
751 python-pyzstd
752 python-texttable))
753 (native-inputs
754 (list python-libarchive-c
755 python-pytest
756 python-pytest-benchmark
757 python-pytest-httpserver
758 python-pytest-remotedata
759 python-pytest-timeout
760 python-requests
761 python-setuptools
762 python-setuptools-scm))
763 (home-page "https://github.com/miurahr/py7zr")
764 (synopsis "7-zip in Python")
765 (description "This package provides py7zr, which implements 7-zip
766archive compression, decompression, encryption and decryption in
767Python.")
768 (license license:lgpl2.1+)))
769
770(define-public python-lzo
771 (package
772 (name "python-lzo")
773 (version "1.15")
774 (source
775 (origin
776 (method url-fetch)
777 (uri (pypi-uri "python-lzo" version))
778 (sha256
779 (base32 "0jbv6853p8flk65ks0nw37f6f5v0ryi6nhppv5fm3863ql0alym5"))))
780 (build-system pyproject-build-system)
781 (arguments
782 (list
783 #:phases
784 #~(modify-phases %standard-phases
785 (add-after 'unpack 'patch-setuppy
786 (lambda* (#:key inputs #:allow-other-keys)
787 (substitute* "setup.py"
788 (("include_dirs.append\\(.*\\)")
789 (format #f "include_dirs.append(~s)"
790 (search-input-directory inputs "include/lzo")))))))))
791 (native-inputs (list python-pytest python-setuptools python-wheel))
792 (inputs (list lzo))
793 (home-page "https://github.com/jd-boyd/python-lzo")
794 (synopsis "Python bindings for the LZO data compression library")
795 (description
796 "Python-LZO provides Python bindings for LZO, i.e. you can access
797the LZO library from your Python scripts thereby compressing ordinary
798Python strings.")
799 (license license:gpl2+)))
800
801(define-public python-lz4
802 (package
803 (name "python-lz4")
804 (version "4.4.4")
805 (source
806 (origin
807 (method url-fetch)
808 (uri (pypi-uri "lz4" version))
809 (sha256
810 (base32
811 "1nmb757fx3k30zsjiaz7nj6cgp4zxl44w28s4l8k0ff4grid03q7"))
812 (modules '((guix build utils)))
813 (snippet '(begin
814 ;; Remove bundled copy of lz4.
815 (delete-file-recursively "lz4libs")))))
816 (build-system pyproject-build-system)
817 (arguments
818 ;; Taken from tox.ini (excludes experimental tests).
819 (list #:test-flags #~(list "tests/block" "tests/frame")))
820 (native-inputs
821 (list pkg-config
822 python-pytest
823 python-pkgconfig
824 python-setuptools
825 python-setuptools-scm
826 python-psutil))
827 (inputs
828 (list lz4))
829 (home-page "https://github.com/python-lz4/python-lz4")
830 (synopsis "LZ4 bindings for Python")
831 (description
832 "This package provides python bindings for the lz4 compression library
833by Yann Collet. The project contains bindings for the LZ4 block format and
834the LZ4 frame format.")
835 (license license:bsd-3)))
836
837(define-public python-lzstring
838 (package
839 (name "python-lzstring")
840 (version "1.0.4")
841 (source
842 (origin
843 (method url-fetch)
844 (uri (pypi-uri "lzstring" version))
845 (sha256
846 (base32 "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs"))))
847 (build-system pyproject-build-system)
848 (arguments
849 ;; No tests in PyPI, this project is a fork of
850 ;; <https://github.com/eduardtomasek/lz-string-python> and doesn't provide
851 ;; tags.
852 (list #:tests? #f))
853 (native-inputs
854 (list python-setuptools))
855 (propagated-inputs
856 (list python-future))
857 (home-page "https://github.com/gkovacs/lz-string-python")
858 (synopsis "String compression")
859 (description "Lz-string is a string compressor library for Python.")
860 (license license:expat)))
861
862(define-public python-python-snappy
863 (package
864 ;; PyPI contains both `snappy' and `python-snappy' as completely distinct
865 ;; packages. To avoid a name collision in Guix, we use the variable name
866 ;; `python-python-snappy' for the package called `python-snappy' on PyPI.
867 (name "python-python-snappy")
868 (version "0.7.3")
869 (source
870 (origin
871 (method url-fetch)
872 (uri (pypi-uri "python_snappy" version))
873 (sha256
874 (base32 "1qyfhsaagpzgrw5n2zklx670zi0f3lm1djqyg2n3hbgvmldnq8a0"))))
875 (build-system pyproject-build-system)
876 (arguments
877 (list #:test-backend #~'unittest))
878 (native-inputs (list python-setuptools))
879 (inputs
880 (list snappy))
881 (propagated-inputs (list python-cramjam))
882 (home-page "https://github.com/intake/python-snappy")
883 (synopsis "Python bindings for the Snappy compression library")
884 (description
885 "@code{python-python-snappy} provides bindings to the Snappy library and
886can be used to compress and decompress files and streams. It can also be used
887directly from the command line.")
888 (license license:bsd-3)))
889
890(define-public python-bitshuffle
891 (package
892 (name "python-bitshuffle")
893 (version "0.5.2")
894 (source (origin
895 (method url-fetch)
896 (uri (pypi-uri "bitshuffle" version))
897 (sha256
898 (base32
899 "139xz3m2m8sal8riicvmb9i0sq4085s2hc6c148bwhmzpnvky3nw"))
900 (modules '((guix build utils)))
901 (snippet
902 '(begin
903 ;; TODO Remove bundled libraries: lz4, lzf, and zstd.
904 ;; Remove generated Cython files.
905 (delete-file "bitshuffle/h5.c")
906 (delete-file "bitshuffle/ext.c")))))
907 (build-system pyproject-build-system)
908 (arguments
909 (list
910 #:test-flags
911 ;; FileNotFoundError: [Errno 2] Unable to synchronously open file
912 ;; (unable to open file: name =
913 ;; '/tmp/<...>/tests/data/regression_0.1.3.h5', errno = 2, error message
914 ;; = 'No such file or directory', flags = 0, o_flags = 0)
915 #~(list "--deselect=tests/test_regression.py::TestAll::test_regression")
916 #:phases
917 #~(modify-phases %standard-phases
918 (add-before 'build 'pre-build
919 ;; TODO: Check how to build on other architectures.
920 ;; Taken form .github/workflows/wheels.yml.
921 (lambda _
922 #$@(if (target-x86-64?)
923 '((setenv "BITSHUFFLE_ARCH" "haswell")
924 (setenv "CIBW_SKIP" "pp* *musllinux* cp311-macosx*")
925 (setenv "CIBW_ARCHS" "x86_64"))
926 '())
927 (setenv "HDF5_DIR" #$(this-package-input "hdf5")))))))
928 (native-inputs
929 (list python-cython
930 python-pytest
931 python-setuptools))
932 (inputs
933 (list python-numpy
934 python-h5py
935 hdf5))
936 (home-page "https://github.com/kiyo-masui/bitshuffle")
937 (synopsis "Filter for improving compression of typed binary data")
938 (description "Bitshuffle is an algorithm that rearranges typed, binary data
939for improving compression, as well as a python/C package that implements this
940algorithm within the Numpy framework.")
941 (license license:expat)))
942
943(define-public bitshuffle-for-snappy
944 (package/inherit python-bitshuffle
945 (name "bitshuffle-for-snappy")
946 (build-system gnu-build-system)
947 (arguments
948 (list
949 #:tests? #f
950 #:phases
951 #~(modify-phases %standard-phases
952 (replace 'configure
953 (lambda _
954 (with-output-to-file "Makefile"
955 (lambda _
956 (format #t "\
957libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
958\tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
959
960%.o: %.c
961\tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
962
963PREFIX:=~a
964LIBDIR:=$(PREFIX)/lib
965INCLUDEDIR:=$(PREFIX)/include
966
967install: libbitshuffle.so
968\tinstall -dm755 $(LIBDIR)
969\tinstall -dm755 $(INCLUDEDIR)
970\tinstall -m755 libbitshuffle.so $(LIBDIR)
971\tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
972\tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
973\tinstall -m644 src/iochain.h $(INCLUDEDIR)
974\tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
975" #$output))))))))
976 (inputs '())
977 (native-inputs '())))
978
979(define-public python-uncompresspy
980 (package
981 (name "python-uncompresspy")
982 (version "0.4.0")
983 (source
984 (origin
985 (method url-fetch)
986 (uri (pypi-uri "uncompresspy" version))
987 (sha256
988 (base32 "1110dipshnijhq6dk5dxzxx3zpynm6dx5kcc430fw24b8xwlc9in"))))
989 (build-system pyproject-build-system)
990 (arguments
991 (list #:tests? #f)) ;no tests
992 (native-inputs
993 (list python-setuptools))
994 (home-page "https://github.com/kYwzor/uncompresspy")
995 (synopsis "Uncompressing LZW files in Python")
996 (description
997 "This package implement a pure Python module for uncompressing LZW
998files (.Z), such as the ones created by Unix's shell tool compress.")
999 (license license:bsd-3)))
1000
1001(define-public python-unix-ar
1002 (package
1003 (name "python-unix-ar")
1004 (version "0.2.1")
1005 (source
1006 (origin
1007 (method git-fetch)
1008 (uri (git-reference
1009 (url "https://github.com/getninjas/unix_ar")
1010 (commit version)))
1011 (file-name (git-file-name name version))
1012 (sha256
1013 (base32 "0bdxm7y0r7xz3d2iglxwmf1290pi3h05x3gjc0f0af01pl2j2pqn"))))
1014 (build-system pyproject-build-system)
1015 (arguments
1016 (list
1017 #:test-flags
1018 ;; These tests have timestamp-related issues.
1019 #~(list "tests.py" "-k" "not test_add and not test_addfile")))
1020 (native-inputs (list python-pytest python-setuptools python-wheel))
1021 (home-page "https://github.com/getninjas/unix_ar")
1022 (synopsis "AR file handling in Python")
1023 (description "This package provides utilities to handle AR files in
1024Python.")
1025 (license license:bsd-3)))
1026
1027(define-public python-unlzw-cython
1028 (package
1029 (name "python-unlzw-cython")
1030 (version "1.0.0")
1031 (source
1032 (origin
1033 (method git-fetch)
1034 (uri (git-reference
1035 (url "https://github.com/AlecThomson/unlzw-cython")
1036 (commit (string-append "v" version))))
1037 (file-name (git-file-name name version))
1038 (sha256
1039 (base32 "147j0aixkrd86vb22jppkznyk2qhk2kkzmdz3w2am0gng0g4d41i"))))
1040 (build-system pyproject-build-system)
1041 (native-inputs
1042 (list python-cython
1043 python-hatch-cython
1044 python-hatch-vcs
1045 python-hatchling
1046 python-pytest
1047 python-setuptools))
1048 (home-page "https://github.com/AlecThomson/unlzw-cython")
1049 (synopsis "Cython unlzw port to open .Z files")
1050 (description
1051 "This package provides a cython-accelerated decompression module for
1052@code{.Z} files compressed using the Unix @code{compress} utility. This is a
1053fork of @url{https://github.com/scivision/unlzw3, unlzw3}.")
1054 (license license:zlib)))
1055
1056(define-public python-unlzw3
1057 (package
1058 (name "python-unlzw3")
1059 (version "0.2.3")
1060 (source
1061 (origin
1062 (method git-fetch)
1063 (uri (git-reference
1064 (url "https://github.com/scivision/unlzw3")
1065 (commit (string-append "v" version))))
1066 (file-name (git-file-name name version))
1067 (sha256
1068 (base32 "1ddsk9gs4yzvca80r0q6spvfvw31miwmp2dy93w4lcadr54sh6mc"))))
1069 (build-system pyproject-build-system)
1070 (native-inputs
1071 (list python-pytest
1072 python-setuptools))
1073 (home-page "https://github.com/scivision/unlzw3")
1074 (synopsis "Decompression module for .Z files")
1075 (description
1076 "This package provides a pure Python decompression module for @code{.Z}
1077files compressed using Unix compress utility. It's a maintained fork of
1078@url{https://github.com/umeat/unlzw}.")
1079 (license license:expat)))
1080
1081(define-public python-zipfile2
1082 (package
1083 (name "python-zipfile2")
1084 (version "0.0.12")
1085 (source
1086 (origin
1087 (method git-fetch)
1088 (uri (git-reference
1089 (url "https://github.com/itziakos/zipfile2/")
1090 (commit (string-append "v" version))))
1091 (file-name (git-file-name name version))
1092 (sha256
1093 (base32 "1hmq33r3ffrrvm5nggsp69cjdbgjbwn6zbcrs2rhmb8pds0h81q7"))
1094 ;; TODO: Remove in the next release:
1095 ;; https://github.com/itziakos/zipfile2/commit/5ea38d6eaaa5
1096 (patches (search-patches "python-zipfile2-python-3.12-support.patch"))))
1097 (build-system pyproject-build-system)
1098 (native-inputs
1099 (list python-pytest
1100 python-setuptools))
1101 (home-page "https://github.com/itziakos/zipfile2/")
1102 (synopsis "Improved @code{ZipFile} Python class")
1103 (description
1104 "Zipfile2 is a backward compatible replacement to @code{ZipFile}. It
1105provides handling of symlinks, and exception management.")
1106 (license license:psfl)))
1107
1108(define-public python-zipp
1109 (package
1110 (name "python-zipp")
1111 (version "3.23.0")
1112 (source
1113 (origin
1114 (method git-fetch)
1115 (uri (git-reference
1116 (url "https://github.com/jaraco/zipp")
1117 (commit (string-append "v" version))))
1118 (file-name (git-file-name name version))
1119 (sha256
1120 (base32 "1r8yk1flzlblif7z5ib94mvl12vvwlzhi42vnzrdnaimr80kpal9"))))
1121 (build-system pyproject-build-system)
1122 (native-inputs
1123 (list python-jaraco-itertools
1124 python-jaraco-test
1125 python-pytest
1126 python-setuptools
1127 python-setuptools-scm))
1128 (home-page "https://github.com/jaraco/zipp")
1129 (synopsis "Backport of pathlib-compatible object wrapper for zip files")
1130 (description
1131 "This package provides a @code{pathlib}-compatible @code{Zipfile} object
1132wrapper. It provides a backport of the @code{zipfile.Path} object.")
1133 (license license:expat)))
1134
1135(define-public python-deflate
1136 (package
1137 (name "python-deflate")
1138 (version "0.8.0")
1139 (source
1140 (origin
1141 (method url-fetch)
1142 (uri (pypi-uri "deflate" version))
1143 (sha256
1144 (base32 "0cgk118r3sglrjqirr22y7mr7fnhijhwd3v6isykjbf2m2dqyy41"))))
1145 (build-system pyproject-build-system)
1146 (arguments
1147 (list
1148 #:phases #~(modify-phases %standard-phases
1149 (add-after 'unpack 'libdeflate-prefix
1150 (lambda _
1151 (setenv "LIBDEFLATE_PREFIX"
1152 #$(this-package-input "libdeflate")))))))
1153 (native-inputs (list cmake-minimal python-pytest python-scikit-build-core))
1154 (inputs (list libdeflate))
1155 (home-page "https://github.com/dcwatson/deflate")
1156 (synopsis "Python wrapper for @code{libdeflate}")
1157 (description "This package contains a very thin Python wrapper for
1158@code{libdeflate}.")
1159 (license license:expat)))
1160
1161(define-public python-xopen
1162 (package
1163 (name "python-xopen")
1164 ;; TODO: Newer versions require zlib-ng:
1165 ;; <https://github.com/zlib-ng/zlib-ng>,
1166 ;; <https://github.com/pycompression/python-zlib-ng>.
1167 (version "1.8.0")
1168 (source
1169 (origin
1170 (method url-fetch)
1171 (uri (pypi-uri "xopen" version))
1172 (sha256
1173 (base32 "0h08wpd5zwnlzwnbbbhahbcs69kzsfbaaigqw0viq6ri8n4zrh00"))))
1174 (build-system pyproject-build-system)
1175 ;; tests: 343 passed, 5 skipped
1176 (native-inputs
1177 (list python-pytest
1178 python-pytest-timeout
1179 python-setuptools
1180 python-setuptools-scm))
1181 (propagated-inputs
1182 (list pigz python-isal))
1183 (home-page "https://github.com/marcelm/xopen/")
1184 (synopsis "Open compressed files transparently")
1185 (description "This module provides an @code{xopen} function that works
1186like Python's built-in @code{open} function, but can also deal with compressed
1187files. Supported compression formats are gzip, bzip2 and, xz, and are
1188automatically recognized by their file extensions. The focus is on being as
1189efficient as possible on all supported Python versions.")
1190 (license license:expat)))
1191
1192(define-public python-zipstream-ng
1193 (package
1194 (name "python-zipstream-ng")
1195 (version "1.9.0")
1196 (source
1197 (origin
1198 (method url-fetch)
1199 (uri (pypi-uri "zipstream_ng" version))
1200 (sha256
1201 (base32 "1snsczv5v2fvndxi8hbgd42ghhiwc20cdz8dz3xpw4rdh8q41nd0"))))
1202 (build-system pyproject-build-system)
1203 (native-inputs
1204 (list python-pytest python-setuptools python-wheel))
1205 (home-page "https://github.com/pR0Ps/zipstream-ng")
1206 (synopsis "Streamable zip file generator")
1207 (description
1208 "This package provides a modern and easy to use streamable zip file
1209generator")
1210 (license license:lgpl3)))
1211
1212(define-public python-zlib-ng
1213 (package
1214 (name "python-zlib-ng")
1215 (version "1.0.0")
1216 (source
1217 (origin
1218 (method git-fetch)
1219 (uri (git-reference
1220 (url "https://github.com/pycompression/python-zlib-ng")
1221 (commit (string-append "v" version))))
1222 (file-name (git-file-name name version))
1223 (sha256
1224 (base32 "05s0023hhdk59339mmd20yycy6ldssa2kmxmzflkqlab5mpx5wxp"))))
1225 (build-system pyproject-build-system)
1226 (arguments
1227 (list
1228 #:phases
1229 #~(modify-phases %standard-phases
1230 (add-after 'unpack 'use-system-zlib-ng
1231 (lambda _
1232 (copy-recursively
1233 #$(package-source (this-package-input "zlib-ng"))
1234 "src/zlib_ng/zlib-ng")
1235 (setenv "PYTHON_ZLIB_NG_LINK_DYNAMIC " "true"))))))
1236 (native-inputs
1237 (list cmake-minimal
1238 python-pytest
1239 python-setuptools
1240 python-setuptools-scm))
1241 (inputs
1242 (list zlib-ng))
1243 (home-page "https://github.com/pycompression/python-zlib-ng")
1244 (synopsis "Drop-in replacement for zlib and gzip modules using zlib-ng")
1245 (description
1246 "This package provides a faster @code{zlib} and @code{gzip} compatible
1247compression and decompression by providing Python bindings for the
1248@code{zlib-ng} library.")
1249 (license license:psfl)))
1250
1251(define-public python-zopfli
1252 (package
1253 (name "python-zopfli")
1254 (version "0.4.0")
1255 (source
1256 (origin
1257 (method git-fetch)
1258 (uri (git-reference
1259 (url "https://github.com/fonttools/py-zopfli")
1260 (commit (string-append "v" version))))
1261 (file-name (git-file-name name version))
1262 (sha256
1263 (base32 "1figk175w1q8ww8ryh2ypg7jjlkjbnry3gwhn8d56xh5icwgwi5g"))))
1264 (build-system pyproject-build-system)
1265 (arguments
1266 (list
1267 #:phases
1268 #~(modify-phases %standard-phases
1269 (add-after 'unpack 'use-system-zopfli
1270 (lambda _
1271 (setenv "USE_SYSTEM_ZOPFLI" "1"))))))
1272 (native-inputs
1273 (list python-pytest
1274 python-setuptools
1275 python-setuptools-scm))
1276 (inputs
1277 (list zopfli))
1278 (home-page "https://github.com/fonttools/py-zopfli")
1279 (synopsis "Python bindings for Zopfli")
1280 (description "@code{pyzopfli} is a straight forward wrapper around the
1281@code{ZlibCompress} method of the the @code{zopfli} library.")
1282 (license license:asl2.0)))
1283
1284(define-public python-zstandard
1285 (package
1286 (name "python-zstandard")
1287 (version "0.23.0")
1288 (source
1289 (origin
1290 (method url-fetch)
1291 (uri (pypi-uri "zstandard" version))
1292 (sha256
1293 (base32 "02dwqq5dw73zypvwpadscra8x6rwbglblh57yxl5y9g710nwdn5j"))))
1294 (build-system pyproject-build-system)
1295 ;; TODO: Unbunle zstd.
1296 (arguments
1297 (list
1298 #:phases
1299 #~(modify-phases %standard-phases
1300 (add-after 'unpack 'patch-build-system
1301 (lambda _
1302 (substitute* "pyproject.toml"
1303 ((":__legacy__") ""))))
1304 (add-before 'check 'build-extensions
1305 (lambda _
1306 (invoke "python" "setup.py" "build_ext" "--inplace"))))))
1307 (native-inputs
1308 (list python-pytest python-setuptools))
1309 (propagated-inputs
1310 (list python-cffi))
1311 (home-page "https://github.com/indygreg/python-zstandard")
1312 (synopsis "Zstandard bindings for Python")
1313 (description "This project provides Python bindings for interfacing with
1314the Zstandard compression library. A C extension and CFFI interface are
1315provided.")
1316 (license license:bsd-3)))
1317
1318(define-public python-pyzstd
1319 (package
1320 (name "python-pyzstd")
1321 (version "0.18.0")
1322 (source
1323 (origin
1324 (method git-fetch)
1325 (uri (git-reference
1326 (url "https://github.com/Rogdham/pyzstd")
1327 (commit version)))
1328 (file-name (git-file-name name version))
1329 (sha256
1330 (base32 "08ih7vr3rzwrzpzwhk1k94z5nm9mmvls7c6w8wsqncf0kyl8d7yp"))
1331 (modules '((guix build utils)))
1332 (snippet '(begin
1333 ;; Remove a bundled copy of the zstd sources.
1334 (delete-file-recursively "zstd")
1335 (mkdir "zstd")
1336 (call-with-output-file "zstd/LICENSE"
1337 (const #t))))))
1338 (build-system pyproject-build-system)
1339 (arguments
1340 (list
1341 #:configure-flags
1342 #~'(("--build-option" . "--dynamic-link-zstd"))))
1343 (inputs (list `(,zstd "lib")))
1344 (native-inputs (list python-pytest python-setuptools))
1345 (propagated-inputs (list python-typing-extensions))
1346 (home-page "https://github.com/Rogdham/pyzstd")
1347 (synopsis "Zstandard bindings for Python")
1348 (description
1349 "This package provides Python bindings to the Zstandard (zstd)
1350compression library. The API is similar to Python's bz2/lzma/zlib module.")
1351 (license license:bsd-3)))