-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathpython-blosc2-package.scm
129 lines (118 loc) · 5.12 KB
/
python-blosc2-package.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
;;; This file follows the suggestions in the article "From development
;;; environments to continuous integration—the ultimate guide to software
;;; development with Guix" by Ludovic Courtès at the Guix blog:
;;; <https://guix.gnu.org/es/blog/2023/from-development-environments-to-continuous-integrationthe-ultimate-guide-to-software-development-with-guix/>.
;;;
;;; Use "guix shell -CP -L /path/to/c-blosc2/.guix/modules -D -f guix.scm" to
;;; get a container shell with build dependencies.
;;;
;;; Use "guix build -L $PWD/.guix/modules -L /path/to/c-blosc2/.guix/modules
;;; python-blosc2" to build.
;;;
;;; "/path/to/c-blosc2" may be "$PWD/blosc2/c-blosc2" to use the current
;;; C-Blosc2 Git submodule.
(define-module (python-blosc2-package)
#:use-module (guix)
#:use-module (guix build-system pyproject) ;for python-ndindex
#:use-module (guix build-system python)
#:use-module (guix git-download)
#:use-module ((guix licenses)
#:prefix license:)
#:use-module (ice-9 regex)
#:use-module (ice-9 textual-ports)
#:use-module (gnu packages check)
#:use-module (gnu packages cmake)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages version-control)
#:use-module (c-blosc2-package)
)
;; Generated by "guix import pypi ndindex"
;; (except for build arguments and native inputs).
(define-public python-ndindex
(package
(name "python-ndindex")
(version "1.7")
(source (origin
(method url-fetch)
(uri (pypi-uri "ndindex" version))
(sha256
(base32
"1lpgsagmgxzsas7g8yiv6wmyss8q57w92h70fn11rnpadsvx16xz"))))
(build-system pyproject-build-system)
(arguments
(list #:tests? #f))
(native-inputs (list python-numpy))
(home-page "https://quansight-labs.github.io/ndindex/")
(synopsis "A Python library for manipulating indices of ndarrays.")
(description
"This package provides a Python library for manipulating indices of ndarrays.")
(license license:expat)))
(define (current-source-root)
(dirname (dirname (current-source-directory))))
(define (get-python-blosc2-version)
(let ((version-path (string-append (current-source-root) "/blosc2/version.py"))
(version-rx (make-regexp
"^__version__\\s*=\\s*\"([^\"]*)\".*"
regexp/newline)))
(call-with-input-file version-path
(lambda (port)
(let* ((version-body (get-string-all port))
(version-match (regexp-exec version-rx version-body)))
(and version-match
(match:substring version-match 1)))))))
(define vcs-file?
;; Return true if the given file is under version control.
(or (git-predicate (current-source-root))
(const #t)))
(define-public python-blosc2
(package
(name "python-blosc2")
(version (get-python-blosc2-version))
(source (local-file "../.."
"pyblosc2-checkout"
#:recursive? #t
#:select? (lambda (path stat)
(and (vcs-file? path stat)
(not (string-contains path
"/blosc2/c-blosc2"))))))
(build-system python-build-system)
(arguments
(list #:phases #~(modify-phases %standard-phases
(replace 'build
(lambda* (#:key inputs #:allow-other-keys)
(invoke "python" "setup.py" "build"
"-DUSE_SYSTEM_BLOSC2:BOOL=YES")))
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(invoke "env" "PYTHONPATH=." "pytest")))))))
(inputs (list c-blosc2))
(propagated-inputs (list python-msgpack python-ndindex python-numpy
python-py-cpuinfo))
(native-inputs (list cmake-minimal pkg-config python-cython-3
python-pytest python-scikit-build))
(home-page "https://github.com/blosc/python-blosc2")
(synopsis "Python wrapper for the Blosc2 data compressor library")
(description
"Blosc2 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.
Python-Blosc2 wraps the C-Blosc2 library, and it aims to leverage its new API
so as to support super-chunks, multi-dimensional arrays, serialization and
other features introduced in C-Blosc2.
Python-Blosc2 also reproduces the API of Python-Blosc and is meant to be able
to access its data, so it can be used as a drop-in replacement.")
(license license:bsd-3)))
(define-public python-blosc2-with-avx2
(package
(inherit python-blosc2)
(inputs (list c-blosc2-with-avx2))
(name "python-blosc2-with-avx2")))
(define-public python-blosc2-with-avx512
(package
(inherit python-blosc2)
(inputs (list c-blosc2-with-avx512))
(name "python-blosc2-with-avx512")))
python-blosc2