limits 4.7.2__tar.gz → 5.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. {limits-4.7.2 → limits-5.0.0}/HISTORY.rst +31 -81
  2. {limits-4.7.2 → limits-5.0.0}/PKG-INFO +8 -14
  3. {limits-4.7.2 → limits-5.0.0}/README.rst +5 -3
  4. {limits-4.7.2 → limits-5.0.0}/doc/source/_static/custom.css +1 -1
  5. {limits-4.7.2 → limits-5.0.0}/doc/source/api.rst +0 -12
  6. {limits-4.7.2 → limits-5.0.0}/doc/source/async.rst +3 -6
  7. {limits-4.7.2 → limits-5.0.0}/doc/source/conf.py +24 -15
  8. limits-5.0.0/doc/source/ext/_static/benchmark-chart.css +94 -0
  9. limits-5.0.0/doc/source/ext/_static/js/benchmark-chart.js +489 -0
  10. limits-5.0.0/doc/source/ext/_static/js/benchmark-details.js +117 -0
  11. limits-5.0.0/doc/source/ext/_static/js/benchmark-loader.js +43 -0
  12. limits-5.0.0/doc/source/ext/_templates/git_info.js +22 -0
  13. {limits-4.7.2 → limits-5.0.0}/doc/source/ext/bench_chart.py +15 -9
  14. {limits-4.7.2 → limits-5.0.0}/doc/source/index.rst +2 -1
  15. {limits-4.7.2 → limits-5.0.0}/doc/source/installation.rst +6 -21
  16. limits-5.0.0/doc/source/performance.rst +219 -0
  17. {limits-4.7.2 → limits-5.0.0}/doc/source/quickstart.rst +42 -27
  18. {limits-4.7.2 → limits-5.0.0}/doc/source/storage.rst +3 -36
  19. {limits-4.7.2 → limits-5.0.0}/doc/source/strategies.rst +0 -11
  20. {limits-4.7.2 → limits-5.0.0}/doc/source/theme_config.py +12 -0
  21. {limits-4.7.2 → limits-5.0.0}/limits/_version.py +3 -3
  22. {limits-4.7.2 → limits-5.0.0}/limits/aio/storage/__init__.py +0 -2
  23. {limits-4.7.2 → limits-5.0.0}/limits/aio/storage/base.py +1 -5
  24. limits-5.0.0/limits/aio/storage/memcached/__init__.py +184 -0
  25. limits-5.0.0/limits/aio/storage/memcached/bridge.py +73 -0
  26. limits-5.0.0/limits/aio/storage/memcached/emcache.py +112 -0
  27. limits-5.0.0/limits/aio/storage/memcached/memcachio.py +104 -0
  28. {limits-4.7.2 → limits-5.0.0}/limits/aio/storage/memory.py +41 -48
  29. {limits-4.7.2 → limits-5.0.0}/limits/aio/storage/mongodb.py +26 -31
  30. {limits-4.7.2 → limits-5.0.0}/limits/aio/storage/redis/__init__.py +2 -4
  31. {limits-4.7.2 → limits-5.0.0}/limits/aio/storage/redis/bridge.py +0 -1
  32. {limits-4.7.2 → limits-5.0.0}/limits/aio/storage/redis/coredis.py +2 -6
  33. {limits-4.7.2 → limits-5.0.0}/limits/aio/storage/redis/redispy.py +1 -8
  34. {limits-4.7.2 → limits-5.0.0}/limits/aio/strategies.py +1 -28
  35. {limits-4.7.2 → limits-5.0.0}/limits/resources/redis/lua_scripts/acquire_moving_window.lua +5 -2
  36. limits-5.0.0/limits/resources/redis/lua_scripts/moving_window.lua +30 -0
  37. {limits-4.7.2 → limits-5.0.0}/limits/storage/__init__.py +0 -2
  38. {limits-4.7.2 → limits-5.0.0}/limits/storage/base.py +1 -5
  39. {limits-4.7.2 → limits-5.0.0}/limits/storage/memcached.py +8 -29
  40. {limits-4.7.2 → limits-5.0.0}/limits/storage/memory.py +16 -35
  41. {limits-4.7.2 → limits-5.0.0}/limits/storage/mongodb.py +25 -34
  42. {limits-4.7.2 → limits-5.0.0}/limits/storage/redis.py +1 -7
  43. {limits-4.7.2 → limits-5.0.0}/limits/strategies.py +1 -31
  44. {limits-4.7.2 → limits-5.0.0}/limits/typing.py +1 -50
  45. {limits-4.7.2 → limits-5.0.0}/limits.egg-info/PKG-INFO +8 -14
  46. {limits-4.7.2 → limits-5.0.0}/limits.egg-info/SOURCES.txt +4 -5
  47. {limits-4.7.2 → limits-5.0.0}/limits.egg-info/requires.txt +2 -20
  48. {limits-4.7.2 → limits-5.0.0}/requirements/docs.txt +3 -2
  49. limits-5.0.0/requirements/storage/async-memcached.txt +1 -0
  50. {limits-4.7.2 → limits-5.0.0}/requirements/test.txt +2 -7
  51. {limits-4.7.2 → limits-5.0.0}/setup.cfg +2 -5
  52. {limits-4.7.2 → limits-5.0.0}/setup.py +0 -2
  53. {limits-4.7.2 → limits-5.0.0}/tests/test_storage.py +0 -9
  54. {limits-4.7.2 → limits-5.0.0}/tests/test_strategy.py +8 -43
  55. limits-4.7.2/doc/source/ext/_static/benchmark-chart.css +0 -61
  56. limits-4.7.2/doc/source/ext/_static/js/benchmark-chart.js +0 -219
  57. limits-4.7.2/doc/source/ext/_static/js/benchmark-details.js +0 -103
  58. limits-4.7.2/doc/source/ext/_static/js/benchmark-loader.js +0 -31
  59. limits-4.7.2/doc/source/ext/_templates/git_info.js +0 -2
  60. limits-4.7.2/doc/source/performance.rst +0 -221
  61. limits-4.7.2/limits/aio/storage/etcd.py +0 -146
  62. limits-4.7.2/limits/aio/storage/memcached.py +0 -278
  63. limits-4.7.2/limits/resources/redis/lua_scripts/moving_window.lua +0 -21
  64. limits-4.7.2/limits/storage/etcd.py +0 -139
  65. limits-4.7.2/requirements/storage/async-etcd.txt +0 -1
  66. limits-4.7.2/requirements/storage/async-memcached.txt +0 -2
  67. limits-4.7.2/requirements/storage/etcd.txt +0 -1
  68. {limits-4.7.2 → limits-5.0.0}/CLASSIFIERS +0 -0
  69. {limits-4.7.2 → limits-5.0.0}/CONTRIBUTIONS.rst +0 -0
  70. {limits-4.7.2 → limits-5.0.0}/LICENSE.txt +0 -0
  71. {limits-4.7.2 → limits-5.0.0}/MANIFEST.in +0 -0
  72. {limits-4.7.2 → limits-5.0.0}/doc/Makefile +0 -0
  73. {limits-4.7.2 → limits-5.0.0}/doc/source/changelog.rst +0 -0
  74. {limits-4.7.2 → limits-5.0.0}/doc/source/custom-storage.rst +0 -0
  75. {limits-4.7.2 → limits-5.0.0}/limits/__init__.py +0 -0
  76. {limits-4.7.2 → limits-5.0.0}/limits/aio/__init__.py +0 -0
  77. {limits-4.7.2 → limits-5.0.0}/limits/aio/storage/redis/valkey.py +0 -0
  78. {limits-4.7.2 → limits-5.0.0}/limits/errors.py +0 -0
  79. {limits-4.7.2 → limits-5.0.0}/limits/limits.py +0 -0
  80. {limits-4.7.2 → limits-5.0.0}/limits/py.typed +0 -0
  81. {limits-4.7.2 → limits-5.0.0}/limits/resources/redis/lua_scripts/acquire_sliding_window.lua +0 -0
  82. {limits-4.7.2 → limits-5.0.0}/limits/resources/redis/lua_scripts/clear_keys.lua +0 -0
  83. {limits-4.7.2 → limits-5.0.0}/limits/resources/redis/lua_scripts/incr_expire.lua +0 -0
  84. {limits-4.7.2 → limits-5.0.0}/limits/resources/redis/lua_scripts/sliding_window.lua +0 -0
  85. {limits-4.7.2 → limits-5.0.0}/limits/storage/redis_cluster.py +0 -0
  86. {limits-4.7.2 → limits-5.0.0}/limits/storage/redis_sentinel.py +0 -0
  87. {limits-4.7.2 → limits-5.0.0}/limits/storage/registry.py +0 -0
  88. {limits-4.7.2 → limits-5.0.0}/limits/util.py +0 -0
  89. {limits-4.7.2 → limits-5.0.0}/limits/version.py +0 -0
  90. {limits-4.7.2 → limits-5.0.0}/limits.egg-info/dependency_links.txt +0 -0
  91. {limits-4.7.2 → limits-5.0.0}/limits.egg-info/not-zip-safe +0 -0
  92. {limits-4.7.2 → limits-5.0.0}/limits.egg-info/top_level.txt +0 -0
  93. {limits-4.7.2 → limits-5.0.0}/pyproject.toml +0 -0
  94. {limits-4.7.2 → limits-5.0.0}/requirements/ci.txt +0 -0
  95. {limits-4.7.2 → limits-5.0.0}/requirements/dev.txt +0 -0
  96. {limits-4.7.2 → limits-5.0.0}/requirements/main.txt +0 -0
  97. {limits-4.7.2 → limits-5.0.0}/requirements/storage/async-mongodb.txt +0 -0
  98. {limits-4.7.2 → limits-5.0.0}/requirements/storage/async-redis.txt +0 -0
  99. {limits-4.7.2 → limits-5.0.0}/requirements/storage/async-valkey.txt +0 -0
  100. {limits-4.7.2 → limits-5.0.0}/requirements/storage/memcached.txt +0 -0
  101. {limits-4.7.2 → limits-5.0.0}/requirements/storage/mongodb.txt +0 -0
  102. {limits-4.7.2 → limits-5.0.0}/requirements/storage/redis.txt +0 -0
  103. {limits-4.7.2 → limits-5.0.0}/requirements/storage/rediscluster.txt +0 -0
  104. {limits-4.7.2 → limits-5.0.0}/requirements/storage/valkey.txt +0 -0
  105. {limits-4.7.2 → limits-5.0.0}/tests/test_limit_granularities.py +0 -0
  106. {limits-4.7.2 → limits-5.0.0}/tests/test_limits.py +0 -0
  107. {limits-4.7.2 → limits-5.0.0}/tests/test_ratelimit_parser.py +0 -0
  108. {limits-4.7.2 → limits-5.0.0}/tests/test_utils.py +0 -0
  109. {limits-4.7.2 → limits-5.0.0}/versioneer.py +0 -0
