[bug#76436,python-team,3/3] gnu: python-watchgod: Rename package to python-watchfiles.

Message ID 87frk9ox7p.fsf@ngraves.fr
State New
Headers
Series Update and rename python-watchgod |

Commit Message

Nicolas Graves Feb. 20, 2025, 7:53 a.m. UTC
  * gnu/packages/python-xyz.scm (python-watchgod): Define in terms of
'deprecated-package'.
[version]: Update to 1.0.4.
[build-system]: Switch to cargo-build-system.
[arguments]: Likewise.
[native-inputs]: Add maturin, python-dirty-equals,
python-pytest-timeout, python-wrapper. Remove python-pygments,
python-pytest-sygar, python-setuptools and python-wheel.
(python-watchfiles): New variable, formerly known as
"python-watchgod".
---
 gnu/packages/python-xyz.scm | 58 +++++++++++++++++++++++++------------
 1 file changed, 40 insertions(+), 18 deletions(-)
  

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index f738b2b00c..2d86cc010a 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32455,37 +32455,56 @@  (define-public python-watchdog
 but portable.")
     (license license:asl2.0)))
 
-(define-public python-watchgod
+(define-public python-watchfiles
   (package
-    (name "python-watchgod")
-    (version "0.8.1")
+    (name "python-watchfiles")
+    (version "1.0.4")
     (source
      (origin
        ;; There are no tests in the PyPI tarball.
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/samuelcolvin/watchgod")
+             (url "https://github.com/samuelcolvin/watchfiles")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0zm9xd2qf3d74l67yv8j3zhhhvi0vp25vhkg46l9d7flh9m04qrp"))))
-    (build-system pyproject-build-system)
+        (base32 "1kaxq0drjwlvcsg4in25w1bhjjgm1zlz06rr2macyi6s5x96g46h"))))
+    (build-system cargo-build-system)
     (arguments
-     (list #:test-flags '(list "-o" "asyncio_mode=auto"
-                               ;; PytestUnraisableExceptionWarning
-                               "-k" "not test_watch_log and not test_awatch")
-       #:phases #~(modify-phases %standard-phases
-                  (delete 'sanity-check))))
+     (list
+      #:install-source? #f
+      #:imported-modules `(,@%cargo-build-system-modules
+                           ,@%pyproject-build-system-modules)
+      #:modules '((guix build cargo-build-system)
+                  ((guix build pyproject-build-system) #:prefix py:)
+                  (guix build utils))
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'build
+            (assoc-ref py:%standard-phases 'build))
+          (add-after 'build 'install-rust-library
+            (lambda _
+              (copy-file "target/release/lib_rust_notify.so"
+                         "watchfiles/_rust_notify.so")))
+          (replace 'check
+            (lambda* (#:key tests? test-flags #:allow-other-keys)
+              (if tests?
+                  ;; Missing file in source.
+                  (invoke "pytest" "-vv" "-k" "not test_docs_examples")
+                  (format #t "test suite not run~%"))))
+          (replace 'install
+            (assoc-ref py:%standard-phases 'install)))
+      #:cargo-inputs
+      (list rust-crossbeam-channel-0.5 rust-notify-7 rust-pyo3-0.23)))
     (native-inputs
-     (list python-anyio
-           python-pygments
+     (list maturin
+           python-anyio
+           python-dirty-equals
            python-pytest
-           python-pytest-asyncio
            python-pytest-mock
-           python-pytest-sugar
-           python-setuptools
-           python-wheel))
-    (home-page "https://github.com/samuelcolvin/watchgod")
+           python-pytest-timeout
+           python-wrapper))
+    (home-page "https://github.com/samuelcolvin/watchfiles")
     (synopsis "Simple, modern file watching and code reload in Python")
     (description
      "Simple, modern file watching and code reload in Python inspired by
@@ -32493,6 +32512,9 @@  (define-public python-watchgod
 operating systems and an elegant approach to concurrency using threading.")
     (license license:expat)))
 
+(define-deprecated/alias python-watchgod python-watchfiles)
+(export python-watchgod)
+
 (define-public python-wget
   (package
     (name "python-wget")