;; manifest.scm -- Acoused GNU Guix manifest
;; Copyright (C) 2024  INRAE
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

(use-modules (guix packages))
(use-modules (guix download))
(use-modules (guix transformations))
(use-modules (guix build-system python))
(use-modules (guix build-system pyproject))
(use-modules (guix licenses))

(use-modules (gnu packages python))
(use-modules (gnu packages python-build))
(use-modules (gnu packages python-xyz))
(use-modules (gnu packages python-check))
(use-modules (gnu packages serialization))
(use-modules (gnu packages version-control))
(use-modules (gnu packages astronomy))
(use-modules (gnu packages check))
(use-modules (gnu packages qt))

;;; python-numba has non-deterministic test failure :
;;; https://issues.guix.gnu.org/76260

;;; We replace python-numba package by package variant without tests

(define python-numba-no-check
  (package
    (inherit python-numba)
    (arguments `(#:tests? #f))))

(define rewrite-numba
  (package-input-rewriting/spec `(("python-numba" .
                                   ,(const python-numba-no-check)))))


;;; New packages

(define-public python-simplepyqt5
  (package
    (name "python-simplepyqt5")
    (version "0.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "simplePyQt5" version))
       (sha256
        (base32 "0c7a77q64m54gyxxnkn2r18wf764f3d6fqp76nz6phpzqvzk99z4"))))
    (build-system pyproject-build-system)
    (propagated-inputs (list python-pyqt))
    (native-inputs (list python-setuptools python-wheel))
    (home-page "https://github.com/yjg30737/simplePyQt5.git")
    (synopsis "simple PyQt5")
    (description "simple @code{PyQt5}.")
    (license expat)))

(define-public python-pyqt-files-already-exists-dialog
  (package
    (name "python-pyqt-files-already-exists-dialog")
    (version "0.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "pyqt-files-already-exists-dialog" version))
       (sha256
        (base32 "0i1jamzgh6hfd0ic3wifcwqn01ygd15rbkrgziay0cvysnlyk8y9"))))
    (build-system pyproject-build-system)
    (propagated-inputs (list python-pyqt python-simplepyqt5))
    (native-inputs (list python-setuptools python-wheel))
    (home-page
     "https://github.com/yjg30737/pyqt-files-already-exists-dialog.git")
    (synopsis
     "PyQt files already exists dialog. Like \"These files already exist, Would you add files except for these? (Yes/No)\"")
    (description
     "@code{PyQt} files already exists dialog.  Like \"These files already exist, Would
you add files except for these? (Yes/No)\".")
    (license expat)))

(define-public python-pyqt-tooltip-list-widget
  (package
    (name "python-pyqt-tooltip-list-widget")
    (version "0.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "pyqt-tooltip-list-widget" version))
       (sha256
        (base32 "1lfv3v1bv9isf5gwllgcgg69zivd2j3a9vs97ciysmbbpnmj5dw3"))))
    (build-system pyproject-build-system)
    (propagated-inputs (list python-pyqt))
    (native-inputs (list python-setuptools python-wheel))
    (home-page "https://github.com/yjg30737/pyqt-tooltip-list-widget.git")
    (synopsis
     "PyQt QListWidget which shows text as tooltip longer than widget's size")
    (description
     "@code{PyQt} Q@code{ListWidget} which shows text as tooltip longer than widget's
size.")
    (license expat)))

(define-public python-pyqt-file-list-widget
  (package
    (name "python-pyqt-file-list-widget")
    (version "0.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "pyqt-file-list-widget" version))
       (sha256
        (base32 "1x54jwljnmhg4rng7lmc9ldwmyggawvi81rrz46q9za4zy8baxhg"))))
    (build-system pyproject-build-system)
    (propagated-inputs (list python-pyqt-files-already-exists-dialog
                             python-pyqt-tooltip-list-widget python-pyqt))
    (native-inputs (list python-setuptools python-wheel))
    (home-page "https://github.com/yjg30737/pyqt-file-list-widget.git")
    (synopsis
     "PyQt QListWidget for files (being able to drop the files based on user-defined extensions)")
    (description
     "@code{PyQt} Q@code{ListWidget} for files (being able to drop the files based on
user-defined extensions).")
    (license expat)))

(define-public python-tox-conda
  (package
    (name "python-tox-conda")
    (version "0.10.2")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "tox_conda" version))
       (sha256
        (base32 "1s6543q0wd0rn3rnxlkprixkwhxs3ig405x29gkr2rzlqd1wl4bh"))))
    (build-system pyproject-build-system)
    (arguments `(#:tests? #f))
    (propagated-inputs (list python-ruamel.yaml python-tox))
    (native-inputs (list python-setuptools python-setuptools-scm python-wheel))
    (home-page "https://github.com/tox-dev/tox-conda")
    (synopsis "tox plugin that provides integration with conda")
    (description "tox plugin that provides integration with conda.")
    (license expat)))

(define-public python-types-psutil
  (package
    (name "python-types-psutil")
    (version "7.0.0.20250218")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "types_psutil" version))
       (sha256
        (base32 "176vn07f7fnb8chr6abxl040pn4i8syiqfxjjl128yw3zvd2qr0y"))))
    (build-system pyproject-build-system)
    (native-inputs (list python-setuptools python-wheel))
    (home-page "https://github.com/python/typeshed")
    (synopsis "Typing stubs for psutil")
    (description "Typing stubs for psutil.")
    (license #f)))


(define-public python-qtrangeslider
  (package
    (name "python-qtrangeslider")
    (version "0.1.5")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "QtRangeSlider" version))
       (sha256
        (base32 "04z2d1gqqnviqp4259f01ib34f4p8al7db62sjs0pj7f666dyxak"))))
    (build-system pyproject-build-system)
    (native-inputs (list python-ipython
                         python-isort
                         python-jedi
                         python-mypy
                         python-pre-commit
                         python-pyqt
                         python-pytest
                         python-pytest-cov
                         python-pytest-qt
                         python-setuptools
                         python-setuptools-scm
                         python-tox
                         ;;python-tox-conda
                         python-wheel))
    (arguments `(#:tests? #f))
    (home-page "https://github.com/tlambert03/QtRangeSlider")
    (synopsis "Multi-handle range slider widget for PyQt/PySide")
    (description "Multi-handle range slider widget for @code{PyQt/PySide}.")
    (license bsd-3)))

;;; Manifest

(concatenate-manifests
 (list (packages->manifest (list python-pyqt-file-list-widget
                                 python-qtrangeslider
                                 (rewrite-numba python-astropy)))
       (specifications->manifest
        (list "python" "python-dateutil"
              "python-scipy" "python-scikit-learn"
              "python-pyqt@5" "python-pyqt5-sip"
              "python-numpy@1" "python-pandas@1.5"
              "python-matplotlib" "python-odfpy"))))