@@ -3,6 +3,37 @@
3
3
  Changelog
4
4
  =========
5
5
 
6
+ v5.0.0
7
+ ------
8
+ Release Date: 2025-04-15
9
+
10
+ * Backward incompatible changes
11
+
12
+ * Dropped support for Fixed Window with Elastic Expiry strategy
13
+ * Dropped support for etcd
14
+ * Changed the default implementation for async+memached from :pypi:`emcache`
15
+ to :pypi`:memcachio`
16
+
17
+ * Performance
18
+
19
+ * Improved performance of redis moving window ``test`` and ``get_window_stats`` operations
20
+ especially when dealing with large rate limits.
21
+ * Improved performance of mongodb moving window ``test`` and ``get_window_stats`` operations.
22
+ * Improved performance of in-memory moving window ``test`` and ``get_window_stats`` operations.
23
+ * Reduced load on event loop when expiring limits with async in-memory implementations
24
+
25
+ v4.7.3
26
+ ------
27
+ Release Date: 2025-04-12
28
+
29
+ * Documentation
30
+
31
+ * Expand benchmark results to included preseeded limits
32
+
33
+ * Bug Fix
34
+
35
+ * Handle clearing missing key with memcache + async
36
+
6
37
  v4.7.2
7
38
  ------
8
39
  Release Date: 2025-04-09
