projects/guix·blob java-team · refs

383 lines · 12.4 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2024 Michal Atlas <[email protected]>
3;;; Copyright © 2024, 2025 Guillaume Le Vaillant <[email protected]>
4;;; Copyright © 2026 Spencer King <[email protected]>
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages quantum)
22 #:use-module (gnu packages)
23 #:use-module (gnu packages check)
24 #:use-module (gnu packages lisp-check)
25 #:use-module (gnu packages lisp-xyz)
26 #:use-module (gnu packages machine-learning)
27 #:use-module (gnu packages protobuf)
28 #:use-module (gnu packages python-build)
29 #:use-module (gnu packages python-check)
30 #:use-module (gnu packages python-science)
31 #:use-module (gnu packages python-web)
32 #:use-module (gnu packages python-xyz)
33 #:use-module (guix build-system asdf)
34 #:use-module (guix build-system pyproject)
35 #:use-module (guix gexp)
36 #:use-module (guix git-download)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix packages))
39
40;;; Commentary:
41;;;
42;;; Quantum computing and tensor operation module. For quantum mechanics
43;;; select (gnu packages physics) module.
44;;;
45;;; Code:
46
47
48(define %cirq-version "1.7.0")
49
50(define %cirq-home-page "https://quantumai.google/cirq")
51
52(define %cirq-license license:asl2.0)
53
54;; Cirq source provides multiple Python packages all them share the same
55;; version.
56(define %cirq-source
57 (origin
58 (method git-fetch)
59 (uri (git-reference
60 (url "https://github.com/quantumlib/Cirq")
61 (commit (string-append "v" %cirq-version))))
62 (file-name (git-file-name "python-cirq" %cirq-version))
63 (sha256
64 (base32 "1bd8bsigfq9f00420bxj4snpcp4kr8x54y8kjx62a5q46diq231q"))))
65
66(define-public python-cirq-aqt
67 (package
68 (name "python-cirq-aqt")
69 (version %cirq-version)
70 (source %cirq-source)
71 (build-system pyproject-build-system)
72 (arguments
73 (list
74 #:tests? #f ;no tests
75 #:phases
76 #~(modify-phases %standard-phases
77 (add-after 'unpack 'chdir
78 (lambda _
79 (chdir "cirq-aqt"))))))
80 (native-inputs
81 (list python-setuptools))
82 (propagated-inputs
83 (list python-cirq-core
84 python-requests))
85 (home-page %cirq-home-page)
86 (synopsis "Cirq-AQT integration module")
87 (description
88 "This package provides an interface that allows Cirq quantum algorithms
89to run on quantum computers made by @url{https://www.aqt.eu/, Alpine Quantum
90Technologies GmbH}.")
91 (license %cirq-license)))
92
93(define-public python-cirq-core
94 (package
95 (name "python-cirq-core")
96 (version %cirq-version)
97 (source %cirq-source)
98 (build-system pyproject-build-system)
99 (arguments
100 (list
101 #:test-flags
102 ;; As seen in project's CI, the full test suite is huge.
103 #~(list "--ignore=cirq/contrib")
104 #:phases
105 #~(modify-phases %standard-phases
106 (add-after 'unpack 'chdir
107 (lambda _
108 (chdir "cirq-core")))
109 (add-before 'sanity-check 'pre-check
110 (lambda _
111 (setenv "HOME" "/tmp")
112 (setenv "NUMBA_CACHE_DIR" "/tmp"))))))
113 (native-inputs
114 (list python-freezegun
115 python-ipython
116 python-ply
117 python-pylatex
118 python-pytest
119 python-pytest-benchmark
120 python-setuptools))
121 (propagated-inputs
122 (list python-attrs
123 python-duet
124 python-matplotlib
125 python-networkx
126 python-numpy
127 python-pandas
128 python-quimb
129 python-scipy
130 python-scikit-learn
131 python-sortedcontainers
132 python-sympy
133 python-tqdm))
134 (home-page %cirq-home-page)
135 (synopsis "Framework for creating, editing, and running NISQ circuits.")
136 (description
137 "This package provides a Python framework for creating, editing, and
138running Noisy Intermediate-Scale Quantum (NISQ) circuits. Built-in simulators
139are provided for running quantum algorithms. Algorithms can also be run on a
140variety of commercial quantum computing platforms by installing additional
141integrations.")
142 (license %cirq-license)))
143
144(define-public python-cirq-google
145 (package
146 (name "python-cirq-google")
147 (version %cirq-version)
148 (source %cirq-source)
149 (build-system pyproject-build-system)
150 (arguments
151 (list
152 #:phases
153 #~(modify-phases %standard-phases
154 (add-after 'unpack 'chdir
155 (lambda _
156 (chdir "cirq-google"))))))
157 (native-inputs
158 (list python-setuptools))
159 (propagated-inputs
160 (list python-cirq-core
161 python-google-api-core
162 python-proto-plus
163 python-protobuf-6
164 python-typedunits))
165 (home-page %cirq-home-page)
166 (synopsis "Interface to Google's Quantum Computing Service")
167 (description
168 "This package provides an interface for Cirq to Google's Quantum Computing
169Service.")
170 (license %cirq-license)))
171
172(define-public python-quimb
173 (package
174 (name "python-quimb")
175 (version "1.14.0")
176 (source
177 (origin
178 (method git-fetch)
179 (uri (git-reference
180 (url "https://github.com/jcmgray/quimb")
181 (commit (string-append "v" version))))
182 (file-name (git-file-name name version))
183 (sha256
184 (base32 "13h57cq183nb73j83jc2lrlcyy4km3d297arbps17wawq04wwyiv"))))
185 (build-system pyproject-build-system)
186 (arguments
187 (list
188 ;; tests: 4300 passed, 508 skipped, 85 warnings
189 #:test-flags
190 ;; See: <https://github.com/jcmgray/quimb/issues/354>.
191 #~(list "--ignore=tests/test_tensor/test_tn1d/test_compress.py")
192 #:phases
193 #~(modify-phases %standard-phases
194 ;; QUIMB_NUM_THREAD_WORKERS is read from the environment and
195 ;; must be set otherwise some tests will fail since a default
196 ;; value is not provided in all cases.
197 (add-before 'check 'set-env
198 (lambda _
199 (setenv "QUIMB_NUM_THREAD_WORKERS" "1"))))))
200 (native-inputs
201 (list python-hatch-vcs
202 python-hatchling
203 python-pytest))
204 (propagated-inputs
205 (list python-autoray
206 python-cotengra
207 python-cytoolz
208 python-numba
209 python-numpy
210 python-psutil
211 python-scipy
212 python-tqdm))
213 (home-page "https://quimb.readthedocs.io")
214 (synopsis "Library for quantum information and many-body calculations")
215 (description
216 "This package provides a fast Python libray for performing quantum
217information and many-body calculations, focusing primarily on tensor
218networks.")
219 (license license:asl2.0)))
220
221(define-public sbcl-rpcq
222 (package
223 (name "sbcl-rpcq")
224 (version "3.10.0")
225 (source
226 (origin
227 (method git-fetch)
228 (uri (git-reference
229 (url "https://github.com/rigetti/rpcq")
230 (commit (string-append "v" version))))
231 (file-name (git-file-name "cl-rpcq" version))
232 (sha256
233 (base32 "1bvppxlacvp0pfdbpn7ls1zxd127jacl225ds7lph5s8f8cyvf17"))))
234 (build-system asdf-build-system/sbcl)
235 (arguments
236 (list
237 ;; TODO: https://github.com/rigetti/rpcq/issues/161
238 #:tests? #f))
239 (native-inputs (list sbcl-fiasco))
240 (inputs
241 (list sbcl-alexandria
242 sbcl-bordeaux-threads
243 sbcl-cl-messagepack
244 sbcl-cl-ppcre
245 sbcl-cl-syslog
246 sbcl-flexi-streams
247 sbcl-local-time
248 sbcl-parse-float
249 sbcl-pzmq
250 sbcl-trivial-backtrace
251 sbcl-uuid
252 sbcl-yason))
253 (synopsis "RPC framework for Rigetti Quantum Cloud Services")
254 (description
255 "This package provides the asynchronous RPC client-server framework and
256message specification for Rigetti Quantum Cloud Services (QCS). It implements
257an efficient transport protocol by using ZeroMQ (ZMQ) sockets and MessagePack
258(msgpack) serialization.")
259 (home-page "https://github.com/rigetti/rpcq")
260 (license license:asl2.0)))
261
262(define-public cl-rpcq
263 (sbcl-package->cl-source-package sbcl-rpcq))
264
265(define-public sbcl-cl-quil
266 (package
267 (name "sbcl-cl-quil")
268 (version "1.26.0")
269 (source
270 (origin
271 (method git-fetch)
272 (uri (git-reference
273 (url "https://github.com/quil-lang/quilc")
274 (commit (string-append "v" version))))
275 (file-name (git-file-name "cl-quil" version))
276 (sha256
277 (base32 "1s99lk456sw9hhsx5cf3x9r97iw9s3ydqsd94zz3bjnq77wmkhz5"))))
278 (build-system asdf-build-system/sbcl)
279 (arguments
280 (list
281 ;; Requires cyclic dependency with qvm
282 #:tests? #f))
283 (inputs
284 (list sbcl-abstract-classes
285 sbcl-alexa
286 sbcl-alexandria
287 sbcl-cl-algebraic-data-type
288 sbcl-cl-grnm
289 sbcl-cl-heap
290 sbcl-cl-permutation
291 sbcl-cl-yacc
292 sbcl-global-vars
293 sbcl-magicl
294 sbcl-optima
295 sbcl-parse-float
296 sbcl-queues
297 sbcl-salza2
298 sbcl-split-sequence
299 sbcl-trivial-garbage
300 sbcl-yason))
301 (synopsis "The optimizing Quil compiler")
302 (description
303 "Quil is the quantum instruction language, originally developed at
304Rigetti Computing. In Quil quantum algorithms are expressed using Quil's
305standard gates and instructions")
306 (home-page "https://github.com/quil-lang/quilc")
307 (license license:asl2.0)))
308
309(define-public cl-quil
310 (sbcl-package->cl-source-package sbcl-cl-quil))
311
312(define-public sbcl-qvm
313 (package
314 (name "sbcl-qvm")
315 (version "1.17.2")
316 (source
317 (origin
318 (method git-fetch)
319 (uri (git-reference
320 (url "https://github.com/quil-lang/qvm")
321 (commit (string-append "v" version))))
322 (file-name (git-file-name "cl-qvm" version))
323 (sha256
324 (base32 "1cvmkqfcy7rv5jlim4kh4dvqhd3jk6mw1kwrphaqghjymrf72yp8"))))
325 (build-system asdf-build-system/sbcl)
326 (outputs '("out" "bin"))
327 (inputs
328 (list sbcl-abstract-classes
329 sbcl-alexandria
330 sbcl-cffi
331 sbcl-cl-quil
332 sbcl-global-vars
333 sbcl-ieee-floats
334 sbcl-lparallel
335 sbcl-magicl
336 sbcl-mt19937
337 sbcl-static-vectors
338 sbcl-trivial-features
339 sbcl-trivial-garbage
340
341 ;; qvm-app
342 sbcl-cl-syslog
343 sbcl-command-line-arguments
344 sbcl-hunchentoot
345 sbcl-slime-swank
346 sbcl-trivial-benchmark))
347 (arguments
348 (list
349 #:asd-systems ''("qvm" "qvm-app")
350 #:tests? #f
351 #:phases
352 #~(modify-phases %standard-phases
353 (add-after 'unpack 'remove-git-dependency
354 (lambda _
355 (substitute* "app/src/qvm-app-version.lisp"
356 (("\\(git-hash '#:qvm-app\\)")
357 "\"unknown\""))))
358 (add-after 'unpack 'fix-build
359 (lambda _
360 ;; Don't use symbol that doesn't exists in swank 2.31.
361 (substitute* "app/src/entry-point.lisp"
362 (("\\(defvar swank:\\*use-dedicated-output-stream\\*\\)")
363 "")
364 (("\\(setf swank:\\*use-dedicated-output-stream\\* nil\\)")
365 ""))))
366 (add-after 'create-asdf-configuration 'build-program
367 (lambda* (#:key outputs #:allow-other-keys)
368 (build-program (string-append (assoc-ref outputs "bin")
369 "/bin/qvm")
370 outputs
371 #:dependencies '("qvm-app")
372 #:entry-program '((qvm-app::asdf-entry-point))
373 #:compress? #t))))))
374 (synopsis "Quil simulator")
375 (description
376 "This is the official Quil-Lang Quantum Virtual Machine (QVM),
377a flexible and efficient simulator for Quil.")
378 (home-page "https://github.com/quil-lang/qvm")
379 (license (list license:asl2.0
380 license:agpl3))))
381
382(define-public cl-qvm
383 (sbcl-package->cl-source-package sbcl-qvm))