diff mbox series

[bug#68789,1/2] gnu: Add python-unyt.

Message ID 87cytkf1bl.fsf@troyfigiel.com
State New
Headers show
Series [bug#68789,1/2] gnu: Add python-unyt. | expand

Commit Message

Troy Figiel Jan. 29, 2024, 6:16 p.m. UTC
* gnu/packages/python-science.scm (python-unyt): New variable.
---
 gnu/packages/python-science.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index f775d46349..3390b918a4 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -1287,6 +1287,35 @@  (define-public python-statannot
 annotations on an existing boxplots and barplots generated by seaborn.")
     (license license:expat)))
 
+(define-public python-unyt
+  (package
+    (name "python-unyt")
+    (version "3.0.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "unyt" version))
+       (sha256
+        (base32 "00900bw24rxgcgwgxp9xlx0l5im96r1n5hn0r3mxvbdgc3lyyq48"))))
+    (build-system pyproject-build-system)
+    ;; Astropy is an optional import, but we do not include it as it creates a
+    ;; module cycle: astronomy->python-science->astronomy.
+    (propagated-inputs (list python-h5py ;optional import
+                             python-matplotlib ;optional import
+                             python-numpy
+                             python-sympy))
+    ;; Pint is optional, but we do not propagate it due to its size.
+    (native-inputs (list python-pint python-pytest))
+    (home-page "https://unyt.readthedocs.io")
+    (synopsis "Library for working with data that has physical units")
+    (description
+     "Writing code that deals with data with physical units can be confusing.
+A function might return an array but at least with plain @code{numpy}, there
+is no way to easily tell what the units of the data are without somehow
+knowing a priori.  @code{unyt} handles this problem by providing a subclass of
+the @code{ndarray} class in @code{numpy} that is unit aware.")
+    (license license:bsd-3)))
+
 (define-public python-upsetplot
   (package
     (name "python-upsetplot")