@@ -794,84 +825,3 @@ Release Date: 2015-01-08
794
825
  * Initial import of common rate limiting code from `Flask-Limiter <https://github.com/alisaifee/flask-limiter>`_
795
826
 
796
827
 
797
-
798
-
799
-
800
-
801
-
802
-
803
-
804
-
805
-
806
-
807
-
808
-
809
-
810
-
811
-
812
-
813
-
814
-
815
-
816
-
817
-
818
-
819
-
820
-
821
-
822
-
823
-
824
-
825
-
826
-
827
-
828
-
829
-
830
-
831
-
832
-
833
-
834
-
835
-
836
-
837
-
838
-
839
-
840
-
841
-
842
-
843
-
844
-
845
-
846
-
847
-
848
-
849
-
850
-
851
-
852
-
853
-
854
-
855
-
856
-
857
-
858
-
859
-
860
-
861
-
862
-
863
-
864
-
865
-
866
-
867
-
868
-
869
-
870
-
871
-
872
-
873
-
874
-
875
-
876
-
877
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: limits
3
- Version: 4.7.2
3
+ Version: 5.0.0
4
4
  Summary: Rate limiting utilities
5
5
  Home-page: https://limits.readthedocs.org
6
6
  Author: Ali-Akber Saifee
@@ -32,19 +32,14 @@ Provides-Extra: memcached
32
32
  Requires-Dist: pymemcache<5.0.0,>3; extra == "memcached"
