limits 4.7.3__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.
- {limits-4.7.3 → limits-5.0.0}/HISTORY.rst +19 -82
- {limits-4.7.3 → limits-5.0.0}/PKG-INFO +8 -14
- {limits-4.7.3 → limits-5.0.0}/README.rst +5 -3
- {limits-4.7.3 → limits-5.0.0}/doc/source/_static/custom.css +1 -1
- {limits-4.7.3 → limits-5.0.0}/doc/source/api.rst +0 -12
- {limits-4.7.3 → limits-5.0.0}/doc/source/async.rst +3 -6
- {limits-4.7.3 → limits-5.0.0}/doc/source/conf.py +14 -14
- {limits-4.7.3 → limits-5.0.0}/doc/source/ext/_static/benchmark-chart.css +9 -12
- limits-5.0.0/doc/source/ext/_static/js/benchmark-chart.js +489 -0
- limits-5.0.0/doc/source/ext/_static/js/benchmark-details.js +117 -0
- limits-5.0.0/doc/source/ext/_static/js/benchmark-loader.js +43 -0
- limits-5.0.0/doc/source/ext/_templates/git_info.js +22 -0
- {limits-4.7.3 → limits-5.0.0}/doc/source/ext/bench_chart.py +3 -0
- {limits-4.7.3 → limits-5.0.0}/doc/source/index.rst +2 -1
- {limits-4.7.3 → limits-5.0.0}/doc/source/installation.rst +6 -21
- limits-5.0.0/doc/source/performance.rst +219 -0
- {limits-4.7.3 → limits-5.0.0}/doc/source/quickstart.rst +42 -27
- {limits-4.7.3 → limits-5.0.0}/doc/source/storage.rst +3 -36
- {limits-4.7.3 → limits-5.0.0}/doc/source/strategies.rst +0 -11
- {limits-4.7.3 → limits-5.0.0}/doc/source/theme_config.py +12 -0
- {limits-4.7.3 → limits-5.0.0}/limits/_version.py +3 -3
- {limits-4.7.3 → limits-5.0.0}/limits/aio/storage/__init__.py +0 -2
- {limits-4.7.3 → limits-5.0.0}/limits/aio/storage/base.py +1 -5
- limits-5.0.0/limits/aio/storage/memcached/__init__.py +184 -0
- limits-5.0.0/limits/aio/storage/memcached/bridge.py +73 -0
- limits-5.0.0/limits/aio/storage/memcached/emcache.py +112 -0
- limits-5.0.0/limits/aio/storage/memcached/memcachio.py +104 -0
- {limits-4.7.3 → limits-5.0.0}/limits/aio/storage/memory.py +41 -48
- {limits-4.7.3 → limits-5.0.0}/limits/aio/storage/mongodb.py +26 -31
- {limits-4.7.3 → limits-5.0.0}/limits/aio/storage/redis/__init__.py +2 -4
- {limits-4.7.3 → limits-5.0.0}/limits/aio/storage/redis/bridge.py +0 -1
- {limits-4.7.3 → limits-5.0.0}/limits/aio/storage/redis/coredis.py +2 -6
- {limits-4.7.3 → limits-5.0.0}/limits/aio/storage/redis/redispy.py +1 -8
- {limits-4.7.3 → limits-5.0.0}/limits/aio/strategies.py +1 -28
- {limits-4.7.3 → limits-5.0.0}/limits/resources/redis/lua_scripts/acquire_moving_window.lua +5 -2
- limits-5.0.0/limits/resources/redis/lua_scripts/moving_window.lua +30 -0
- {limits-4.7.3 → limits-5.0.0}/limits/storage/__init__.py +0 -2
- {limits-4.7.3 → limits-5.0.0}/limits/storage/base.py +1 -5
- {limits-4.7.3 → limits-5.0.0}/limits/storage/memcached.py +8 -29
- {limits-4.7.3 → limits-5.0.0}/limits/storage/memory.py +16 -35
- {limits-4.7.3 → limits-5.0.0}/limits/storage/mongodb.py +25 -34
- {limits-4.7.3 → limits-5.0.0}/limits/storage/redis.py +1 -7
- {limits-4.7.3 → limits-5.0.0}/limits/strategies.py +1 -31
- {limits-4.7.3 → limits-5.0.0}/limits/typing.py +1 -50
- {limits-4.7.3 → limits-5.0.0}/limits.egg-info/PKG-INFO +8 -14
- {limits-4.7.3 → limits-5.0.0}/limits.egg-info/SOURCES.txt +4 -5
- {limits-4.7.3 → limits-5.0.0}/limits.egg-info/requires.txt +2 -20
- {limits-4.7.3 → limits-5.0.0}/requirements/docs.txt +2 -1
- limits-5.0.0/requirements/storage/async-memcached.txt +1 -0
- {limits-4.7.3 → limits-5.0.0}/requirements/test.txt +2 -7
- {limits-4.7.3 → limits-5.0.0}/setup.cfg +2 -5
- {limits-4.7.3 → limits-5.0.0}/setup.py +0 -2
- {limits-4.7.3 → limits-5.0.0}/tests/test_storage.py +0 -9
- {limits-4.7.3 → limits-5.0.0}/tests/test_strategy.py +8 -43
- limits-4.7.3/doc/source/ext/_static/js/benchmark-chart.js +0 -343
- limits-4.7.3/doc/source/ext/_static/js/benchmark-details.js +0 -103
- limits-4.7.3/doc/source/ext/_static/js/benchmark-loader.js +0 -31
- limits-4.7.3/doc/source/ext/_templates/git_info.js +0 -2
- limits-4.7.3/doc/source/performance.rst +0 -126
- limits-4.7.3/limits/aio/storage/etcd.py +0 -146
- limits-4.7.3/limits/aio/storage/memcached.py +0 -281
- limits-4.7.3/limits/resources/redis/lua_scripts/moving_window.lua +0 -21
- limits-4.7.3/limits/storage/etcd.py +0 -139
- limits-4.7.3/requirements/storage/async-etcd.txt +0 -1
- limits-4.7.3/requirements/storage/async-memcached.txt +0 -2
- limits-4.7.3/requirements/storage/etcd.txt +0 -1
- {limits-4.7.3 → limits-5.0.0}/CLASSIFIERS +0 -0
- {limits-4.7.3 → limits-5.0.0}/CONTRIBUTIONS.rst +0 -0
- {limits-4.7.3 → limits-5.0.0}/LICENSE.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/MANIFEST.in +0 -0
- {limits-4.7.3 → limits-5.0.0}/doc/Makefile +0 -0
- {limits-4.7.3 → limits-5.0.0}/doc/source/changelog.rst +0 -0
- {limits-4.7.3 → limits-5.0.0}/doc/source/custom-storage.rst +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/__init__.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/aio/__init__.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/aio/storage/redis/valkey.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/errors.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/limits.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/py.typed +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/resources/redis/lua_scripts/acquire_sliding_window.lua +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/resources/redis/lua_scripts/clear_keys.lua +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/resources/redis/lua_scripts/incr_expire.lua +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/resources/redis/lua_scripts/sliding_window.lua +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/storage/redis_cluster.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/storage/redis_sentinel.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/storage/registry.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/util.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits/version.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits.egg-info/dependency_links.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits.egg-info/not-zip-safe +0 -0
- {limits-4.7.3 → limits-5.0.0}/limits.egg-info/top_level.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/pyproject.toml +0 -0
- {limits-4.7.3 → limits-5.0.0}/requirements/ci.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/requirements/dev.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/requirements/main.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/requirements/storage/async-mongodb.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/requirements/storage/async-redis.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/requirements/storage/async-valkey.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/requirements/storage/memcached.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/requirements/storage/mongodb.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/requirements/storage/redis.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/requirements/storage/rediscluster.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/requirements/storage/valkey.txt +0 -0
- {limits-4.7.3 → limits-5.0.0}/tests/test_limit_granularities.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/tests/test_limits.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/tests/test_ratelimit_parser.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/tests/test_utils.py +0 -0
- {limits-4.7.3 → limits-5.0.0}/versioneer.py +0 -0
|
@@ -3,6 +3,25 @@
|
|
|
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
|
+
|
|
6
25
|
v4.7.3
|
|
7
26
|
------
|
|
8
27
|
Release Date: 2025-04-12
|
|
@@ -806,85 +825,3 @@ Release Date: 2015-01-08
|
|
|
806
825
|
* Initial import of common rate limiting code from `Flask-Limiter <https://github.com/alisaifee/flask-limiter>`_
|
|
807
826
|
|
|
808
827
|
|
|
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
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: limits
|
|
3
|
-
Version:
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
|
@@ -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
|
-
|
|
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 `
|
|
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,25 +16,29 @@ 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 = {
|
|
43
44
|
"percentage_full": {
|
|
@@ -56,18 +57,19 @@ html_css_files = [
|
|
|
56
57
|
]
|
|
57
58
|
|
|
58
59
|
html_title = f"{project} <small><b style='color: var(--color-brand-primary)'>{{{release}}}</b></small>"
|
|
60
|
+
|
|
59
61
|
try:
|
|
60
62
|
ahead = int(ahead)
|
|
61
63
|
if ahead > 0:
|
|
62
|
-
html_theme_options[
|
|
64
|
+
html_theme_options[ # noqa
|
|
63
65
|
"announcement"
|
|
64
66
|
] = f"""
|
|
65
67
|
This is a development version. The documentation for the latest version: <b>{release}</b> can be found <a href="/en/stable">here</a>
|
|
66
68
|
"""
|
|
67
69
|
html_title = f"{project} <small><b style='color: var(--color-brand-primary)'>{{dev}}</b></small>"
|
|
68
|
-
except:
|
|
70
|
+
except ValueError:
|
|
69
71
|
pass
|
|
70
|
-
sys.path.append(str(Path(
|
|
72
|
+
sys.path.append(str(Path("ext").resolve()))
|
|
71
73
|
|
|
72
74
|
extensions = [
|
|
73
75
|
"sphinx.ext.autodoc",
|
|
@@ -102,18 +104,16 @@ autosectionlabel_prefix_document = True
|
|
|
102
104
|
|
|
103
105
|
extlinks = {"pypi": ("https://pypi.org/project/%s", "%s")}
|
|
104
106
|
|
|
105
|
-
copybutton_exclude =
|
|
107
|
+
copybutton_exclude = ".gp, .go"
|
|
106
108
|
|
|
107
109
|
intersphinx_mapping = {
|
|
108
110
|
"python": ("http://docs.python.org/", None),
|
|
109
111
|
"coredis": ("https://coredis.readthedocs.io/en/latest/", None),
|
|
110
|
-
"
|
|
112
|
+
"memcachio": ("https://memcachio.readthedocs.io/en/latest/", None),
|
|
111
113
|
"motor": ("https://motor.readthedocs.io/en/stable/", None),
|
|
112
114
|
"redis-py-cluster": ("https://redis-py-cluster.readthedocs.io/en/latest/", None),
|
|
113
115
|
"redis-py": ("https://redis-py.readthedocs.io/en/latest/", None),
|
|
114
116
|
"pymemcache": ("https://pymemcache.readthedocs.io/en/latest/", None),
|
|
115
117
|
"pymongo": ("https://pymongo.readthedocs.io/en/stable/", None),
|
|
116
|
-
"python-etcd3": ("https://python-etcd3.readthedocs.io/en/latest/", None),
|
|
117
|
-
"aetcd": ("https://aetcd.readthedocs.io/en/latest/", None),
|
|
118
118
|
"valkey-py": ("https://valkey-py.readthedocs.io/en/latest/", None),
|
|
119
119
|
}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
.plot-container {
|
|
2
|
-
filter: invert(100%);
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
body[data-theme="light"] .plot-container {
|
|
6
|
-
filter: invert(0);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
1
|
.benchmark-chart {
|
|
10
2
|
width: 100%;
|
|
11
3
|
}
|
|
@@ -76,6 +68,11 @@ body[data-theme="light"] .plot-container {
|
|
|
76
68
|
}
|
|
77
69
|
}
|
|
78
70
|
|
|
71
|
+
.compare-dropdown {
|
|
72
|
+
display: flex;
|
|
73
|
+
justify-content: flex-end;
|
|
74
|
+
}
|
|
75
|
+
|
|
79
76
|
.benchmark-filter {
|
|
80
77
|
display: flex;
|
|
81
78
|
flex-direction: row;
|
|
@@ -83,15 +80,15 @@ body[data-theme="light"] .plot-container {
|
|
|
83
80
|
padding: 0.25em;
|
|
84
81
|
}
|
|
85
82
|
|
|
86
|
-
.benchmark-filter label
|
|
83
|
+
.benchmark-filter label,
|
|
84
|
+
.compare-filter label {
|
|
87
85
|
font-size: small;
|
|
88
86
|
font-weight: bold;
|
|
89
87
|
}
|
|
90
88
|
|
|
91
|
-
.benchmark-filter select
|
|
89
|
+
.benchmark-filter select,
|
|
90
|
+
.compare-filter select {
|
|
92
91
|
font-size: small;
|
|
93
92
|
border: 1px solid;
|
|
94
93
|
border-radius: 0.4em;
|
|
95
94
|
}
|
|
96
|
-
.benchmark-filter input[type="checkbox"] {
|
|
97
|
-
}
|