@@ -20479,3 +20479,58 @@ etc.). It's useful for building automated refactoring applications and linters.
(description "@code{python-pywatchman} is a library to connect and
query Watchman to discover file changes.")
(license license:bsd-3)))
+
+(define-public python-uvloop
+ (package
+ (name "python-uvloop")
+ (version "0.14.0")
+ (source
+ (origin
+ (method git-fetch)
+ ;; git-reference because libuv is bundled in the PyPi package
+ (uri (git-reference
+ (url "https://github.com/MagicStack/uvloop.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0cvfaddk9195ai29y8nxf92fi71nypx3fhx219q3pammjnh9z861"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; Unbundle libuv.
+ (substitute* "MANIFEST.in"
+ (("recursive-include vendor/libuv.*") "")
+ (("recursive-exclude vendor/libuv.*") ""))
+ (delete-file-recursively "vendor")
+ #t))))
+ (build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (replace 'build
+ (lambda _
+ (invoke "python" "setup.py"
+ "build_ext" "--inplace"
+ "--cython-always" "--use-system-libuv")))
+ (replace 'install
+ (lambda* (#:key outputs (configure-flags '()) #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (invoke "python" "setup.py" "install"
+ (string-append "--prefix=" out)
+ "--single-version-externally-managed"
+ "--root=/" "--skip-build"))))
+ ;; Tests depend on libuv being present in-tree.
+ (delete 'check))))
+ (inputs
+ `(("libuv" ,libuv)))
+ (native-inputs
+ `(("python-cython" ,python-cython)))
+ (home-page "https://github.com/MagicStack/uvloop")
+ (synopsis
+ "Fast implementation of asyncio event loop on top of libuv")
+ (description
+ "@code{python-uvloop} is a fast, drop-in replacement of the
+built-in @code{asyncio} event loop. @code{python-uvloop} is
+implemented in Cython and uses libuv under the hood.")
+ (license license:expat)))