33
33
  Provides-Extra: mongodb
34
34
  Requires-Dist: pymongo<5,>4.1; extra == "mongodb"
35
- Provides-Extra: etcd
36
- Requires-Dist: etcd3; extra == "etcd"
37
35
  Provides-Extra: valkey
38
36
  Requires-Dist: valkey>=6; extra == "valkey"
39
37
  Provides-Extra: async-redis
40
38
  Requires-Dist: coredis<5,>=3.4.0; extra == "async-redis"
41
39
  Provides-Extra: async-memcached
42
- Requires-Dist: emcache>=0.6.1; python_version < "3.11" and extra == "async-memcached"
43
- Requires-Dist: emcache>=1; (python_version >= "3.11" and python_version < "3.13.0") and extra == "async-memcached"
40
+ Requires-Dist: memcachio>=0.3; extra == "async-memcached"
44
41
  Provides-Extra: async-mongodb
45
42
  Requires-Dist: motor<4,>=3; extra == "async-mongodb"
46
- Provides-Extra: async-etcd
47
- Requires-Dist: aetcd; extra == "async-etcd"
48
43
  Provides-Extra: async-valkey
49
44
  Requires-Dist: valkey>=6; extra == "async-valkey"
50
45
  Provides-Extra: all
@@ -52,13 +47,10 @@ Requires-Dist: redis!=4.5.2,!=4.5.3,<6.0.0,>3; extra == "all"
52
47
  Requires-Dist: redis!=4.5.2,!=4.5.3,>=4.2.0; extra == "all"
53
48
  Requires-Dist: pymemcache<5.0.0,>3; extra == "all"
54
49
  Requires-Dist: pymongo<5,>4.1; extra == "all"
55
- Requires-Dist: etcd3; extra == "all"
56
50
  Requires-Dist: valkey>=6; extra == "all"
57
51
  Requires-Dist: coredis<5,>=3.4.0; extra == "all"
