aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2024-07-03 16:58:01 +0900
committerEfraim Flashner <efraim@flashner.co.il>2024-07-19 00:47:27 +0300
commit2024e3ee33842676b2255bed2d6205c5dfa2dae2 (patch)
tree1fb84a88f8d173ba3b8f566d7cd90c05b141537a /gnu
parentbad70dad87b0489bfdeb25744db55c3f25fcbd87 (diff)
downloadguix-2024e3ee33842676b2255bed2d6205c5dfa2dae2.tar.gz
guix-2024e3ee33842676b2255bed2d6205c5dfa2dae2.zip
gnu: Add python-nh3.
* gnu/packages/python-web.scm (python-nh3): New variable. Change-Id: I21877b895467c290e07d11697a384c18a9c53113 Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/python-web.scm45
1 files changed, 45 insertions, 0 deletions
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 30da9c8c3c..94a0406ea7 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -65,6 +65,7 @@
;;; Copyright © 2024 Sharlatan Hellseher <sharlatanus@gmail.com>
;;; Copyright © 2024 normally_js <normally_js@posteo.net>
;;; Copyright © 2024 Markku Korkeala <markku.korkeala@iki.fi>
+;;; Copyright © 2024 Nguyễn Gia Phong <mcsinyx@disroot.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -83,6 +84,7 @@
(define-module (gnu packages python-web)
#:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix build-system cargo)
#:use-module (guix build-system copy)
#:use-module (guix build-system pyproject)
#:use-module (guix build-system python)
@@ -96,6 +98,8 @@
#:use-module (gnu packages bash)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages crates-io)
+ #:use-module (gnu packages crates-web)
#:use-module (gnu packages curl)
#:use-module (gnu packages databases)
#:use-module (gnu packages django)
@@ -122,6 +126,7 @@
#:use-module (gnu packages qt)
#:use-module (gnu packages rdf)
#:use-module (gnu packages rpc)
+ #:use-module (gnu packages rust-apps)
#:use-module (gnu packages serialization)
#:use-module (gnu packages sphinx)
#:use-module (gnu packages texinfo)
@@ -3442,6 +3447,46 @@ verification of the SSL peer.")
(home-page "https://github.com/cedadev/ndg_httpsclient/")
(license license:bsd-3)))
+(define-public python-nh3
+ (package
+ (name "python-nh3")
+ (version "0.2.17")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "nh3" version))
+ (sha256
+ (base32 "0a7hrca5bbbrz20cbqy16n8vaxf4v2q1r9zv9vjlbmn334d79l20"))))
+ (build-system cargo-build-system)
+ (arguments
+ (list
+ #: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))
+ (replace 'install (assoc-ref py:%standard-phases 'install))
+ ;; cargo-build-system's %standard-phases has 'check before 'install.
+ (delete 'check)
+ (add-after 'install 'check
+ (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+ (when tests?
+ (py:add-installed-pythonpath inputs outputs)
+ (invoke "pytest" "-vv" "tests")))))
+ #:cargo-inputs
+ `(("rust-ammonia" ,rust-ammonia-4)
+ ("rust-pyo3" ,rust-pyo3-0.21))
+ #:install-source? #false))
+ (native-inputs (list maturin python-pytest python-wrapper))
+ (home-page "https://nh3.readthedocs.io")
+ (synopsis "Python bindings to Ammonia HTML sanitization library")
+ (description "This package provides Python bindings to Ammonia HTML
+sanitizer Rust crate.")
+ (license license:expat)))
+
(define-public python-noiseprotocol
(package
(name "python-noiseprotocol")