diff options
| author | Ricardo Wurmus <rekado@elephly.net> | 2023-10-19 19:55:55 +0200 |
|---|---|---|
| committer | Ricardo Wurmus <rekado@elephly.net> | 2023-10-19 23:36:03 +0200 |
| commit | ee18bdb7f38967ed6c50dbf36268bd7fb12de85b (patch) | |
| tree | 292ea13ecd05671e80961d86c18675ca13a7f05f | |
| parent | 473dab5ec651065ce614ea9668e862dc3fcd8540 (diff) | |
python: Add python-ml-dtypes.
* guix-science/packages/python.scm (eigen-for-python-ml-dtypes): New
variable.
(python-ml-dtypes): New variable.
| -rw-r--r-- | guix-science/packages/python.scm | 90 |
1 files changed, 82 insertions, 8 deletions
diff --git a/guix-science/packages/python.scm b/guix-science/packages/python.scm index 3dd00cb..6ab6c1d 100644 --- a/guix-science/packages/python.scm +++ b/guix-science/packages/python.scm | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | ;;; | 1 | ;;; |
| 2 | ;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Roel Janssen <roel@gnu.org> | 2 | ;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Roel Janssen <roel@gnu.org> |
| 3 | ;;; Copyright © 2023 Ricardo Wurmus <rekado@elephly.net> | ||
| 3 | ;;; | 4 | ;;; |
| 4 | ;;; This program is free software; you can redistribute it and/or modify it | 5 | ;;; This program is free software; you can redistribute it and/or modify it |
| 5 | ;;; under the terms of the GNU General Public License as published by | 6 | ;;; under the terms of the GNU General Public License as published by |
| @@ -17,23 +18,25 @@ | |||
| 17 | (define-module (guix-science packages python) | 18 | (define-module (guix-science packages python) |
| 18 | #:use-module ((guix licenses) #:prefix license:) | 19 | #:use-module ((guix licenses) #:prefix license:) |
| 19 | #:use-module (gnu packages bioinformatics) | 20 | #:use-module (gnu packages bioinformatics) |
| 21 | #:use-module (gnu packages check) | ||
| 22 | #:use-module (gnu packages compression) | ||
| 23 | #:use-module (gnu packages graph) | ||
| 24 | #:use-module (gnu packages pdf) | ||
| 20 | #:use-module (gnu packages python) | 25 | #:use-module (gnu packages python) |
| 21 | #:use-module (gnu packages python-xyz) | ||
| 22 | #:use-module (gnu packages python-build) | 26 | #:use-module (gnu packages python-build) |
| 27 | #:use-module (gnu packages python-check) | ||
| 28 | #:use-module (gnu packages python-crypto) | ||
| 23 | #:use-module (gnu packages python-science) | 29 | #:use-module (gnu packages python-science) |
| 24 | #:use-module (gnu packages python-web) | 30 | #:use-module (gnu packages python-web) |
| 25 | #:use-module (gnu packages python-crypto) | 31 | #:use-module (gnu packages python-xyz) |
| 26 | #:use-module (gnu packages python-check) | ||
| 27 | #:use-module (gnu packages graph) | ||
| 28 | #:use-module (gnu packages compression) | ||
| 29 | #:use-module (gnu packages statistics) | 32 | #:use-module (gnu packages statistics) |
| 30 | #:use-module (gnu packages pdf) | ||
| 31 | #:use-module (gnu packages check) | ||
| 32 | #:use-module (gnu packages) | 33 | #:use-module (gnu packages) |
| 33 | #:use-module (guix build-system python) | 34 | #:use-module (guix build-system python) |
| 35 | #:use-module (guix build-system pyproject) | ||
| 34 | #:use-module (guix download) | 36 | #:use-module (guix download) |
| 35 | #:use-module (guix git-download) | 37 | #:use-module (guix git-download) |
| 36 | #:use-module (guix packages)) | 38 | #:use-module (guix packages) |
| 39 | #:use-module (guix gexp)) | ||
| 37 | 40 | ||
| 38 | (define-public python-pytest-rerunfailures | 41 | (define-public python-pytest-rerunfailures |
| 39 | (package | 42 | (package |
| @@ -757,3 +760,74 @@ using the Markdown format.") | |||
| 757 | (description "This package provides tools for Makefile execution powered | 760 | (description "This package provides tools for Makefile execution powered |
| 758 | by pure Python.") | 761 | by pure Python.") |
| 759 | (license license:mpl2.0))) | 762 | (license license:mpl2.0))) |
| 763 | |||
| 764 | (define-public eigen-for-python-ml-dtypes | ||
| 765 | (let ((commit "7bf2968fed5f246c0589e1111004cb420fcd7c71") | ||
| 766 | (revision "1")) | ||
| 767 | (package | ||
| 768 | (inherit eigen) | ||
| 769 | (name "eigen-for-python-ml-dtypes") | ||
| 770 | (version (git-version "3.4.90" revision commit)) | ||
| 771 | (source (origin | ||
| 772 | (inherit (package-source eigen)) | ||
| 773 | (method git-fetch) | ||
| 774 | (uri (git-reference | ||
| 775 | (url "https://gitlab.com/libeigen/eigen.git") | ||
| 776 | (commit commit))) | ||
| 777 | (sha256 | ||
| 778 | (base32 | ||
| 779 | "0yq69h7pasbzq5r83d974xi031r0z2y2x0my1rz5crky54i1j0r7")) | ||
| 780 | (patches '()) | ||
| 781 | (file-name (git-file-name name version))))))) | ||
| 782 | |||
| 783 | (define-public python-ml-dtypes | ||
| 784 | (package | ||
| 785 | (name "python-ml-dtypes") | ||
| 786 | (version "0.3.1") | ||
| 787 | (source | ||
| 788 | (origin | ||
| 789 | (method url-fetch) | ||
| 790 | (uri (pypi-uri "ml_dtypes" version)) | ||
| 791 | (sha256 | ||
| 792 | (base32 "04f61zkizfgmf2pqlsdgskj1r1gg6l5j1nj2p8v4yk2b36cqyxv0")) | ||
| 793 | (modules '((guix build utils))) | ||
| 794 | (snippet | ||
| 795 | ;; Do not use bundled eigen. | ||
| 796 | '(delete-file-recursively "third_party/eigen")))) | ||
| 797 | (build-system pyproject-build-system) | ||
| 798 | (arguments | ||
| 799 | (list | ||
| 800 | #:tests? #false ;there are none | ||
| 801 | #:phases | ||
| 802 | #~(modify-phases %standard-phases | ||
| 803 | (add-after 'unpack 'use-eigen-package | ||
| 804 | (lambda _ | ||
| 805 | (substitute* "setup.py" | ||
| 806 | (("third_party/eigen") | ||
| 807 | (string-append | ||
| 808 | #$(this-package-input "eigen-for-python-ml-dtypes") | ||
| 809 | "/include/eigen3")))))))) | ||
| 810 | (inputs (list eigen-for-python-ml-dtypes)) | ||
| 811 | (propagated-inputs (list python-numpy)) | ||
| 812 | (native-inputs (list pybind11 python-absl-py python-pylint | ||
| 813 | python-pytest python-pytest-xdist)) | ||
| 814 | (home-page "https://github.com/jax-ml/ml_dtypes") | ||
| 815 | (synopsis "NumPy dtype extensions used in machine learning") | ||
| 816 | (description "This package is a stand-alone implementation of several | ||
| 817 | NumPy @code{dtype} extensions used in machine learning libraries, including: | ||
| 818 | |||
| 819 | @itemize | ||
| 820 | @item @code{bfloat16}: an alternative to the standard @code{float16} format | ||
| 821 | @item @code{float8_*}: several experimental 8-bit floating point | ||
| 822 | representations including: | ||
| 823 | @itemize | ||
| 824 | @item @code{float8_e4m3b11fnuz} | ||
| 825 | @item @code{float8_e4m3fn} | ||
| 826 | @item @code{float8_e4m3fnuz} | ||
| 827 | @item @code{float8_e5m2} | ||
| 828 | @item @code{float8_e5m2fnuz} | ||
| 829 | @end itemize | ||
| 830 | @item @code{int4} and @code{uint4}: low precision integer types. | ||
| 831 | @end itemize | ||
| 832 | ") | ||
| 833 | (license license:asl2.0))) | ||