58
- Requires-Dist: emcache>=0.6.1; python_version < "3.11" and extra == "all"
59
- Requires-Dist: emcache>=1; (python_version >= "3.11" and python_version < "3.13.0") and extra == "all"
52
+ Requires-Dist: memcachio>=0.3; extra == "all"
60
53
  Requires-Dist: motor<4,>=3; extra == "all"
61
- Requires-Dist: aetcd; extra == "all"
62
54
  Requires-Dist: valkey>=6; extra == "all"
63
55
  Dynamic: author
64
56
  Dynamic: author-email
@@ -86,13 +78,14 @@ Dynamic: summary
86
78
  .. |docs| image:: https://readthedocs.org/projects/limits/badge/?version=latest
87
79
  :target: https://limits.readthedocs.org
88
80
 
81
+ ######
89
82
  limits
90
- ------
83
+ ######
91
84
  |docs| |ci| |codecov| |pypi| |pypi-versions| |license|
92
85
 
93
86
 
94
87
  **limits** is a python library for rate limiting via multiple strategies
95
- with commonly used storage backends (Redis, Memcached, MongoDB & Etcd).
88
+ with commonly used storage backends (Redis, Memcached & MongoDB).
96
89
 
97
90
  The library provides identical APIs for use in sync and
98
91
  `async <https://limits.readthedocs.io/en/stable/async.html>`_ codebases.
@@ -188,13 +181,13 @@ Scenario 2:
188
181
  - ``weighted_count = floor(8 + (4 * 0.33)) = floor(8 + 1.32) = 9``.
189
182
  - Since the weighted count is below the limit, the request is allowed.
190
183
 
184
+
191
185
  Storage backends
192
186
  ================
193
187
 
194
188
  - `Redis <https://limits.readthedocs.io/en/latest/storage.html#redis-storage>`_
195
189
  - `Memcached <https://limits.readthedocs.io/en/latest/storage.html#memcached-storage>`_
196
190
  - `MongoDB <https://limits.readthedocs.io/en/latest/storage.html#mongodb-storage>`_
197
- - `Etcd <https://limits.readthedocs.io/en/latest/storage.html#etcd-storage>`_
198
191
  - `In-Memory <https://limits.readthedocs.io/en/latest/storage.html#in-memory-storage>`_
199
192
 
200
193
  Dive right in
@@ -281,5 +274,6 @@ Links
281
274
  =====
282
275
 
283
276
  * `Documentation <http://limits.readthedocs.org/en/latest>`_
277
+ * `Benchmarks <http://limits.readthedocs.org/en/latest/performance.html>`_
284
278
  * `Changelog <http://limits.readthedocs.org/en/stable/changelog.html>`_
285
279
 
@@ -11,13 +11,14 @@
11
11
  .. |docs| image:: https://readthedocs.org/projects/limits/badge/?version=latest
12
12
  :target: https://limits.readthedocs.org
13
13
 
14
+ ######
14
15
  limits
15
- ------
16
+ ######
16
17
  |docs| |ci| |codecov| |pypi| |pypi-versions| |license|
17
18
 
18
19
 
19
20
  **limits** is a python library for rate limiting via multiple strategies
20
- with commonly used storage backends (Redis, Memcached, MongoDB & Etcd).
21
+ with commonly used storage backends (Redis, Memcached & MongoDB).
21
22
 
22
23
  The library provides identical APIs for use in sync and
23
24
  `async <https://limits.readthedocs.io/en/stable/async.html>`_ codebases.
@@ -113,13 +114,13 @@ Scenario 2:
113
114
  - ``weighted_count = floor(8 + (4 * 0.33)) = floor(8 + 1.32) = 9``.
114
115
  - Since the weighted count is below the limit, the request is allowed.
115
116
 
117
+
116
118
  Storage backends
117
119
  ================
118
120
 
119
121
  - `Redis <https://limits.readthedocs.io/en/latest/storage.html#redis-storage>`_
120
122
  - `Memcached <https://limits.readthedocs.io/en/latest/storage.html#memcached-storage>`_
121
123
  - `MongoDB <https://limits.readthedocs.io/en/latest/storage.html#mongodb-storage>`_
