limits 3.4.0__tar.gz → 3.6.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 (84) hide show
  1. {limits-3.4.0 → limits-3.6.0}/CLASSIFIERS +0 -1
  2. {limits-3.4.0 → limits-3.6.0}/HISTORY.rst +27 -0
  3. {limits-3.4.0 → limits-3.6.0}/PKG-INFO +1 -2
  4. {limits-3.4.0 → limits-3.6.0}/limits/_version.py +3 -3
  5. {limits-3.4.0 → limits-3.6.0}/limits/aio/storage/mongodb.py +0 -1
  6. {limits-3.4.0 → limits-3.6.0}/limits/aio/storage/redis.py +0 -7
  7. {limits-3.4.0 → limits-3.6.0}/limits/resources/redis/lua_scripts/acquire_moving_window.lua +4 -5
  8. {limits-3.4.0 → limits-3.6.0}/limits/storage/mongodb.py +0 -1
  9. {limits-3.4.0 → limits-3.6.0}/limits/storage/redis_sentinel.py +1 -6
  10. {limits-3.4.0 → limits-3.6.0}/limits.egg-info/PKG-INFO +1 -2
  11. {limits-3.4.0 → limits-3.6.0}/limits.egg-info/requires.txt +3 -8
  12. {limits-3.4.0 → limits-3.6.0}/requirements/docs.txt +4 -4
  13. {limits-3.4.0 → limits-3.6.0}/requirements/main.txt +0 -1
  14. limits-3.6.0/requirements/storage/async-redis.txt +1 -0
  15. limits-3.6.0/requirements/storage/redis.txt +1 -0
  16. {limits-3.4.0 → limits-3.6.0}/requirements/test.txt +3 -0
  17. {limits-3.4.0 → limits-3.6.0}/tests/test_strategy.py +10 -0
  18. limits-3.4.0/requirements/storage/async-redis.txt +0 -1
  19. limits-3.4.0/requirements/storage/redis.txt +0 -1
  20. {limits-3.4.0 → limits-3.6.0}/CONTRIBUTIONS.rst +0 -0
  21. {limits-3.4.0 → limits-3.6.0}/LICENSE.txt +0 -0
  22. {limits-3.4.0 → limits-3.6.0}/MANIFEST.in +0 -0
  23. {limits-3.4.0 → limits-3.6.0}/README.rst +0 -0
  24. {limits-3.4.0 → limits-3.6.0}/doc/Makefile +0 -0
  25. {limits-3.4.0 → limits-3.6.0}/doc/source/_static/custom.css +0 -0
  26. {limits-3.4.0 → limits-3.6.0}/doc/source/api.rst +0 -0
  27. {limits-3.4.0 → limits-3.6.0}/doc/source/async.rst +0 -0
  28. {limits-3.4.0 → limits-3.6.0}/doc/source/changelog.rst +0 -0
  29. {limits-3.4.0 → limits-3.6.0}/doc/source/conf.py +0 -0
  30. {limits-3.4.0 → limits-3.6.0}/doc/source/custom-storage.rst +0 -0
  31. {limits-3.4.0 → limits-3.6.0}/doc/source/index.rst +0 -0
  32. {limits-3.4.0 → limits-3.6.0}/doc/source/installation.rst +0 -0
  33. {limits-3.4.0 → limits-3.6.0}/doc/source/quickstart.rst +0 -0
  34. {limits-3.4.0 → limits-3.6.0}/doc/source/storage.rst +0 -0
  35. {limits-3.4.0 → limits-3.6.0}/doc/source/strategies.rst +0 -0
  36. {limits-3.4.0 → limits-3.6.0}/doc/source/theme_config.py +0 -0
  37. {limits-3.4.0 → limits-3.6.0}/limits/__init__.py +0 -0
  38. {limits-3.4.0 → limits-3.6.0}/limits/aio/__init__.py +0 -0
  39. {limits-3.4.0 → limits-3.6.0}/limits/aio/storage/__init__.py +0 -0
  40. {limits-3.4.0 → limits-3.6.0}/limits/aio/storage/base.py +0 -0
  41. {limits-3.4.0 → limits-3.6.0}/limits/aio/storage/etcd.py +0 -0
  42. {limits-3.4.0 → limits-3.6.0}/limits/aio/storage/memcached.py +0 -0
  43. {limits-3.4.0 → limits-3.6.0}/limits/aio/storage/memory.py +0 -0
  44. {limits-3.4.0 → limits-3.6.0}/limits/aio/strategies.py +0 -0
  45. {limits-3.4.0 → limits-3.6.0}/limits/errors.py +0 -0
  46. {limits-3.4.0 → limits-3.6.0}/limits/limits.py +0 -0
  47. {limits-3.4.0 → limits-3.6.0}/limits/py.typed +0 -0
  48. {limits-3.4.0 → limits-3.6.0}/limits/resources/redis/lua_scripts/clear_keys.lua +0 -0
  49. {limits-3.4.0 → limits-3.6.0}/limits/resources/redis/lua_scripts/incr_expire.lua +0 -0
  50. {limits-3.4.0 → limits-3.6.0}/limits/resources/redis/lua_scripts/moving_window.lua +0 -0
  51. {limits-3.4.0 → limits-3.6.0}/limits/storage/__init__.py +0 -0
  52. {limits-3.4.0 → limits-3.6.0}/limits/storage/base.py +0 -0
  53. {limits-3.4.0 → limits-3.6.0}/limits/storage/etcd.py +0 -0
  54. {limits-3.4.0 → limits-3.6.0}/limits/storage/memcached.py +0 -0
  55. {limits-3.4.0 → limits-3.6.0}/limits/storage/memory.py +0 -0
  56. {limits-3.4.0 → limits-3.6.0}/limits/storage/redis.py +0 -0
  57. {limits-3.4.0 → limits-3.6.0}/limits/storage/redis_cluster.py +0 -0
  58. {limits-3.4.0 → limits-3.6.0}/limits/storage/registry.py +0 -0
  59. {limits-3.4.0 → limits-3.6.0}/limits/strategies.py +0 -0
  60. {limits-3.4.0 → limits-3.6.0}/limits/typing.py +0 -0
  61. {limits-3.4.0 → limits-3.6.0}/limits/util.py +0 -0
  62. {limits-3.4.0 → limits-3.6.0}/limits/version.py +0 -0
  63. {limits-3.4.0 → limits-3.6.0}/limits.egg-info/SOURCES.txt +0 -0
  64. {limits-3.4.0 → limits-3.6.0}/limits.egg-info/dependency_links.txt +0 -0
  65. {limits-3.4.0 → limits-3.6.0}/limits.egg-info/not-zip-safe +0 -0
  66. {limits-3.4.0 → limits-3.6.0}/limits.egg-info/top_level.txt +0 -0
  67. {limits-3.4.0 → limits-3.6.0}/pyproject.toml +0 -0
  68. {limits-3.4.0 → limits-3.6.0}/requirements/ci.txt +0 -0
  69. {limits-3.4.0 → limits-3.6.0}/requirements/dev.txt +0 -0
  70. {limits-3.4.0 → limits-3.6.0}/requirements/storage/async-etcd.txt +0 -0
  71. {limits-3.4.0 → limits-3.6.0}/requirements/storage/async-memcached.txt +0 -0
  72. {limits-3.4.0 → limits-3.6.0}/requirements/storage/async-mongodb.txt +0 -0
  73. {limits-3.4.0 → limits-3.6.0}/requirements/storage/etcd.txt +0 -0
  74. {limits-3.4.0 → limits-3.6.0}/requirements/storage/memcached.txt +0 -0
  75. {limits-3.4.0 → limits-3.6.0}/requirements/storage/mongodb.txt +0 -0
  76. {limits-3.4.0 → limits-3.6.0}/requirements/storage/rediscluster.txt +0 -0
  77. {limits-3.4.0 → limits-3.6.0}/setup.cfg +0 -0
  78. {limits-3.4.0 → limits-3.6.0}/setup.py +0 -0
  79. {limits-3.4.0 → limits-3.6.0}/tests/test_limit_granularities.py +0 -0
  80. {limits-3.4.0 → limits-3.6.0}/tests/test_limits.py +0 -0
  81. {limits-3.4.0 → limits-3.6.0}/tests/test_ratelimit_parser.py +0 -0
  82. {limits-3.4.0 → limits-3.6.0}/tests/test_storage.py +0 -0
  83. {limits-3.4.0 → limits-3.6.0}/tests/test_utils.py +0 -0
  84. {limits-3.4.0 → limits-3.6.0}/versioneer.py +0 -0
