projects/guix·blob java-team · refs

863 lines · 35.3 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2022–2024 Liliana Marie Prikler <[email protected]>
3;;; Copyright © 2023 Simon Tournier <[email protected]>
4;;; Copyright © 2023 David Elsing <[email protected]>
5;;; Copyright © 2024-2025 Ricardo Wurmus <[email protected]>
6;;; Copyright © 2025 Hugo Buddelmeijer <[email protected]>
7;;;
8;;; This file is part of GNU Guix.
9;;;
10;;; GNU Guix is free software; you can redistribute it and/or modify it
11;;; under the terms of the GNU General Public License as published by
12;;; the Free Software Foundation; either version 3 of the License, or (at
13;;; your option) any later version.
14;;;
15;;; GNU Guix is distributed in the hope that it will be useful, but
16;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
19;;;
20;;; You should have received a copy of the GNU General Public License
21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23(define-module (gnu packages potassco)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (gnu packages)
26 #:use-module (guix gexp)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix gexp)
31 #:use-module (guix utils)
32 #:use-module (guix build-system cmake)
33 #:use-module (guix build-system emacs)
34 #:use-module (guix build-system pyproject)
35 #:use-module (gnu packages algebra)
36 #:use-module (gnu packages bison)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages cpp)
39 #:use-module (gnu packages graphviz)
40 #:use-module (gnu packages libffi)
41 #:use-module (gnu packages lua)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages python)
44 #:use-module (gnu packages python-build)
45 #:use-module (gnu packages python-web)
46 #:use-module (gnu packages python-xyz)
47 #:use-module (gnu packages compiler-tools)
48 #:use-module (gnu packages sphinx))
49
50(define-public libpotassco
51 ;; No public release, update together with clasp
52 (let ((revision "3")
53 (commit "2eecf5f066fe1f77c9122547f7e07ba1e8c1dcdf"))
54 (package
55 (name "libpotassco")
56 (version (git-version "0.0" revision commit))
57 (source (origin
58 (method git-fetch)
59 (uri (git-reference
60 (url "https://github.com/potassco/libpotassco")
61 (commit commit)))
62 (file-name (git-file-name name version))
63 (modules '((guix build utils)))
64 (snippet
65 #~(begin
66 (delete-file "tests/catch.hpp")
67 (substitute* (find-files "tests" "\\.cpp")
68 (("\"catch.hpp\"") "<catch/catch.hpp>"))))
69 (sha256
70 (base32
71 "0l502qcpwnnpa84hg7vynicpqp3mvivw150jlywqdp1g1irwnh7j"))))
72 (arguments
73 `(#:configure-flags '("-DLIB_POTASSCO_BUILD_TESTS=on"
74 "-DLIB_POTASSCO_INSTALL_LIB=on"
75 "-DBUILD_SHARED_LIBS=on")
76 #:phases
77 (modify-phases %standard-phases
78 (add-after 'unpack 'patch-cmake
79 (lambda _
80 (substitute* "CMakeLists.txt"
81 ;; clasp expects lowercase potassco and include directory is
82 ;; lowercase as well, so let's use that
83 (("\"cmake/Potassco\"") "\"cmake/potassco\"")
84 (("PotasscoConfig\\.cmake") "potassco-config.cmake")
85 (("PotasscoConfigVersion\\.cmake")
86 "potassco-config-version.cmake"))
87 (rename-file "cmake/PotasscoConfig.cmake.in"
88 "cmake/potassco-config.cmake.in"))))))
89 (build-system cmake-build-system)
90 (native-inputs (list catch2-1))
91 (home-page "https://potassco.org/")
92 (synopsis "Utility library for Potassco's projects")
93 (description "@code{libpotassco} is a utility library providing functions
94and datatypes for
95@itemize
96@item parsing, writing, and converting logic programs in aspif and smodels
97format,
98@item passing information between a grounder and a solver,
99@item and defining and parsing command-line options and for creating
100command-line applications.
101@end itemize
102Furthermore, it comes with the tool @command{lpconvert} that converts either
103between aspif and smodels format or to a human-readable text format.")
104 (license license:expat))))
105
106(define-public clasp
107 (package
108 (name "clasp")
109 (version "3.4.1")
110 (source (origin
111 (method git-fetch)
112 (uri (git-reference
113 (url "https://github.com/potassco/clasp")
114 (commit (string-append "v" version))))
115 (file-name (git-file-name name version))
116 (patches (search-patches "clasp-hide-event-ids.patch"))
117 (sha256
118 (base32
119 "1pm75dqp3j5kb69wzpj4a435hx7ks34dcq9qf3cr90zxb1y2w7q9"))))
120 (build-system cmake-build-system)
121 (arguments
122 `(#:configure-flags '("-DCLASP_BUILD_TESTS=on"
123 "-DCLASP_INSTALL_LIB=on"
124 "-DCLASP_USE_LOCAL_LIB_POTASSCO=off"
125 "-DBUILD_SHARED_LIBS=on")
126 #:phases
127 (modify-phases %standard-phases
128 (add-after 'unpack 'patch-cmake
129 (lambda _
130 (substitute* "CMakeLists.txt"
131 ;; Use lowercase to be consistent with libpotassco
132 (("\"cmake/Clasp\"") "\"cmake/clasp\"")
133 (("ClaspConfig\\.cmake") "clasp-config.cmake")
134 (("ClaspConfigVersion\\.cmake")
135 "clasp-config-version.cmake"))
136 (substitute* "cmake/ClaspConfig.cmake.in"
137 (("find_package\\(Potassco") "find_package(potassco"))
138 (rename-file "cmake/ClaspConfig.cmake.in"
139 "cmake/clasp-config.cmake.in"))))))
140 (inputs
141 (list libpotassco))
142 (home-page "https://potassco.org/")
143 (synopsis "Answer set solver")
144 (description "clasp is an answer set solver for (extended) normal and
145disjunctive logic programs. The primary algorithm of clasp relies on
146conflict-driven nogood learning, a technique that proved very successful for
147satisfiability checking (SAT).")
148 (license license:expat)))
149
150(define-public clingo
151 (package
152 (name "clingo")
153 (version "5.8.2")
154 (source (origin
155 (method git-fetch)
156 (uri (git-reference
157 (url "https://github.com/potassco/clingo")
158 (commit (string-append "v" version))))
159 (file-name (git-file-name name version))
160 (modules '((guix build utils)))
161 (snippet
162 #~(begin
163 (delete-file-recursively "clasp")
164 (delete-file-recursively "libgringo/gen")
165 (delete-file-recursively "third_party")
166 (delete-file "libpyclingo/_clingo.c")))
167 (sha256
168 (base32
169 "1ygzcqb66nr875cw14hkh9r768nchr5iwwzxqpqivz6fvhlwmzci"))))
170 (build-system cmake-build-system)
171 (arguments
172 (list
173 #:tests? #f
174 #:configure-flags #~`("-DCLINGO_BUILD_TESTS=on"
175 "-DCLINGO_INSTALL_LIB=on"
176 "-DCLINGO_BUILD_STATIC=off"
177 "-DCLINGO_BUILD_SHARED=on"
178 "-DCLINGO_USE_LOCAL_CLASP=off"
179 "-DCLINGO_USE_LOCAL_CATCH=off")
180 #:phases
181 #~(modify-phases %standard-phases
182 (add-after 'unpack 'patch-cmake
183 (lambda _
184 (substitute* "CMakeLists.txt"
185 (("add_subdirectory\\(clasp\\)")
186 "find_package(clasp REQUIRED)")
187 (("add_subdirectory\\(third_party\\)")
188 (string-append
189 "find_package(tsl-hopscotch-map)\n"
190 "find_package(tl-optional)\n"
191 "find_package(mpark_variant)\n"
192 "find_package(tsl-sparse-map)\n"
193 "find_package(tsl-ordered-map)\n"
194 "find_package(wide-integer)\n"
195 "find_package(Catch2 3 REQUIRED)")))
196 (substitute* "libclingo/CMakeLists.txt"
197 (("\"cmake/Clingo\"") "\"cmake/clingo\"")
198 (("ClingoConfig\\.cmake") "clingo-config.cmake")
199 (("ClingoConfigVersion\\.cmake")
200 "clingo-config-version.cmake"))
201 (substitute* "libgringo/CMakeLists.txt"
202 (("mpark::variant") "mpark_variant")
203 (("math::wide_integer") "wide-integer::wide-integer"))
204 (substitute* "cmake/ClingoConfig.cmake.in"
205 (("find_package\\(Clasp") "find_package(clasp"))
206 (rename-file "cmake/ClingoConfig.cmake.in"
207 "cmake/clingo-config.cmake.in"))))))
208 (inputs (list catch2 clasp libpotassco))
209 (native-inputs (list bison re2c
210 mpark-variant
211 pkg-config
212 tl-optional
213 tsl-hopscotch-map
214 tsl-ordered-map
215 tsl-sparse-map
216 wide-integer))
217 (home-page "https://potassco.org/")
218 (synopsis "Grounder and solver for logic programs")
219 (description "Clingo computes answer sets for a given logic program.")
220 (license license:expat)))
221
222(define-public clingo-dl
223 (package
224 (name "clingo-dl")
225 (version "1.5.0")
226 (source (origin
227 (method git-fetch)
228 (uri (git-reference
229 (url "https://github.com/potassco/clingo-dl")
230 (commit (string-append "v" version))))
231 (file-name (git-file-name name version))
232 (sha256
233 (base32 "0vf51pgwgiac801gr6w5pnxb6wa0kacz09ncrcn25w5siz17g4si"))))
234 (build-system cmake-build-system)
235 (arguments (list #:tests? #f ; no tests
236 #:configure-flags #~`("-DPYCLINGODL_ENABLE=off")))
237 (inputs (list clingo))
238 (home-page "https://github.com/potassco/clingo-dl")
239 (synopsis "Solver for answer set programs modulo difference constraints")
240 (description "Clingo-DL is an extension to Clingo that models constraints
241over difference logic.")
242 (license license:expat)))
243
244(define-public clingo-lpx
245 (package
246 (name "clingo-lpx")
247 (version "1.3.0")
248 (source (origin
249 (method git-fetch)
250 (uri (git-reference
251 (url "https://github.com/potassco/clingo-lpx")
252 (commit (string-append "v" version))))
253 (file-name (git-file-name name version))
254 (modules '((guix build utils)))
255 (snippet
256 #~(begin
257 (delete-file-recursively "third_party")))
258 (sha256
259 (base32
260 "1i184gy18k0mpqywbgziwl5wzkwwcdks81axndk4x6hjy878vhww"))))
261 (build-system cmake-build-system)
262 (arguments
263 (list #:configure-flags #~(list "-DCLINGOLPX_BUILD_TESTS=on"
264 "-DPYCLINGOLPX_ENABLE=off")
265 #:phases
266 #~(modify-phases %standard-phases
267 (add-after 'unpack 'patch-cmake
268 (lambda _
269 (substitute* "CMakeLists.txt"
270 (("add_subdirectory\\(third_party\\)")
271 "find_package(Catch2 3 REQUIRED)")))))))
272 (home-page "https://github.com/potassco/clingo-lpx")
273 (inputs (list clingo flint))
274 (native-inputs (list catch2))
275 (synopsis "Simplex solver")
276 (description "Clingo-LPX is an extension to Clingo that models constraints
277and goals over linear (in)equations.")
278 (license license:expat)))
279
280(define-public clingcon
281 (package
282 (name "clingcon")
283 (version "5.2.1")
284 (source (origin
285 (method git-fetch)
286 (uri (git-reference
287 (url "https://github.com/potassco/clingcon")
288 (commit (string-append "v" version))))
289 (file-name (git-file-name name version))
290 (modules '((guix build utils)))
291 (snippet
292 #~(begin
293 (delete-file-recursively "third_party")))
294 (sha256
295 (base32
296 "0050qp5gpznigpm743br8yhjg62gl739xmzkfr70hlqm1xrj0sa7"))))
297 (build-system cmake-build-system)
298 (arguments
299 (list #:tests? #f
300 #:phases
301 #~(modify-phases %standard-phases
302 (add-after 'unpack 'patch-cmake
303 (lambda _
304 (substitute* "CMakeLists.txt"
305 (("add_subdirectory\\(third_party\\)")
306 "find_package(Catch2 3 REQUIRED)"))
307 ;; We use libwide-integer as a header-only library, so there
308 ;; is no library to link
309 (substitute* "libclingcon/CMakeLists.txt"
310 (("target_link_libraries\\(.* libwide-integer\\)" all)
311 (string-append "#" all))))))))
312 (home-page "https://potassco.org/clingcon")
313 (inputs (list clingo wide-integer))
314 (native-inputs (list catch2))
315 (synopsis "Constraint answer set solver")
316 (description "Clingcon is an answer set solver for constraint logic
317It extends Clingo with constraint solving capacities for constraints over
318finite domain integer variables, using techniques from the area of SMT,
319like conflict-driven learning and theory propagation.")
320 (license license:expat)))
321
322(define-public plasp
323 (package
324 (name "plasp")
325 (version "3.1.1")
326 (source (origin
327 (method git-fetch)
328 (uri (git-reference
329 (url "https://github.com/potassco/plasp")
330 (commit (string-append "v" version))))
331 (file-name (git-file-name name version))
332 (sha256
333 (base32 "123v1bjzh7yjwgcc5k55rkfz0lfl8ish5p3z8x3pn8k1svd50xal"))
334 (patches (search-patches
335 "plasp-fix-normalization.patch"
336 "plasp-include-iostream.patch"))))
337 (build-system cmake-build-system)
338 (arguments
339 (list #:tests? #f ; No ‘test’ target
340 #:phases
341 #~(modify-phases %standard-phases
342 (replace 'install
343 (lambda* (#:key outputs #:allow-other-keys)
344 (copy-recursively "bin"
345 (string-append (assoc-ref outputs "out")
346 "/bin")))))))
347 (inputs (list cxxopts mapbox-variant))
348 (home-page "https://potassco.org/")
349 (synopsis "ASP planning tools for PDDL")
350 (description "@command{plasp} is a tool collection for planning in
351answer set programming. It supports a subset of PDDL 3.1 and SAS 3.")
352 (license license:expat)))
353
354(define-public emacs-pasp-mode
355 (let ((commit "59385eb0e8ebcfc8c11dd811fb145d4b0fa3cc92")
356 (revision "1"))
357 (package
358 (name "emacs-pasp-mode")
359 (version (git-version "0.1.0" revision commit))
360 (source (origin
361 (method git-fetch)
362 (uri (git-reference
363 (url "https://github.com/santifa/pasp-mode")
364 (commit commit)))
365 (file-name (git-file-name name version))
366 (patches
367 (search-patches "emacs-pasp-mode-quote-file-names.patch"))
368 (sha256
369 (base32
370 "1ar4vws3izzmir7m870mccci620ns3c5j26dcmwaxavhgw45wcmf"))))
371 (build-system emacs-build-system)
372 (arguments
373 (list
374 #:phases
375 #~(modify-phases %standard-phases
376 (add-after 'unpack 'defconst-version
377 (lambda _
378 (emacs-batch-edit-file "pasp-mode.el"
379 '(progn
380 (search-forward-regexp "(defcustom pasp-mode-version")
381 (forward-sexp)
382 (kill-sexp)
383 (backward-sexp)
384 (beginning-of-line)
385 (kill-sexp)
386 (insert (format "(defconst emacs-pasp-version \"%s\" %s)"
387 #$version (cadr kill-ring)))
388 (basic-save-buffer)))))
389 (add-after 'unpack 'hardcode-clingo
390 (lambda* (#:key inputs #:allow-other-keys)
391 (emacs-substitute-variables "pasp-mode.el"
392 ("pasp-clingo-path"
393 (search-input-file inputs "/bin/clingo"))))))))
394 (inputs (list clingo))
395 (home-page "https://github.com/santifa/pasp-mode")
396 (synopsis "Major mode for editing answer set programs")
397 (description
398 "This package provides a major mode for editing answer set programs,
399in particular ones that can be solved by @command{clingo}.")
400 (license license:gpl3+))))
401
402(define-public (make-lua-clingo name lua)
403 (package
404 (inherit clingo)
405 (name name)
406 (version (package-version clingo)) ; for #$version in arguments
407 (arguments
408 (substitute-keyword-arguments arguments
409 ((#:configure-flags flags #~'())
410 #~(cons* "-DCLINGO_BUILD_WITH_LUA=yes"
411 (string-append "-DLUACLINGO_INSTALL_DIR="
412 #$output "/lib/lua/"
413 #$(package-version lua))
414 "-DCLINGO_USE_LIB=yes"
415 #$flags))))
416 (inputs (list clingo lua))
417 (synopsis "Lua bindings for clingo")
418 (description "This package provides Lua bindings to the clingo package,
419making it so that you can write @acronym{ASPs, Answer Set Programs} through
420Lua code.")))
421
422(define-public lua5.1-clingo (make-lua-clingo "lua5.1-clingo" lua-5.1))
423(define-public lua5.2-clingo (make-lua-clingo "lua5.2-clingo" lua-5.2))
424
425(define-public python-clingo
426 (package
427 (inherit clingo)
428 (name "python-clingo")
429 (version (package-version clingo)) ; for #$version in arguments
430 (arguments
431 (substitute-keyword-arguments arguments
432 ((#:configure-flags flags #~'())
433 #~(cons* "-DCLINGO_BUILD_WITH_PYTHON=pip"
434 (string-append "-DCMAKE_MODULE_PATH="
435 #$(this-package-native-input "python-scikit-build")
436 "/lib/cmake/modules")
437 "-DCLINGO_USE_LIB=yes"
438 #$flags))
439 ((#:imported-modules _ '())
440 (append %cmake-build-system-modules
441 %pyproject-build-system-modules))
442 ((#:modules _ '())
443 '((guix build cmake-build-system)
444 ((guix build pyproject-build-system) #:prefix python:)
445 (guix build utils)))
446 ((#:phases phases #~%standard-phases)
447 #~(modify-phases #$phases
448 (add-after 'unpack 'generate-sources
449 (lambda _
450 (with-directory-excursion "libpyclingo"
451 (invoke "python" "compile.py" "c"))))
452 (add-after 'install 'install-distinfo
453 (lambda* (#:key inputs outputs #:allow-other-keys)
454 (with-directory-excursion (python:site-packages inputs outputs)
455 (let ((dir (string-append "clingo-" #$version ".dist-info")))
456 (mkdir-p dir)
457 (call-with-output-file (string-append dir "/METADATA")
458 (lambda (port)
459 (format port "Metadata-Version: 1.1~%")
460 (format port "Name: clingo~%")
461 (format port "Version: ~a~%" #$version)))))))))))
462 (inputs (list clingo python-wrapper))
463 (propagated-inputs (list python-cffi))
464 (native-inputs (modify-inputs native-inputs
465 (prepend python-scikit-build)))
466 (synopsis "Python bindings for clingo")
467 (description "This package provides Python bindings to the clingo package,
468making it so that you can write @acronym{ASPs, Answer Set Programs} through
469Python code.")))
470
471(define-public python-clingo-dl
472 (package
473 (inherit clingo-dl)
474 (name "python-clingo-dl")
475 (version (package-version clingo-dl))
476 (arguments
477 (list
478 #:configure-flags
479 #~(list "-DPYCLINGODL_ENABLE=pip"
480 (string-append "-DCMAKE_MODULE_PATH="
481 #$(this-package-native-input "python-scikit-build")
482 "/lib/cmake/modules"))
483 #:tests? #f
484 #:imported-modules (append %cmake-build-system-modules
485 %pyproject-build-system-modules)
486 #:modules '((guix build cmake-build-system)
487 ((guix build pyproject-build-system) #:prefix python:)
488 (guix build utils))
489 #:phases
490 #~(modify-phases %standard-phases
491 (add-after 'install 'install-distinfo
492 (lambda* (#:key inputs outputs #:allow-other-keys)
493 (with-directory-excursion (python:site-packages inputs outputs)
494 (let ((dir (string-append "clingodl-" #$version ".dist-info")))
495 (mkdir-p dir)
496 (call-with-output-file (string-append dir "/METADATA")
497 (lambda (port)
498 (format port "Metadata-Version: 1.1~%")
499 (format port "Name: clingodl~%")
500 (format port "Version: ~a~%" #$version))))))))))
501 (inputs (modify-inputs inputs
502 (prepend python-wrapper)))
503 (propagated-inputs (list python-clingo python-cffi))
504 (native-inputs (modify-inputs native-inputs
505 (prepend python-scikit-build)))
506 (synopsis "Python bindings for clingo-dl")
507 (description "This package allows users to add the clingo-dl propagator
508as a theory to clingo from Python code. It also supports running clingo-dl
509directly from the python command line.")))
510
511(define-public python-clingcon
512 (package
513 (inherit clingcon)
514 (name "python-clingcon")
515 (version (package-version clingcon))
516 (arguments
517 (cons*
518 #:configure-flags
519 #~(list "-DPYCLINGCON_ENABLE=pip"
520 (string-append "-DCMAKE_MODULE_PATH="
521 #$(this-package-native-input "python-scikit-build")
522 "/lib/cmake/modules"))
523 #:imported-modules (append %cmake-build-system-modules
524 %pyproject-build-system-modules)
525 #:modules '((guix build cmake-build-system)
526 ((guix build pyproject-build-system) #:prefix python:)
527 (guix build utils))
528 (substitute-keyword-arguments arguments
529 ((#:phases phases)
530 #~(modify-phases #$phases
531 (add-after 'install 'install-distinfo
532 (lambda* (#:key inputs outputs #:allow-other-keys)
533 (with-directory-excursion (python:site-packages inputs outputs)
534 (let ((dir (string-append "clingcon-" #$version ".dist-info")))
535 (mkdir-p dir)
536 (call-with-output-file (string-append dir "/METADATA")
537 (lambda (port)
538 (format port "Metadata-Version: 1.1~%")
539 (format port "Name: clingcon~%")
540 (format port "Version: ~a~%" #$version))))))))))))
541 (inputs (modify-inputs inputs
542 (prepend python-wrapper)))
543 (propagated-inputs (list python-clingo python-cffi))
544 (native-inputs (modify-inputs native-inputs
545 (prepend python-scikit-build)))
546 (synopsis "Python bindings for clingcon")
547 (description "This package allows users to add the clingcon propagator
548as a theory to clingo from Python code.")))
549
550(define-public python-clingox
551 (package
552 (name "python-clingox")
553 (version "1.2.1")
554 (source
555 (origin
556 (method git-fetch)
557 (uri (git-reference
558 (url "https://github.com/potassco/python-clingox")
559 (commit (string-append "v" version))))
560 (file-name (git-file-name name version))
561 (sha256
562 (base32 "0ji0sdqlv0byxmdipwk60afsb82r0rr1j73r7j2508hsfk94m2i8"))))
563 (build-system pyproject-build-system)
564 (arguments
565 (list
566 #:test-flags
567 ;; fixture 's' not found
568 #~(list "--deselect=clingox/tests/test_ast.py::test_rename"
569 "--deselect=clingox/tests/test_ast.py::test_reify"
570 "--deselect=clingox/tests/test_ast.py::test_ast_dict")))
571 (native-inputs
572 (list python-pytest
573 python-setuptools
574 python-wheel))
575 (propagated-inputs (list python-clingo))
576 (home-page "https://potassco.org/clingo")
577 (synopsis "Auxiliary functions for Clingo")
578 (description
579 "This package provides additional functions to go along with the Python
580bindings for Clingo.")
581 (license license:expat)))
582
583(define-public python-asprin
584 (let ((revision "1")
585 (commit "bc5a0cf7d9ba346cf91cba66282b5946dbf1331c"))
586 (package
587 (name "python-asprin")
588 (version (git-version "3.1.1" revision commit))
589 (source (origin
590 (method git-fetch)
591 (uri (git-reference
592 (url "https://github.com/potassco/asprin")
593 (commit commit)))
594 (file-name (git-file-name name version))
595 (sha256
596 (base32
597 "0rf8yjdlpkvzp9917fvhfrrzag47vvfm7j2k5g44w1ggqyrz8fps"))))
598 (build-system pyproject-build-system)
599 (arguments
600 (list
601 #:phases
602 #~(modify-phases %standard-phases
603 (add-after 'unpack 'fix-source
604 (lambda* (#:key inputs #:allow-other-keys)
605 (substitute* "asprin/src/solver/metasp/reify.py"
606 (("\"clingo\"")
607 (string-append "\""
608 (search-input-file inputs "bin/clingo")
609 "\"")))))
610 (replace 'check
611 (lambda* (#:key tests? #:allow-other-keys)
612 (when tests?
613 (invoke "python" "build/lib/asprin/asprin.py" "--test")))))))
614 (native-inputs
615 (list python-setuptools))
616 (inputs
617 (list clingo))
618 (propagated-inputs
619 (list python-clingo))
620 (home-page "https://potassco.org/")
621 (synopsis "Optimization in Answer Set Programming")
622 (description "@command{asprin} is a general framework for optimization in
623@acronym{ASP, Answer Set Programming}, that allows for computing optimal
624stable models of logic programs by means of preferences. Some preference types
625are already predefined, but more can be added as logic programs.")
626 (license license:expat))))
627
628(define-public python-clorm
629 (package
630 (name "python-clorm")
631 (version "1.6.3")
632 (source
633 (origin
634 (method git-fetch)
635 (uri (git-reference
636 (url "https://github.com/potassco/clorm")
637 (commit (string-append "v" version))))
638 (file-name (git-file-name name version))
639 (sha256
640 (base32 "14n0x59cvb9m4sc0byilljwlvyzl5sj3bh0ss9jcg8y2l3k7b90k"))))
641 (build-system pyproject-build-system)
642 (arguments
643 (list
644 #:test-backend #~'unittest
645 #:phases
646 #~(modify-phases %standard-phases
647 (add-before 'check 'fix-breaking-tests
648 (lambda _
649 ;; noclingo tests rely on this being set
650 (setenv "CLORM_NOCLINGO" "1")
651 (delete-file "tests/test_mypy_query.py"))))))
652 (propagated-inputs (list python-clingo))
653 (native-inputs (list python-setuptools))
654 (home-page "https://potassco.org")
655 (synopsis "Object relational mapping to clingo")
656 (description "@acronym{Clorm, Clingo ORM} provides an @acronym{ORM,
657Object Relational Mapping} interface to the @acronym{ASP, answer set
658programming} solver clingo. Its goal is to make integration of clingo
659into Python programs easier.")
660 (license license:expat)))
661
662(define-public python-plingo
663 (package
664 (name "python-plingo")
665 (version "1.1.0")
666 (source (origin
667 (method git-fetch)
668 (uri (git-reference
669 (url "https://github.com/potassco/plingo")
670 (commit (string-append "v" version))))
671 (file-name (git-file-name name version))
672 (sha256
673 (base32
674 "0bdz755c6isp29layvzsw9c4kr12x7b5d8ip37ay3cl4dlq4bid3"))))
675 (build-system pyproject-build-system)
676 (arguments
677 (list #:tests? #f ;there are no tests
678 #:phases
679 #~(modify-phases %standard-phases
680 (add-after 'install 'install-script
681 (lambda* (#:key outputs #:allow-other-keys)
682 (let ((script (string-append (assoc-ref outputs "out")
683 "/bin/plingo")))
684 (mkdir-p (dirname script))
685 (call-with-output-file script
686 (lambda (port)
687 (display "#!/usr/bin/env python\n" port)
688 (display "from plingo import main\n" port)
689 (display "main()\n" port)))
690 (chmod script #o755)
691 ;; XXX: Does this cross-compile?
692 (patch-shebang script)))))))
693 (propagated-inputs (list python-clingo))
694 (native-inputs (list python-setuptools))
695 (home-page "https://potassco.org/")
696 (synopsis "Solve probabilistic logic programs")
697 (description "This package provides a system to solve probabilistic
698logic programs with clingo. It can solve the reasoning tasks of finding
699the most probable model as well as finding all models and their probabilities.")
700 (license license:expat)))
701
702(define-public python-telingo
703 (package
704 (name "python-telingo")
705 (version "2.1.3")
706 (source
707 (origin
708 (method git-fetch)
709 (uri (git-reference
710 (url "https://github.com/potassco/telingo")
711 (commit (string-append "v" version))))
712 (file-name (git-file-name name version))
713 (sha256
714 (base32 "1q6hlh4b5hsa4n5agvmfa9rhsxfd2g6kpl4b9kfccwbmf6dh51k6"))))
715 (build-system pyproject-build-system)
716 (propagated-inputs (list python-clingo))
717 (native-inputs (list python-pytest python-setuptools))
718 (home-page "https://potassco.org/")
719 (synopsis "Solve dynamic temporal logic programs")
720 (description "This package provides a system to solve dynamic temporal
721logic programs based on clingo.")
722 (license license:expat)))
723
724(define-public python-clingraph
725 (package
726 (name "python-clingraph")
727 (version "1.2.1")
728 (source (origin
729 (method git-fetch)
730 (uri (git-reference
731 (url "https://github.com/potassco/clingraph")
732 (commit (string-append "v" version))))
733 (file-name (git-file-name name version))
734 (sha256
735 (base32
736 "0zc7v5lzdrfp54j42rcc9znmw3nblq8mj6cg094bycnygrqqsdip"))))
737 (build-system pyproject-build-system)
738 (inputs (list dot2tex graphviz))
739 (propagated-inputs (list python-clingo
740 python-clorm
741 python-graphviz
742 python-imageio
743 python-jinja2
744 python-jsonschema
745 python-networkx
746 python-setuptools))
747 (native-inputs (list dot2tex graphviz python-pytest python-wheel))
748 (home-page "https://github.com/potassco/clingraph")
749 (synopsis "Visualizer for graphs defined as logic programs")
750 (description
751 "This package provides a clingo-based visualizer for graphs defined
752as logic programs.")
753 (license license:expat)))
754
755(define-public python-clinguin
756 (package
757 (name "python-clinguin")
758 (version "2.8.5")
759 (source (origin
760 (method git-fetch)
761 (uri (git-reference
762 (url "https://github.com/potassco/clinguin")
763 (commit (string-append "v" version))))
764 (file-name (git-file-name name version))
765 (sha256
766 (base32
767 "18a9y50vdf53316b5c9a5zxf2nzz72h94m35hfp4i8vh73y79bcx"))
768 (modules '((guix build utils)))
769 (snippet
770 #~(begin
771 (substitute* "setup.cfg"
772 ;; Fun fact of the day
773 ;; some typo squatter hosted
774 ;; a package named tk
775 (("tk") "")
776 ;; XXX: python-clingo-dl installs clingodl instead…
777 (("clingo-dl") "clingodl"))))))
778 (build-system pyproject-build-system)
779 (native-inputs
780 (list python-pytest
781 python-setuptools))
782 (propagated-inputs
783 (list python-clingo
784 python-clingo-dl
785 python-clingcon
786 python-clorm
787 python-clingexplaid
788 python-clingraph
789 python-fastapi
790 python-httpx
791 python-nbconvert
792 python-nbformat
793 python-nbsphinx
794 python-networkx
795 python-pillow
796 python-pydantic
797 `(,python "tk")
798 python-sphinx-rtd-theme
799 python-traitlets
800 python-uvicorn))
801 (home-page "https://github.com/potassco/clinguin")
802 (synopsis "Clingo-based interactive UI")
803 (description "Clinguin is a graphical user interface toolkit for clingo,
804which allows user interfaces to be specified entirely as a logic program.")
805 (license license:expat)))
806
807(define-public python-clintest
808 (package
809 (name "python-clintest")
810 (version "0.5.0")
811 (source (origin
812 (method git-fetch)
813 (uri (git-reference
814 (url "https://github.com/potassco/clintest")
815 (commit (string-append "v" version))))
816 (file-name (git-file-name name version))
817 (sha256
818 (base32
819 "1g23j4nbhpf5lnbjz4i34ihhzb76b4a2jiwdzapxyvnv4h4krafa"))))
820 (build-system pyproject-build-system)
821 (propagated-inputs (list python-clingo))
822 (native-inputs (list python-pytest python-setuptools python-wheel))
823 (home-page "https://potassco.org/clintest/")
824 (synopsis "Test framework for clingo programs")
825 (description "Clintest is a framework for unit testing clingo programs.
826It provides various components to assemble the most commonly used tests quickly,
827but also works fine along custom-built test. Clintest monitors the test
828outcome while solving to abort the search for solutions once the outcome is
829certain.")
830 (license license:expat)))
831
832(define-public python-clingexplaid
833 (package
834 (name "python-clingexplaid")
835 (version "1.4.0")
836 (source (origin
837 (method git-fetch)
838 (uri (git-reference
839 (url "https://github.com/potassco/clingo-explaid")
840 (commit (string-append "v" version))))
841 (file-name (git-file-name name version))
842 (sha256
843 (base32 "0awdphcmjls3n6srh2sj83g54gyqbf8fwc496giq7n3kjah70iwj"))))
844 (build-system pyproject-build-system)
845 (arguments
846 (list #:test-flags #~(list "-k" "not test_main")
847 #:phases #~(modify-phases %standard-phases
848 (add-after 'unpack 'fix-pyproject-toml
849 (lambda _
850 (substitute* "pyproject.toml"
851 (("dynamic = .*" all)
852 (string-append "version = \""
853 #$version
854 "\"\n"))
855 (("\"autoflake\",") "")))))))
856 (propagated-inputs (list python-clingo))
857 (native-inputs (list python-pytest python-setuptools python-wheel))
858 (home-page "https://github.com/potassco/clingo-explaid")
859 (synopsis "Develop explanation systems with Clingo")
860 (description "This package provides tools to develop explanation systems
861with clingo. It allows extracting minimal unsatisfiable subsets and
862unsatisfiable constraints.")
863 (license license:expat)))