122
- - `Etcd <https://limits.readthedocs.io/en/latest/storage.html#etcd-storage>`_
123
124
  - `In-Memory <https://limits.readthedocs.io/en/latest/storage.html#in-memory-storage>`_
124
125
 
125
126
  Dive right in
@@ -206,5 +207,6 @@ Links
206
207
  =====
207
208
 
208
209
  * `Documentation <http://limits.readthedocs.org/en/latest>`_
210
+ * `Benchmarks <http://limits.readthedocs.org/en/latest/performance.html>`_
209
211
  * `Changelog <http://limits.readthedocs.org/en/stable/changelog.html>`_
210
212
 
@@ -1,7 +1,7 @@
1
1
  .badges {
2
2
  display: flex;
3
3
  padding: 5px;
4
- flex-direction: rootow;
4
+ flex-direction: row;
5
5
  justify-content: center;
6
6
  }
7
7
  .header-badge {
@@ -28,7 +28,6 @@ a single parameter: a subclass of :class:`~limits.storage.Storage`.
28
28
  Provided by :mod:`limits.strategies`
29
29
 
30
30
  .. autoclass:: FixedWindowRateLimiter
31
- .. autoclass:: FixedWindowElasticExpiryRateLimiter
32
31
  .. autoclass:: MovingWindowRateLimiter
33
32
  .. autoclass:: SlidingWindowCounterRateLimiter
34
33
 
@@ -47,7 +46,6 @@ expose async variants and expect a subclass of :class:`limits.aio.storage.Storag
47
46
  Provided by :mod:`limits.aio.strategies`
48
47
 
49
48
  .. autoclass:: FixedWindowRateLimiter
50
- .. autoclass:: FixedWindowElasticExpiryRateLimiter
51
49
  .. autoclass:: MovingWindowRateLimiter
52
50
  .. autoclass:: SlidingWindowCounterRateLimiter
53
51
 
@@ -101,11 +99,6 @@ MongoDB Storage
101
99
 
102
100
  .. autoclass:: MongoDBStorage
103
101
 
104
- Etcd Storage
105
- ^^^^^^^^^^^^
106
-
107
- .. autoclass:: EtcdStorage
108
-
109
102
 
110
103
  Async Storage
111
104
  -------------
@@ -144,11 +137,6 @@ Async MongoDB Storage
144
137
 
145
138
  .. autoclass:: MongoDBStorage
146
139
 
147
- Async Etcd Storage
148
- ^^^^^^^^^^^^^^^^^^
149
-
150
- .. autoclass:: EtcdStorage
151
-
152
140
  Abstract storage classes
153
141
  ------------------------
154
142
 
@@ -2,10 +2,8 @@
2
2
  Async Support
3
3
  =============
4
4
 
5
- .. versionadded:: 2.1
6
-
7
- A new namespace ``limits.aio`` is available which mirrors the original
8
- ``limits.storage`` and ``limits.strategies`` packages.
5
+ The namespace ``limits.aio`` mirrors ``limits.storage`` and ``limits.strategies``
6
+ with async variants.
9
7
 
10
8
  The following async storage backends are implemented:
11
9
 
@@ -14,9 +12,8 @@ The following async storage backends are implemented:
14
12
  or `redis-py <https://redis-py.readthedocs.io>`_. Refer to
15
13
  :paramref:`limits.aio.storage.RedisStorage.implementation` for
16
14
  details on selecting the dependency)
17
- - Memcached (via `emcache <https://emcache.readthedocs.org>`_)
15
+ - Memcached (via `memcachio <https://memcachio.readthedocs.org>`_)
18
16
  - MongoDB (via `motor <https://motor.readthedocs.org>`_)
19
- - Etcd (via `aetcd <https://aetcd.readthedocs.org>`_)
20
17
 
21
18
  Quick start
22
19
  ===========
@@ -1,17 +1,14 @@
1
1
  #
2
+ from __future__ import annotations
2
3
 
3
4
  import os
4
5
  import sys
5
6
  from pathlib import Path
