[bug#75563,1/2] Add python-pyvisa-py

Message ID 20250114201216.83065-1-fredmanglis@gmail.com
State New
Headers
Series Add python-keithley2600 |

Commit Message

Frederick Muriuki Muriithi Jan. 14, 2025, 8:12 p.m. UTC
  * gnu/packages/engineering.scm (python-pyvisa-py): New package.

Change-Id: If6addef9392be03b53a5b4fac2f0fd752af5246f
---
 gnu/packages/engineering.scm | 37 ++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
  

Patch

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index f9c4ac9bbd..4ff147373b 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -41,6 +41,7 @@ 
 ;;; Copyright © 2023 pinoaffe <pinoaffe@gmail.com>
 ;;; Copyright © 2024 Juliana Sims <juli@incana.org>
 ;;; Copyright © 2024 Nguyễn Gia Phong <mcsinyx@disroot.org>
+;;; Copyright © 2025 Frederick Muriuki Muriithi <fredmanglis@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -4958,3 +4959,39 @@  (define-public cadabra2
 towards field theory.")
     (home-page "https://cadabra.science/")
     (license license:gpl3+)))
+
+(define-public python-pyvisa-py
+  (package
+    (name "python-pyvisa-py")
+    (version "0.7.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "PyVISA-py" version))
+       (sha256
+        (base32 "0lg8a041yg4yl31bxyyy51nh92rdp8ps94pzpyz7siaqg235npsc"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (add-before 'build 'ignore-pyvisa-version
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       ;; Remove the minimum version string (>=1.13.0) to fix
+                       ;; the ContextualVersionConflict error that arises while
+                       ;; running the sanity-check phase
+                       (let ((out (assoc-ref outputs "out")))
+                         (substitute* "pyproject.toml"
+                           (("pyvisa>=1.13.0") "pyvisa")))))
+                   (replace 'check
+                     (lambda* (#:key tests? #:allow-other-keys)
+                       (when tests?
+                         (invoke "pytest")))))))
+    (native-inputs (list python-pytest))
+    (propagated-inputs (list python-pyvisa python-typing-extensions))
+    (home-page "https://pyvisa-py.readthedocs.io/")
+    (synopsis "Backend for PyVISA")
+    (description
+     "PyVISA-py is a backend for PyVISA that implements most of the methods for
+ Message Based communication (Serial/USB/GPIB/Ethernet) using Python and some
+ well developed, easy to deploy and cross platform libraries.")
+    (license license:expat)))