@@ -5,7 +5,6 @@ Operating System :: MacOS
5
5
  Operating System :: POSIX :: Linux
6
6
  Operating System :: OS Independent
7
7
  Topic :: Software Development :: Libraries :: Python Modules
8
- Programming Language :: Python :: 3.7
9
8
  Programming Language :: Python :: 3.8
10
9
  Programming Language :: Python :: 3.9
11
10
  Programming Language :: Python :: 3.10
@@ -3,6 +3,31 @@
3
3
  Changelog
4
4
  =========
5
5
 
6
+ v3.6.0
7
+ ------
8
+ Release Date: 2023-08-31
9
+
10
+ * Bug Fix
11
+
12
+ * Remove default socket timeout from mongo storage
13
+ * Ensure _version.py has stable content when generated
14
+ using `git archive` from a tag regardless of when it is
15
+ run.
16
+
17
+ * Compatibility
18
+
19
+ * Remove references to python 3.7
20
+ * Remove unnecessary setuptools dependency
21
+
22
+ v3.5.0
23
+ ------
24
+ Release Date: 2023-05-16
25
+
26
+ * Bug Fix
27
+
28
+ * Handle ``cost`` > 8000 when using redis
29
+ * Remove arbitrary default timeout for redis+sentinel
30
+
6
31
  v3.4.0