6
7
 
7
- from docutils import nodes
8
- from sphinx.application import Sphinx
9
- from sphinx.util.docutils import SphinxDirective
10
-
11
8
  sys.path.insert(0, os.path.abspath("../../"))
12
9
  sys.path.insert(0, os.path.abspath("./"))
13
10
 
14
- from theme_config import *
11
+ from theme_config import * # noqa
15
12
 
16
13
  import limits
17
14
 
@@ -19,27 +16,39 @@ project = "limits"
19
16
  description = "limits is a python library to perform rate limiting with commonly used storage backends"
20
17
  copyright = "2023, Ali-Akber Saifee"
21
18
 
19
+
22
20
  if ".post0.dev" in limits.__version__:
23
21
  version, ahead = limits.__version__.split(".post0.dev")
24
22
  else:
25
23
  version = limits.__version__
24
+ ahead = 0
26
25
 
27
26
  release = version
28
27
 
29
28
 
30
29
  if branch_from_env := os.environ.get("READTHEDOCS_VERSION", None):
30
+ branch_from_env = "master" if branch_from_env == "latest" else branch_from_env
31
31
  benchmark_git_context = {
32
32
  "branch": branch_from_env,
33
- "sha": os.environ.get("READTHEDOCS_GIT_COMMIT_HASH", "")
33
+ "sha": os.environ.get("READTHEDOCS_GIT_COMMIT_HASH", ""),
34
34
  }
35
35
  else:
36
36
  import limits._version
37
+
37
38
  git_info = limits._version.git_pieces_from_vcs("", os.path.abspath("../../"), False)
38
39
  benchmark_git_context = {
39
40
  "branch": git_info.get("branch", ""),
40
- "sha": git_info.get("long", None)
41
+ "sha": git_info.get("long", None),
41
42
  }
42
-
43
+ benchmark_param_mapping = {
44
+ "percentage_full": {
45
+ "display": "Percentage Seeded",
46
+ "info": "Percentage of rate limit already filled before the benchmark is run",
47
+ },
48
+ "async": {"display": "Asyncio", "info": "Using asyncio storage implementation"},
49
+ "storage_type": {"display": "Storage", "info": "Storage Backend"},
50
+ "strategy": {"display": "Strategy", "info": "Rate Limiting Strategy"},
51
+ }
43
52
  html_static_path = ["_static"]
44
53
 
