guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#73910] [PATCH 2/3] gnu: Add python-icontract.


From: Troy Figiel
Subject: [bug#73910] [PATCH 2/3] gnu: Add python-icontract.
Date: Sun, 20 Oct 2024 00:46:39 +0200

* gnu/packages/python-check.scm (python-icontract): New variable.

Change-Id: I48dc21cbed1ff68356099b1c3db351427dff60c7
---
 gnu/packages/python-check.scm | 37 +++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index 4eb6cb1a10..4bfb88fd39 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -161,6 +161,43 @@ (define-public python-beartype
 written in pure Python.")
     (license license:expat)))
 
+(define-public python-icontract
+  (package
+    (name "python-icontract")
+    (version "2.7.1")
+    (source
+     (origin
+       ;; There are no tests in the PyPI tarball.
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/Parquery/icontract";)
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1fix7wx899kn8vp9aa5m6q71la48gx3qqx4qd74535m61pb50r7f"))))
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (add-before 'check 'set-icontract-slow
+                     (lambda _
+                       ;; Setting ICONTRACT_SLOW, does not enable a slow test
+                       ;; suite.  It only causes a single test to run, that
+                       ;; checks the value of icontract.SLOW is set correctly.
+                       (setenv "ICONTRACT_SLOW" "1"))))))
+    (build-system pyproject-build-system)
+    (propagated-inputs (list python-asttokens python-typing-extensions))
+    (native-inputs (list python-asyncstdlib python-numpy python-astor
+                         python-typeguard-4 python-mypy))
+    (home-page "https://icontract.readthedocs.io";)
+    (synopsis "Design-by-contract programming for Python")
+    (description
+     "@code{icontract} brings design-by-contract to Python with informative
+violation messages and inheritance.  @code{icontract} provides two function,
+@code{require} and @code{ensure} for preconditions and postconditions
+respectively.  Additionally, it provides a class decorator, @code{invariant},
+to establish class invariants.")
+    (license license:expat)))
+
 (define-public python-pytest-click
   (package
     (name "python-pytest-click")
-- 
2.46.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]