diff options
Diffstat (limited to 'gnu/packages/python-compression.scm')
-rw-r--r-- | gnu/packages/python-compression.scm | 194 |
1 files changed, 193 insertions, 1 deletions
diff --git a/gnu/packages/python-compression.scm b/gnu/packages/python-compression.scm index bc96bc05d3..16e9fc7a4b 100644 --- a/gnu/packages/python-compression.scm +++ b/gnu/packages/python-compression.scm @@ -3,10 +3,11 @@ ;;; Copyright © 2017, 2019, 2021, 2022 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2017 Nikita <nikita@n0.is> ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu> -;;; Copyright © 2018-2020, 2022 Efraim Flashner <efraim@flashner.co.il> +;;; Copyright © 2018-2020, 2022, 2023 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr> ;;; Copyright © 2020, 2022, 2023 Marius Bakke <marius@gnu.org> ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot> +;;; Copyright © 2023, 2024 Troy Figiel <troy@troyfigiel.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -29,12 +30,15 @@ #:use-module (guix packages) #:use-module (guix download) #:use-module (guix gexp) + #:use-module (guix build-system cargo) #:use-module (guix build-system gnu) #:use-module (guix build-system python) #:use-module (guix build-system pyproject) #:use-module (gnu packages) #:use-module (gnu packages libffi) #:use-module (gnu packages compression) + #:use-module (gnu packages crates-io) + #:use-module (gnu packages cmake) #:use-module (gnu packages check) #:use-module (gnu packages maths) #:use-module (gnu packages pkg-config) @@ -43,8 +47,53 @@ #:use-module (gnu packages python-check) #:use-module (gnu packages python-crypto) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages rust-apps) #:use-module (gnu packages sphinx)) +(define-public python-blosc + (package + (name "python-blosc") + (version "1.11.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "blosc" version)) + (sha256 + (base32 + "0xmjs28sgpnb940zrhw010dq2m9d8a5h4fgnjyk6645fgfr1j8f2")) + (snippet + #~(begin (use-modules (guix build utils)) + (delete-file-recursively "blosc/c-blosc"))))) + (build-system python-build-system) + (arguments + (list #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'find-blosc + (lambda _ + (setenv "USE_SYSTEM_BLOSC" "1") + (setenv "Blosc_ROOT" #$(this-package-input "c-blosc")))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "python" "-m" "blosc.test"))))))) + (propagated-inputs + (list python-scikit-build python-numpy)) + (inputs (list c-blosc)) + (native-inputs (list cmake-minimal)) + (home-page "https://github.com/blosc/python-blosc") + (synopsis "Python wrapper for the Blosc data compressor library") + (description "Blosc is a high performance compressor optimized for binary +data. It has been designed to transmit data to the processor cache faster +than the traditional, non-compressed, direct memory fetch approach via a +@code{memcpy()} system call. + +Blosc works well for compressing numerical arrays that contains data with +relatively low entropy, like sparse data, time series, grids with +regular-spaced values, etc. + +This Python package wraps the Blosc library.") + (license license:bsd-3))) + (define-public python-multivolumefile (package (name "python-multivolumefile") @@ -72,6 +121,116 @@ file-object abstraction, making it possible to use multiple files as if they were a single file.") (license license:lgpl2.1+))) +(define-public python-cramjam + (package + (name "python-cramjam") + (version "2.7.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "cramjam" version)) + (sha256 + (base32 "1b69qlr0q7q3spa7zy55xc1dr5pjgsdavxx8ijhv2j60xqjbg7sp")))) + (build-system cargo-build-system) + (arguments + (list + #:imported-modules `(,@%cargo-build-system-modules + ,@%pyproject-build-system-modules) + #:modules '((guix build cargo-build-system) + ((guix build pyproject-build-system) + #:prefix py:) + (guix build utils)) + #:phases #~(modify-phases %standard-phases + ;; We use Maturin to build the project. + (replace 'build + (assoc-ref py:%standard-phases + 'build)) + ;; Before being able to run Python tests, we need to + ;; install the module and add it to PYTHONPATH. + (delete 'install) + (add-after 'build 'install + (assoc-ref py:%standard-phases + 'install)) + (add-after 'install 'add-install-to-pythonpath + (assoc-ref py:%standard-phases + 'add-install-to-pythonpath)) + ;; Finally run the tests. Only Python tests are provided. + (replace 'check + (lambda* (#:key tests? inputs outputs #:allow-other-keys) + (when tests? + ;; Without the CI variable, tests are run in "local" + ;; mode, which sets a deadline for hypothesis. For a + ;; deterministic build, we need to set CI. + (setenv "CI" "1") + (invoke "pytest" "-vv" "tests"))))) + #:cargo-inputs `(("rust-brotli" ,rust-brotli-3) + ("rust-bzip2" ,rust-bzip2-0.4) + ("rust-flate2" ,rust-flate2-1) + ("rust-lz4" ,rust-lz4-1) + ("rust-pyo3" ,rust-pyo3-0.18) + ("rust-snap" ,rust-snap-1) + ("rust-zstd" ,rust-zstd-0.11)) + #:install-source? #f)) + (native-inputs (list maturin + python-pytest + python-pytest-xdist + python-numpy + python-hypothesis + python-wrapper)) + (home-page "https://github.com/milesgranger/cramjam") + (synopsis "Python bindings to compression algorithms in Rust") + (description + "This package provides thin Python bindings to compression and +decomporession algorithms implemented in Rust. This allows for using +algorithms such as Snappy without additional system dependencies. The +following algorithms are available: + +@itemize +@item Snappy +@item Brotli +@item Bzip2 +@item LZ4 +@item Gzip +@item Deflate +@item Zstd +@end itemize") + (license license:expat))) + +(define-public python-ewah-bool-utils + (package + (name "python-ewah-bool-utils") + (version "1.1.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "ewah_bool_utils" version)) + (sha256 + (base32 "11z9vv9m19370j762z100dqhy2ndjzkxk3w9z02lzwadbyibal3h")))) + (build-system pyproject-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (add-before 'check 'build-extensions + (lambda _ + (invoke "python" "setup.py" "build_ext" "--inplace")))))) + (native-inputs + (list python-cython python-pytest)) + (propagated-inputs + (list python-numpy)) + (home-page "https://github.com/yt-project/ewah_bool_utils") + (synopsis "EWAH Bool Array compression") + (description "This package provide a Python wrapper to @acronym{EWAH, + Enhanced Word-Aligned Hybrid} compression bitarray method.") + (license (list + ;; LICENSE: for Python code. + license:bsd-3 + ;; XXX: Check if it's possible to have it as a dedicated package + ;; and link here.. + ;; ewah_bool_utils/cpp/LICENSE: for C++ bundle, sourced from + ;; <https://github.com/lemire/EWAHBoolArray>. + license:asl2.0)))) + (define-public python-pybcj (package (name "python-pybcj") @@ -416,6 +575,39 @@ the LZ4 frame format.") (description "Lz-string is a string compressor library for Python.") (license license:expat))) +(define-public python-python-snappy + (package + ;; PyPI contains both `snappy' and `python-snappy' as completely distinct + ;; packages. To avoid a name collision in Guix, we use the variable name + ;; `python-python-snappy' for the package called `python-snappy' on PyPI. + (name "python-python-snappy") + (version "0.6.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "python-snappy" version)) + (sha256 + (base32 "0amv12w0ybn6n1lk36x70a3l8bdjv4mn7iflb59wqsi00smhg8dn")))) + (build-system python-build-system) + (arguments + '(#:phases (modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "pytest" "-vv" "-k" + ;; CFFI is only supported for PyPy builds. + (string-append "not test_snappy_cffi_enum " + "and not test_snappy_all_cffi")))))))) + (inputs (list snappy)) + (native-inputs (list python-pytest)) + (home-page "https://github.com/andrix/python-snappy") + (synopsis "Python bindings for the Snappy compression library") + (description + "@code{python-python-snappy} provides bindings to the Snappy library and +can be used to compress and decompress files and streams. It can also be used +directly from the command line.") + (license license:bsd-3))) + (define-public bitshuffle (package (name "bitshuffle") |