45
54
  html_css_files = [
@@ -48,18 +57,19 @@ html_css_files = [
48
57
  ]
49
58
 
50
59
  html_title = f"{project} <small><b style='color: var(--color-brand-primary)'>{{{release}}}</b></small>"
60
+
51
61
  try:
52
62
  ahead = int(ahead)
53
63
  if ahead > 0:
54
- html_theme_options[
64
+ html_theme_options[ # noqa
55
65
  "announcement"
56
66
  ] = f"""
57
67
  This is a development version. The documentation for the latest version: <b>{release}</b> can be found <a href="/en/stable">here</a>
58
68
  """
59
69
  html_title = f"{project} <small><b style='color: var(--color-brand-primary)'>{{dev}}</b></small>"
60
- except:
70
+ except ValueError:
61
71
  pass
62
- sys.path.append(str(Path('ext').resolve()))
72
+ sys.path.append(str(Path("ext").resolve()))
63
73
 
64
74
  extensions = [
65
75
  "sphinx.ext.autodoc",
@@ -73,6 +83,7 @@ extensions = [
73
83
  "sphinxext.opengraph",
74
84
  "sphinxcontrib.programoutput",
75
85
  "sphinx_copybutton",
86
+ "sphinx_design",
76
87
  "sphinx_inline_tabs",
77
88
  "sphinx_paramlinks",
78
89
  "bench_chart",
@@ -93,18 +104,16 @@ autosectionlabel_prefix_document = True
93
104
 
94
105
  extlinks = {"pypi": ("https://pypi.org/project/%s", "%s")}
95
106
 
96
- copybutton_exclude = '.gp, .go'
107
+ copybutton_exclude = ".gp, .go"
97
108
 
98
109
  intersphinx_mapping = {
99
110
  "python": ("http://docs.python.org/", None),
100
111
  "coredis": ("https://coredis.readthedocs.io/en/latest/", None),
101
- "emcache": ("https://emcache.readthedocs.io/en/latest/", None),
112
+ "memcachio": ("https://memcachio.readthedocs.io/en/latest/", None),
102
113
  "motor": ("https://motor.readthedocs.io/en/stable/", None),
103
114
  "redis-py-cluster": ("https://redis-py-cluster.readthedocs.io/en/latest/", None),
104
115
  "redis-py": ("https://redis-py.readthedocs.io/en/latest/", None),
105
116
  "pymemcache": ("https://pymemcache.readthedocs.io/en/latest/", None),
106
117
  "pymongo": ("https://pymongo.readthedocs.io/en/stable/", None),
107
- "python-etcd3": ("https://python-etcd3.readthedocs.io/en/latest/", None),
108
- "aetcd": ("https://aetcd.readthedocs.io/en/latest/", None),
109
118
  "valkey-py": ("https://valkey-py.readthedocs.io/en/latest/", None),
110
119
  }
@@ -0,0 +1,94 @@
1
+ .benchmark-chart {
2
+ width: 100%;
3
+ }
4
+ .benchmark-details {
5
+ .benchmark-details-section {
6
+ thead > tr {
7
+ color: var(--color-purple);
8
+ }
9
+ }
10
+ }
11
+ .benchmark-chart-error,
12
+ .benchmark-details-error {
13
+ color: var(--color-red);
14
+ font-size: smaller;
15
+ padding: 2em;
16
+ text-align: center;
17
+ height: 5em;
18
+ }
19
+ .benchmark-chart-loading {
20
+ display: flex;
21
+ justify-content: center;
22
+ align-items: center;
23
+ font-size: 1.2rem;
24
+ font-weight: bold;
25
+ color: var(--color-purple);
26
+ letter-spacing: 1px;
27
+ height: 200px;
28
+ animation: benchmark-chart-loading-animation;
29
+ animation-iteration-count: 10;
30
+ animation-duration: 2s;
31
+ }
32
+
33
+ @keyframes benchmark-chart-loading-animation {
34
+ 0% {
35
+ opacity: 0;
36
+ }
37
+ 25% {
38
+ opacity: 0.25;
39
+ }
40
+ 50% {
41
+ opacity: 0.5;
42
+ }
43
+ 90% {
44
+ opacity: 0.9;
45
+ }
46
+ 100% {
47
+ opacity: 1;
48
+ }
49
+ }
50
+ .benchmark-filters {
51
+ padding-top: 1em;
52
+ padding-bottom: 1em;
53
+ display: flex;
54
+ justify-content: flex-end;
55
+ }
56
+ .benchmark-filter-dropdowns {
57
+ display: flex;
58
+ align-items: flex-end;
59
+ justify-content: flex-end;
60
+ margin-top: 2em;
61
+ flex-direction: row;
62
+ @media only screen and (max-width: 800px) {
63
+ flex-basis: min-content;
64
+ }
65
+ @media only screen and (max-width: 400px) {
66
+ flex-basis: max-content;
67
+ flex-direction: column;
68
+ }
69
+ }
70
+
71
+ .compare-dropdown {
72
+ display: flex;
73
+ justify-content: flex-end;
74
+ }
75
+
76
+ .benchmark-filter {
77
+ display: flex;
78
+ flex-direction: row;
79
+ gap: 0.25em;
80
+ padding: 0.25em;
81
+ }
82
+
83
+ .benchmark-filter label,
84
+ .compare-filter label {
85
+ font-size: small;
86
+ font-weight: bold;
87
+ }
88
+
89
+ .benchmark-filter select,
90
+ .compare-filter select {
91
+ font-size: small;
92
+ border: 1px solid;
93
+ border-radius: 0.4em;
94
+ }