7
32
  ------
8
33
  Release Date: 2023-04-17
@@ -598,6 +623,8 @@ Release Date: 2015-01-08
598
623
 
599
624
 
600
625
 
626
+
627
+
601
628
 
602
629
 
603
630
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: limits
3
- Version: 3.4.0
3
+ Version: 3.6.0
4
4
  Summary: Rate limiting utilities
5
5
  Home-page: https://limits.readthedocs.org
6
6
  Author: Ali-Akber Saifee
@@ -14,7 +14,6 @@ Classifier: Operating System :: MacOS
14
14
  Classifier: Operating System :: POSIX :: Linux
15
15
  Classifier: Operating System :: OS Independent
16
16
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
- Classifier: Programming Language :: Python :: 3.7
18
17
  Classifier: Programming Language :: Python :: 3.8
19
18
  Classifier: Programming Language :: Python :: 3.9
20
19
  Classifier: Programming Language :: Python :: 3.10
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2023-04-17T05:34:51-0700",
11
+ "date": "2023-08-31T07:36:32-0700",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "708c0d7f8bbad85f7ff09555517d9718df362e03",
15
- "version": "3.4.0"
14
+ "full-revisionid": "ada96bb4afc9729b4aac2552209a78428a27c313",
15
+ "version": "3.6.0"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -30,7 +30,6 @@ class MongoDBStorage(Storage, MovingWindowSupport):
30
30
 
31
31
  DEFAULT_OPTIONS: Dict[str, Union[float, str, bool]] = {
32
32
  "serverSelectionTimeoutMS": 1000,
33
- "socketTimeoutMS": 1000,
34
33
  "connectTimeoutMS": 1000,
35
34
  }
36
35
  "Default options passed to :class:`~motor.motor_asyncio.AsyncIOMotorClient`"
@@ -349,11 +349,6 @@ class RedisSentinelStorage(RedisStorage):
349
349
  STORAGE_SCHEME = ["async+redis+sentinel"]
350
350
  """The storage scheme for redis accessed via a redis sentinel installation"""
351
351
 
352
- DEFAULT_OPTIONS: Dict[str, Union[float, str, bool]] = {
353
- "stream_timeout": 0.2,
354
- }
355
- "Default options passed to :class:`~coredis.sentinel.Sentinel`"
356
-
357
352
  DEPENDENCIES = {"coredis.sentinel": Version("3.4.0")}
