summaryrefslogtreecommitdiff
path: root/gnu/packages/python-web.scm
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2026-02-18 03:53:40 +0900
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2026-03-26 06:39:05 +0100
commit881cfbba6d27236fdcebfd43fa944b681fa760fd (patch)
treebc4dadb46ecc22214bc6ea82775ef05e20370287 /gnu/packages/python-web.scm
parent92e10c3337fa4827ae1eb85f4c7550f529ae761c (diff)
gnu: Add python-flask-limiter.
* gnu/packages/python-web.scm (python-flask-limiter): New variable. Change-Id: I0730a509835e8a655bffeace8869e550c9e015c0 Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Diffstat (limited to 'gnu/packages/python-web.scm')
-rw-r--r--gnu/packages/python-web.scm64
1 files changed, 64 insertions, 0 deletions
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index cc01a1684d3..4b47bb5ea6a 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -1234,6 +1234,70 @@ fort ok https://github.com/thadeusb/flask-cache.")
inspired by Ruby's will_paginate library. It supports several CSS frameworks.")
(license license:bsd-3)))
+(define-public python-flask-limiter
+ (package
+ (name "python-flask-limiter")
+ (version "4.1.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/alisaifee/flask-limiter")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "18n12iayzw6qqys26824j5lfbphfcammpmyrvys1k0rn4xcbifln"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ ;; tests: 155 passed, 620 deselected
+ #:test-flags
+ #~(list "-k" (simple-format #f "not (~a)"
+ (string-join
+ (append
+ ;; The test suite spawns storages in Docker.
+ '("memcache" "reset_unsupported")
+ '("mongo")
+ '("redis" "clear_limits"
+ "constructor_arguments_over_config"
+ "custom_key_prefix" "fallback_to_memory"))
+ " or ")))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-before 'check 'adjust-tests
+ (lambda _
+ (substitute* "pytest.ini"
+ ((".*--cov=.*") ""))
+ (substitute* (find-files "tests" "\\.py$")
+ (("import pymemcache.*") "")
+ (("import pymongo.*") "")
+ (("import redis.*") "")))))))
+ (native-inputs (list python-flask-restful
+ python-hatch-vcs
+ python-hatchling
+ python-hiro
+ python-pytest
+ python-pytest-check
+ python-pytest-mock))
+ (propagated-inputs (list python-flask
+ python-limits
+ python-ordered-set
+ python-rich))
+ (home-page "https://flask-limiter.readthedocs.org/")
+ (synopsis "Rate limiting for Flask applications")
+ (description
+ "Flask-Limiter adds rate limiting to Flask applications.
+Rate limits can be configured at different levels such as:
+
+@itemize
+@item Application wide global limits per user
+@item Default limits per route
+@item By blueprints
+@item By class-based views
+@item By individual routes
+@end itemize")
+ (license license:expat)))
+
(define-public python-gdown
(package
(name "python-gdown")