358
353
 
359
354
  def __init__(
@@ -402,8 +397,6 @@ class RedisSentinelStorage(RedisStorage):
402
397
  if self.service_name is None:
403
398
  raise ConfigurationError("'service_name' not provided")
404
399
 
405
- connection_options.setdefault("stream_timeout", 0.2)
406
-
407
400
  super(RedisStorage, self).__init__()
408
401
 
409
402
  self.dependency = self.dependencies["coredis.sentinel"].module
@@ -9,15 +9,14 @@ end
9
9
 
10
10
  local entry = redis.call('lindex', KEYS[1], limit - amount)
11
11
 
12
-
13
12
  if entry and tonumber(entry) >= timestamp - expiry then
14
13
  return false
15
14
  end
16
- local entries= {}
17
- for i=1, amount do
18
- entries[i] = timestamp
15
+
16
+ for i = 1, amount do
17
+ redis.call('lpush', KEYS[1], timestamp)
19
18
  end
20
- redis.call('lpush', KEYS[1], unpack(entries))
19
+
21
20
  redis.call('ltrim', KEYS[1], 0, limit - 1)
22
21
  redis.call('expire', KEYS[1], expiry)
23
22
 
@@ -26,7 +26,6 @@ class MongoDBStorage(Storage, MovingWindowSupport):
26
26
  STORAGE_SCHEME = ["mongodb", "mongodb+srv"]
27
27
  DEFAULT_OPTIONS: Dict[str, Union[int, str, bool]] = {
28
28
  "serverSelectionTimeoutMS": 1000,
29
- "socketTimeoutMS": 1000,
30
29
  "connectTimeoutMS": 1000,
31
30
  }
32
31
  "Default options passed to :class:`~pymongo.mongo_client.MongoClient`"
@@ -21,11 +21,6 @@ class RedisSentinelStorage(RedisStorage):
21
21
  STORAGE_SCHEME = ["redis+sentinel"]
22
22
  """The storage scheme for redis accessed via a redis sentinel installation"""
23
23
 
24
- DEFAULT_OPTIONS: Dict[str, Union[float, str, bool]] = {
25
- "socket_timeout": 0.2,
26
- }
27
- "Default options passed to :class:`~redis.sentinel.Sentinel`"
28
-
29
24
  DEPENDENCIES = {"redis.sentinel": Version("3.0")}
30
25
 
31
26
  def __init__(
@@ -79,7 +74,7 @@ class RedisSentinelStorage(RedisStorage):
79
74
  self.sentinel: "redis.sentinel.Sentinel" = sentinel_dep.Sentinel(
80
75
  sentinel_configuration,
81
76
  sentinel_kwargs={**parsed_auth, **sentinel_options},
82
- **{**self.DEFAULT_OPTIONS, **parsed_auth, **options}
77
+ **{**parsed_auth, **options}
83
78
  )
84
79
  self.storage = self.sentinel.master_for(self.service_name)
85
80
  self.storage_slave = self.sentinel.slave_for(self.service_name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: limits
3
- Version: 3.4.0
3
+ Version: 3.6.0
4
4
  Summary: Rate limiting utilities
5
5
  Home-page: https://limits.readthedocs.org
6
6
  Author: Ali-Akber Saifee
@@ -14,7 +14,6 @@ Classifier: Operating System :: MacOS
14
14
  Classifier: Operating System :: POSIX :: Linux
15
15
  Classifier: Operating System :: OS Independent
16
16
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
- Classifier: Programming Language :: Python :: 3.7
18
17
  Classifier: Programming Language :: Python :: 3.8
19
18
  Classifier: Programming Language :: Python :: 3.9
20
19
  Classifier: Programming Language :: Python :: 3.10
@@ -1,24 +1,21 @@
1
1
  deprecated>=1.2
2
2
  importlib_resources>=1.3
3
- setuptools
4
3
  packaging<24,>=21
5
4
  typing_extensions
6
5
 
7
6
  [all]
8
- redis!=4.5.2,!=4.5.3,<5.0.0,>3
7
+ redis!=4.5.2,!=4.5.3,<6.0.0,>3
9
8
  redis!=4.5.2,!=4.5.3,>=4.2.0
10
9
  pymemcache<5.0.0,>3
11
10
  pymongo<5,>4.1
12
11
  etcd3
12
+ coredis<5,>=3.4.0
13
13
  motor<4,>=3
14
14
  aetcd
15
15
 
16
16
  [all:python_version < "3.11"]
17
17
  emcache>=0.6.1
18
18
 
19
- [all:python_version > "3.7"]
20
- coredis<5,>=3.4.0
21
-
22
19
  [all:python_version >= "3.11"]
23
20
  emcache>=1
24
21
 
@@ -37,8 +34,6 @@ emcache>=1
37
34
  motor<4,>=3
38
35
 
39
36
  [async-redis]
40
-
41
- [async-redis:python_version > "3.7"]
42
37
  coredis<5,>=3.4.0
43
38
 
44
39
  [etcd]
@@ -51,7 +46,7 @@ pymemcache<5.0.0,>3
51
46
  pymongo<5,>4.1
52
47
 
53
48
  [redis]
54
- redis!=4.5.2,!=4.5.3,<5.0.0,>3
49
+ redis!=4.5.2,!=4.5.3,<6.0.0,>3
55
50
 
56
51
  [rediscluster]
57
52
  redis!=4.5.2,!=4.5.3,>=4.2.0
@@ -1,10 +1,10 @@
1
1
  -r main.txt
2
- furo==2023.3.27
3
- Sphinx>=5
2
+ furo==2023.8.19
3
+ Sphinx>=4,<8
4
4
  sphinx-copybutton==0.5.2
5
5
  sphinx-autobuild==2021.3.14
6
6
  sphinxext-opengraph==0.8.2
7
- sphinx-inline-tabs==2022.1.2b11
8
- sphinx-paramlinks==0.5.4
7
+ sphinx-inline-tabs==2023.4.21
8
+ sphinx-paramlinks==0.6.0
9
9
  sphinxcontrib-programoutput==0.17
10
10
 
@@ -1,5 +1,4 @@
1
1
  deprecated>=1.2
2
2
  importlib_resources>=1.3
3
- setuptools
4
3
  packaging>=21,<24
5
4
  typing_extensions
@@ -0,0 +1 @@
1
+ coredis>=3.4.0,<5
@@ -0,0 +1 @@
1
+ redis>3,!=4.5.2,!=4.5.3,<6.0.0
@@ -9,6 +9,9 @@
9
9
  -r storage/async-mongodb.txt
10
10
  -r storage/async-redis.txt
11
11
 
12
+ # Pin to < 4 for aetcd compatibility
13
+ protobuf>3.6.1,<4
14
+
12
15
  # Test related packages
13
16
  coverage
14
17
  hiro>0.1.6
@@ -134,6 +134,16 @@ class TestWindow:
134
134
  limiter.clear(five_per_min)
135
135
  assert limiter.hit(five_per_min)
136
136
 
137
+ @moving_window_storage
138
+ def test_moving_window_huge_cost_sync(self, uri, args, fixture):
139
+ storage = storage_from_string(uri, **args)
140
+ limiter = MovingWindowRateLimiter(storage)
141
+ many_per_min = RateLimitItemPerMinute(1_000_000)
142
+ limiter.hit(many_per_min, cost=1_000_000)
143
+ assert not limiter.hit(many_per_min, cost=2)
144
+ limiter.clear(many_per_min)
145
+ assert limiter.hit(many_per_min)
146
+
137
147
  @pytest.mark.memcached
138
148
  def test_moving_window_memcached(self, memcached):
139
149
  storage = MemcachedStorage("memcached://localhost:22122")
@@ -1 +0,0 @@
1
- coredis>=3.4.0,<5;python_version>"3.7"
@@ -1 +0,0 @@
1
- redis>3,!=4.5.2,!=4.5.3,<5.0.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes