limits 5.5.0__tar.gz → 5.7.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 (145) hide show
  1. limits-5.7.0/.devcontainer/devcontainer.json +28 -0
  2. limits-5.7.0/.github/FUNDING.yml +2 -0
  3. limits-5.7.0/.github/ISSUE_TEMPLATE/bug-report.md +39 -0
  4. limits-5.7.0/.github/ISSUE_TEMPLATE/feature.md +17 -0
  5. limits-5.7.0/.github/dependabot.yml +11 -0
  6. limits-5.7.0/.github/workflows/compatibility.yml +71 -0
  7. limits-5.7.0/.github/workflows/main.yml +265 -0
  8. limits-5.7.0/.gitignore +15 -0
  9. limits-5.7.0/.readthedocs.yml +12 -0
  10. limits-5.7.0/CODE_OF_CONDUCT.md +128 -0
  11. {limits-5.5.0 → limits-5.7.0}/HISTORY.rst +20 -0
  12. {limits-5.5.0 → limits-5.7.0}/MANIFEST.in +0 -5
  13. limits-5.7.0/Makefile +11 -0
  14. {limits-5.5.0 → limits-5.7.0}/PKG-INFO +27 -46
  15. limits-5.7.0/_netlify_headers +6 -0
  16. {limits-5.5.0 → limits-5.7.0}/doc/source/index.rst +2 -2
  17. limits-5.7.0/docker-compose.yml +267 -0
  18. {limits-5.5.0 → limits-5.7.0}/limits/__init__.py +1 -1
  19. limits-5.7.0/limits/_version.py +34 -0
  20. limits-5.7.0/limits/_version.pyi +1 -0
  21. {limits-5.5.0 → limits-5.7.0}/limits/storage/mongodb.py +29 -29
  22. limits-5.7.0/push-release.sh +8 -0
  23. limits-5.7.0/pyproject.toml +147 -0
  24. limits-5.7.0/pytest.ini +26 -0
  25. limits-5.7.0/scripts/github_release_notes.sh +19 -0
  26. limits-5.7.0/tag.sh +71 -0
  27. limits-5.7.0/tests/__init__.py +0 -0
  28. limits-5.7.0/tests/aio/__init__.py +0 -0
  29. limits-5.7.0/tests/aio/storage/__init__.py +0 -0
  30. limits-5.7.0/tests/aio/storage/test_memory.py +17 -0
  31. limits-5.7.0/tests/aio/storage/test_redis.py +21 -0
  32. limits-5.7.0/tests/aio/test_storage.py +462 -0
  33. limits-5.7.0/tests/aio/test_strategy.py +361 -0
  34. limits-5.7.0/tests/benchmarks/__init__.py +0 -0
  35. limits-5.7.0/tests/benchmarks/conftest.py +60 -0
  36. limits-5.7.0/tests/benchmarks/test_storage.py +266 -0
  37. limits-5.7.0/tests/conftest.py +383 -0
  38. limits-5.7.0/tests/data/memcached_auth.txt +2 -0
  39. limits-5.7.0/tests/integration/test_concurrency.py +171 -0
  40. limits-5.7.0/tests/storage/__init__.py +0 -0
  41. limits-5.7.0/tests/storage/test_memory.py +17 -0
  42. limits-5.7.0/tests/storage/test_redis.py +26 -0
  43. limits-5.7.0/tests/tls/ca.crt +31 -0
  44. limits-5.7.0/tests/tls/ca.key +52 -0
  45. limits-5.7.0/tests/tls/ca.txt +1 -0
  46. limits-5.7.0/tests/tls/client.crt +26 -0
  47. limits-5.7.0/tests/tls/client.key +28 -0
  48. limits-5.7.0/tests/tls/openssl.cnf +7 -0
  49. limits-5.7.0/tests/tls/redis.crt +25 -0
  50. limits-5.7.0/tests/tls/redis.dh +8 -0
  51. limits-5.7.0/tests/tls/redis.key +28 -0
  52. limits-5.7.0/tests/tls/server.crt +26 -0
  53. limits-5.7.0/tests/tls/server.key +28 -0
  54. limits-5.7.0/tests/utils.py +305 -0
  55. limits-5.7.0/uv.lock +2592 -0
  56. limits-5.5.0/CLASSIFIERS +0 -12
  57. limits-5.5.0/limits/_version.py +0 -21
  58. limits-5.5.0/limits/version.py +0 -3
  59. limits-5.5.0/limits.egg-info/PKG-INFO +0 -279
  60. limits-5.5.0/limits.egg-info/SOURCES.txt +0 -95
  61. limits-5.5.0/limits.egg-info/dependency_links.txt +0 -1
  62. limits-5.5.0/limits.egg-info/not-zip-safe +0 -1
  63. limits-5.5.0/limits.egg-info/requires.txt +0 -40
  64. limits-5.5.0/limits.egg-info/top_level.txt +0 -1
  65. limits-5.5.0/pyproject.toml +0 -25
  66. limits-5.5.0/requirements/ci.txt +0 -1
  67. limits-5.5.0/requirements/dev.txt +0 -9
  68. limits-5.5.0/requirements/docs.txt +0 -11
  69. limits-5.5.0/requirements/main.txt +0 -3
  70. limits-5.5.0/requirements/storage/async-memcached.txt +0 -1
  71. limits-5.5.0/requirements/storage/async-mongodb.txt +0 -1
  72. limits-5.5.0/requirements/storage/async-redis.txt +0 -1
  73. limits-5.5.0/requirements/storage/async-valkey.txt +0 -1
  74. limits-5.5.0/requirements/storage/memcached.txt +0 -1
  75. limits-5.5.0/requirements/storage/mongodb.txt +0 -1
  76. limits-5.5.0/requirements/storage/redis.txt +0 -1
  77. limits-5.5.0/requirements/storage/rediscluster.txt +0 -1
  78. limits-5.5.0/requirements/storage/valkey.txt +0 -1
  79. limits-5.5.0/requirements/test.txt +0 -23
  80. limits-5.5.0/setup.cfg +0 -30
  81. limits-5.5.0/setup.py +0 -67
  82. limits-5.5.0/versioneer.py +0 -2277
  83. {limits-5.5.0 → limits-5.7.0}/CONTRIBUTIONS.rst +0 -0
  84. {limits-5.5.0 → limits-5.7.0}/LICENSE.txt +0 -0
  85. {limits-5.5.0 → limits-5.7.0}/README.rst +0 -0
  86. {limits-5.5.0 → limits-5.7.0}/doc/Makefile +0 -0
  87. {limits-5.5.0 → limits-5.7.0}/doc/source/_static/custom.css +0 -0
  88. {limits-5.5.0 → limits-5.7.0}/doc/source/api.rst +0 -0
  89. {limits-5.5.0 → limits-5.7.0}/doc/source/async.rst +0 -0
  90. {limits-5.5.0 → limits-5.7.0}/doc/source/changelog.rst +0 -0
  91. {limits-5.5.0 → limits-5.7.0}/doc/source/conf.py +0 -0
  92. {limits-5.5.0 → limits-5.7.0}/doc/source/custom-storage.rst +0 -0
  93. {limits-5.5.0 → limits-5.7.0}/doc/source/ext/_static/benchmark-chart.css +0 -0
  94. {limits-5.5.0 → limits-5.7.0}/doc/source/ext/_static/js/benchmark-chart.js +0 -0
  95. {limits-5.5.0 → limits-5.7.0}/doc/source/ext/_static/js/benchmark-details.js +0 -0
  96. {limits-5.5.0 → limits-5.7.0}/doc/source/ext/_static/js/benchmark-loader.js +0 -0
  97. {limits-5.5.0 → limits-5.7.0}/doc/source/ext/_templates/git_info.js +0 -0
  98. {limits-5.5.0 → limits-5.7.0}/doc/source/ext/bench_chart.py +0 -0
  99. {limits-5.5.0 → limits-5.7.0}/doc/source/installation.rst +0 -0
  100. {limits-5.5.0 → limits-5.7.0}/doc/source/performance.rst +0 -0
  101. {limits-5.5.0 → limits-5.7.0}/doc/source/quickstart.rst +0 -0
  102. {limits-5.5.0 → limits-5.7.0}/doc/source/storage.rst +0 -0
  103. {limits-5.5.0 → limits-5.7.0}/doc/source/strategies.rst +0 -0
  104. {limits-5.5.0 → limits-5.7.0}/doc/source/theme_config.py +0 -0
  105. {limits-5.5.0 → limits-5.7.0}/limits/aio/__init__.py +0 -0
  106. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/__init__.py +0 -0
  107. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/base.py +0 -0
  108. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/memcached/__init__.py +0 -0
  109. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/memcached/bridge.py +0 -0
  110. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/memcached/emcache.py +0 -0
  111. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/memcached/memcachio.py +0 -0
  112. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/memory.py +0 -0
  113. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/mongodb.py +0 -0
  114. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/redis/__init__.py +0 -0
  115. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/redis/bridge.py +0 -0
  116. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/redis/coredis.py +0 -0
  117. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/redis/redispy.py +0 -0
  118. {limits-5.5.0 → limits-5.7.0}/limits/aio/storage/redis/valkey.py +0 -0
  119. {limits-5.5.0 → limits-5.7.0}/limits/aio/strategies.py +0 -0
  120. {limits-5.5.0 → limits-5.7.0}/limits/errors.py +0 -0
  121. {limits-5.5.0 → limits-5.7.0}/limits/limits.py +0 -0
  122. {limits-5.5.0 → limits-5.7.0}/limits/py.typed +0 -0
  123. {limits-5.5.0 → limits-5.7.0}/limits/resources/redis/lua_scripts/acquire_moving_window.lua +0 -0
  124. {limits-5.5.0 → limits-5.7.0}/limits/resources/redis/lua_scripts/acquire_sliding_window.lua +0 -0
  125. {limits-5.5.0 → limits-5.7.0}/limits/resources/redis/lua_scripts/clear_keys.lua +0 -0
  126. {limits-5.5.0 → limits-5.7.0}/limits/resources/redis/lua_scripts/incr_expire.lua +0 -0
  127. {limits-5.5.0 → limits-5.7.0}/limits/resources/redis/lua_scripts/moving_window.lua +0 -0
  128. {limits-5.5.0 → limits-5.7.0}/limits/resources/redis/lua_scripts/sliding_window.lua +0 -0
  129. {limits-5.5.0 → limits-5.7.0}/limits/storage/__init__.py +0 -0
  130. {limits-5.5.0 → limits-5.7.0}/limits/storage/base.py +0 -0
  131. {limits-5.5.0 → limits-5.7.0}/limits/storage/memcached.py +0 -0
  132. {limits-5.5.0 → limits-5.7.0}/limits/storage/memory.py +0 -0
  133. {limits-5.5.0 → limits-5.7.0}/limits/storage/redis.py +0 -0
  134. {limits-5.5.0 → limits-5.7.0}/limits/storage/redis_cluster.py +0 -0
  135. {limits-5.5.0 → limits-5.7.0}/limits/storage/redis_sentinel.py +0 -0
  136. {limits-5.5.0 → limits-5.7.0}/limits/storage/registry.py +0 -0
  137. {limits-5.5.0 → limits-5.7.0}/limits/strategies.py +0 -0
  138. {limits-5.5.0 → limits-5.7.0}/limits/typing.py +0 -0
  139. {limits-5.5.0 → limits-5.7.0}/limits/util.py +0 -0
  140. {limits-5.5.0 → limits-5.7.0}/tests/test_limit_granularities.py +0 -0
  141. {limits-5.5.0 → limits-5.7.0}/tests/test_limits.py +0 -0
  142. {limits-5.5.0 → limits-5.7.0}/tests/test_ratelimit_parser.py +0 -0
  143. {limits-5.5.0 → limits-5.7.0}/tests/test_storage.py +0 -0
  144. {limits-5.5.0 → limits-5.7.0}/tests/test_strategy.py +0 -0
  145. {limits-5.5.0 → limits-5.7.0}/tests/test_utils.py +0 -0
@@ -0,0 +1,28 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/python
3
+ {
4
+ "name": "Python 3",
5
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
+ "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
7
+ "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",
8
+ "workspaceFolder": "/workspace",
9
+ // Features to add to the dev container. More info: https://containers.dev/features.
10
+ "features": {
11
+ "ghcr.io/devcontainers/features/docker-in-docker:2": {}
12
+ },
13
+ "mounts": [
14
+ "type=bind,source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,readonly"
15
+ ],
16
+
17
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
18
+ // "forwardPorts": [],
19
+
20
+ // Use 'postCreateCommand' to run commands after the container is created.
21
+ "postCreateCommand": "pip install --no-binary protobuf -r requirements/ci.txt"
22
+
23
+ // Configure tool-specific properties.
24
+ // "customizations": {},
25
+
26
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
27
+ // "remoteUser": "root"
28
+ }
@@ -0,0 +1,2 @@
1
+ github: alisaifee
2
+ open_collective: limits
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Submit a bug report
4
+ labels: 'bug'
5
+
6
+ ---
7
+
8
+ <!--- Provide a general summary of the issue in the Title above -->
9
+
10
+ ## Expected Behaviour
11
+
12
+ <!--- What should happen -->
13
+
14
+ ## Current Behaviour
15
+
16
+ <!--- What happens instead of the expected behaviour -->
17
+
18
+ ## Steps to Reproduce
19
+
20
+ <!---
21
+ Provide a link to an example, or an unambiguous set of steps to
22
+ reproduce this bug. Include code to reproduce, if relevant
23
+ --->
24
+ 1.
25
+ 1.
26
+ 1.
27
+ 1.
28
+
29
+ ## Your Environment
30
+
31
+ <!--- Include as many relevant details about the environment you experienced the bug in -->
32
+
33
+ - limits version:
34
+ - Operating system:
35
+
36
+ <!--
37
+ You can freely edit this text. Remove any lines you believe are unnecessary.
38
+ -->
39
+
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Feature or Enhancement
3
+ about: Propose a new feature or enhancement
4
+ labels: 'enhancement'
5
+
6
+ ---
7
+
8
+ <!--- Provide a general summary of the proposal in the Title above -->
9
+
10
+ ## Expected Behaviour
11
+
12
+ <!--- How should this new feature work -->
13
+
14
+ <!--
15
+ You can freely edit this text. Remove any lines you believe are unnecessary.
16
+ -->
17
+
@@ -0,0 +1,11 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "uv"
9
+ directory: "/"
10
+ schedule:
11
+ interval: "daily"
@@ -0,0 +1,71 @@
1
+ name: Compatibility
2
+
3
+ on:
4
+ push:
5
+ branches: ['master']
6
+ tags: ['*']
7
+ schedule:
8
+ - cron: 0 23 * * *
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ service_version: ["ALL_LATEST=true"]
16
+ async_redis_implementation: ["coredis"]
17
+ marker: [not integration]
18
+ include:
19
+ - service_version: "LIMITS_REDIS_SERVER_VERSION=8.0"
20
+ marker: "redis or redis_cluster or redis_sentinel"
21
+ - service_version: "LIMITS_REDIS_SERVER_VERSION=7.4"
22
+ marker: "redis or redis_cluster or redis_sentinel"
23
+ - service_version: "LIMITS_REDIS_SERVER_VERSION=7.2"
24
+ marker: "redis or redis_cluster or redis_sentinel"
25
+ - service_version: "LIMITS_REDIS_SERVER_VERSION=7.0"
26
+ marker: "redis or redis_cluster or redis_sentinel"
27
+ - service_version: "LIMITS_REDIS_SERVER_VERSION=7.4"
28
+ marker: "redis or redis_cluster or redis_sentinel"
29
+ async_redis_implementation: "redispy"
30
+ - service_version: "LIMITS_REDIS_SERVER_VERSION=7.2"
31
+ marker: "redis or redis_cluster or redis_sentinel"
32
+ async_redis_implementation: "redispy"
33
+ - service_version: "LIMITS_REDIS_SERVER_VERSION=7.0"
34
+ marker: "redis or redis_cluster or redis_sentinel"
35
+ async_redis_implementation: "redispy"
36
+ - service_version: "LIMITS_MONGODB_SERVER_VERSION=8.0"
37
+ marker: "mongodb"
38
+ - service_version: "LIMITS_MONGODB_SERVER_VERSION=7.0"
39
+ marker: "mongodb"
40
+ - service_version: "LIMITS_MONGODB_SERVER_VERSION=6.0"
41
+ marker: "mongodb"
42
+ - service_version: "LIMITS_MONGODB_SERVER_VERSION=5.0"
43
+ marker: "mongodb"
44
+ - service_version: "LIMITS_MEMCACHED_SERVER_VERSION=1.6.15"
45
+ marker: "memcached"
46
+ - service_version: "LIMITS_MEMCACHED_SERVER_VERSION=1.6.6"
47
+ marker: "memcached"
48
+ - service_version: "LIMITS_MEMCACHED_SERVER_VERSION=1.5.16"
49
+ marker: "memcached"
50
+ - service_version: "LIMITS_VALKEY_SERVER_VERSION=7.2"
51
+ marker: "valkey"
52
+ - service_version: "LIMITS_VALKEY_SERVER_VERSION=8.0"
53
+ marker: "valkey"
54
+
55
+ steps:
56
+ - uses: actions/checkout@v4
57
+ - name: Install uv and Python
58
+ uses: astral-sh/setup-uv@v6
59
+ with:
60
+ enable-cache: true
61
+ python-version: ${{ matrix.python-version }}
62
+ - name: Setup uv venv
63
+ run: |
64
+ uv sync --locked --all-extras --group ci
65
+ - name: Tests
66
+ env:
67
+ CI: "True"
68
+ ASYNC_REDIS_IMPLEMENTATION: "${{ matrix.async_redis_implementation }}"
69
+ run: |
70
+ eval "export ${{ matrix.service_version }}"
71
+ uv run py.test -m "${{ matrix.marker }} and not benchmark" --cov-report=xml --cov-branch --max-runs=3
@@ -0,0 +1,265 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ lint:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - name: Install uv and Python
14
+ uses: astral-sh/setup-uv@v6
15
+ with:
16
+ enable-cache: true
17
+ python-version: ${{ matrix.python-version }}
18
+ - name: Setup uv venv
19
+ run: |
20
+ uv sync --locked --all-extras --group ci
21
+ - name: Lint with ruff
22
+ run: |
23
+ uv run ruff check --select I limits tests
24
+ uv run ruff format --check limits tests
25
+ uv run ruff check limits tests
26
+ - name: Check types
27
+ run: |
28
+ uv run mypy limits
29
+ test:
30
+ strategy:
31
+ fail-fast: false
32
+ matrix:
33
+ python-version: ["3.10"]
34
+ marker: [not (integration or benchmark)]
35
+ os: [ubuntu-latest]
36
+ async_redis_implementation: ["coredis"]
37
+ include:
38
+ - python-version: "3.10"
39
+ marker: 'not benchmark'
40
+ os: ubuntu-latest
41
+ - python-version: "3.11"
42
+ marker: 'not benchmark'
43
+ os: ubuntu-latest
44
+ - python-version: "3.12"
45
+ marker: 'not benchmark'
46
+ os: ubuntu-latest
47
+ - python-version: "3.12"
48
+ marker: 'not benchmark and (redis or redis_cluster or redis_sentinel) and asyncio'
49
+ os: ubuntu-latest
50
+ async_redis_implementation: "redispy"
51
+ - python-version: "3.13"
52
+ marker: 'not benchmark and (redis or redis_cluster or redis_sentinel) and asyncio'
53
+ os: ubuntu-latest
54
+ async_redis_implementation: "redispy"
55
+ - python-version: "3.12"
56
+ marker: 'not benchmark and (memcached and asyncio)'
57
+ os: ubuntu-latest
58
+ async_memcached_implementation: "emcache"
59
+ - python-version: "3.13"
60
+ marker: 'not benchmark'
61
+ os: ubuntu-latest
62
+ - python-version: "3.14"
63
+ marker: 'not benchmark'
64
+ os: ubuntu-latest
65
+ runs-on: "${{ matrix.os }}"
66
+ steps:
67
+ - uses: actions/checkout@v4
68
+ - name: Install uv and Python
69
+ uses: astral-sh/setup-uv@v6
70
+ with:
71
+ enable-cache: true
72
+ python-version: ${{ matrix.python-version }}
73
+ - name: Setup uv venv
74
+ run: |
75
+ uv sync --locked --all-extras --group ci
76
+ - name: Tests
77
+ env:
78
+ CI: "True"
79
+ ASYNC_REDIS_IMPLEMENTATION: "${{ matrix.async_redis_implementation }}"
80
+ ASYNC_MEMCACHED_IMPLEMENTATION: "${{ matrix.async_memcached_implementation }}"
81
+ run: |
82
+ uv run py.test -m "${{ matrix.marker }}" --junitxml=junit.xml -o junit_family=legacy --cov-branch --max-runs=3
83
+ - name: Upload coverage to Codecov
84
+ uses: codecov/codecov-action@v5
85
+ env:
86
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
87
+ - name: Upload test results to Codecov
88
+ if: ${{ !cancelled() }}
89
+ uses: codecov/test-results-action@v1
90
+ with:
91
+ token: ${{ secrets.CODECOV_TOKEN }}
92
+
93
+ benchmark:
94
+ needs: [lint]
95
+ runs-on: ubuntu-latest
96
+ strategy:
97
+ matrix:
98
+ python-version: ["3.13"]
99
+ env:
100
+ BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
101
+ COMMIT: ${{ github.sha }}
102
+ steps:
103
+ - uses: actions/checkout@v4
104
+ - name: Install uv and Python
105
+ uses: astral-sh/setup-uv@v6
106
+ with:
107
+ enable-cache: true
108
+ python-version: ${{ matrix.python-version }}
109
+ - name: Setup uv venv
110
+ run: |
111
+ uv sync --locked --all-extras --group ci
112
+ - name: Set up Node
113
+ uses: actions/setup-node@v4
114
+ - name: Install dependencies
115
+ run: |
116
+ npm install -g netlify-cli
117
+ - name: Benchmark
118
+ env:
119
+ CI: "True"
120
+ run: |
121
+ mkdir -p benchmarks
122
+ uv run pytest -m "benchmark" --benchmark-json=benchmarks/full.json
123
+ - name: Split results
124
+ run: |
125
+ mv benchmarks/full.json benchmarks/full_raw.json
126
+ jq '.benchmarks |= map(. + {name: (.name | sub("^test_"; "")), fullname: (.fullname | sub("^.*::test_"; ""))})' benchmarks/full_raw.json > benchmarks/benchmark.json
127
+ jq '.benchmarks |= map(del(.stats.data))' benchmarks/benchmark.json > benchmarks/benchmark-summary.json
128
+ storages=("memory" "redis" "memcached" "mongodb");
129
+ for storage in "${storages[@]}"; do
130
+ cat benchmarks/benchmark.json | jq --arg storage "$storage" '.benchmarks |= map(select(.params.storage_type==$storage))' > benchmarks/benchmark-$storage.json
131
+ cat benchmarks/benchmark-summary.json | jq --arg storage "$storage" '.benchmarks |= map(select(.params.storage_type==$storage))' > benchmarks/benchmark-$storage-summary.json
132
+ done
133
+ rm benchmarks/full_raw.json
134
+ - name: Upload benchmark results
135
+ if: github.repository_owner == 'alisaifee' && github.event_name == 'push'
136
+ uses: actions/upload-artifact@v4
137
+ with:
138
+ name: benchmark
139
+ path: benchmarks/*
140
+ - name: Deploy to Netlify
141
+ if: github.repository_owner == 'alisaifee' && github.event_name == 'push'
142
+ env:
143
+ NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
144
+ run: |
145
+ cp _netlify_headers benchmarks/_headers
146
+ netlify deploy --site ${{ secrets.NETLIFY_SITE_ID }} --alias $COMMIT --dir=benchmarks --message "Benchmarks for $COMMIT"
147
+ netlify deploy --site ${{ secrets.NETLIFY_SITE_ID }} --alias $BRANCH_NAME --dir=benchmarks --message "Benchmarks for $BRANCH_NAME"
148
+ build_wheels:
149
+ needs: [lint]
150
+ name: Build wheel
151
+ runs-on: ubuntu-latest
152
+ steps:
153
+ - uses: actions/checkout@v4
154
+ with:
155
+ fetch-depth: 0
156
+ - name: Install uv and Python
157
+ uses: astral-sh/setup-uv@v6
158
+ with:
159
+ enable-cache: true
160
+ python-version: ${{ matrix.python-version }}
161
+ - name: Setup uv venv
162
+ run: |
163
+ uv sync --locked --all-extras --group ci
164
+ - name: Build wheels
165
+ run: |
166
+ uv build --wheel
167
+ - uses: actions/upload-artifact@v4
168
+ with:
169
+ name: wheels
170
+ path: ./dist/*.whl
171
+ build_sdist:
172
+ needs: [lint]
173
+ name: Build source distribution
174
+ runs-on: ubuntu-latest
175
+ steps:
176
+ - uses: actions/checkout@v4
177
+ with:
178
+ fetch-depth: 0
179
+ - name: Install uv and Python
180
+ uses: astral-sh/setup-uv@v6
181
+ with:
182
+ enable-cache: true
183
+ python-version: ${{ matrix.python-version }}
184
+ - name: Setup uv venv
185
+ run: |
186
+ uv sync --locked --all-extras --group ci
187
+ - name: Build sdist
188
+ run: |
189
+ uv build --sdist
190
+ - uses: actions/upload-artifact@v4
191
+ with:
192
+ name: src_dist
193
+ path: dist/*.tar.gz
194
+ upload_pypi:
195
+ needs: [test, build_wheels, build_sdist]
196
+ runs-on: ubuntu-latest
197
+ if: github.ref == 'refs/heads/master'
198
+ permissions:
199
+ id-token: write
200
+ steps:
201
+ - uses: actions/download-artifact@v4
202
+ with:
203
+ name: wheels
204
+ path: dist
205
+ - uses: actions/download-artifact@v4
206
+ with:
207
+ name: src_dist
208
+ path: dist
209
+ - uses: pypa/gh-action-pypi-publish@release/v1
210
+ with:
211
+ repository_url: https://test.pypi.org/legacy/
212
+ skip_existing: true
213
+ upload_pypi_release:
214
+ needs: [test, benchmark, build_wheels, build_sdist]
215
+ runs-on: ubuntu-latest
216
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
217
+ permissions:
218
+ id-token: write
219
+ steps:
220
+ - uses: actions/download-artifact@v4
221
+ with:
222
+ name: wheels
223
+ path: dist
224
+ - uses: actions/download-artifact@v4
225
+ with:
226
+ name: src_dist
227
+ path: dist
228
+ - uses: pypa/gh-action-pypi-publish@release/v1
229
+ github_release:
230
+ needs: [upload_pypi_release]
231
+ name: Create Release
232
+ runs-on: ubuntu-latest
233
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
234
+ steps:
235
+ - name: Checkout code
236
+ uses: actions/checkout@v4
237
+ with:
238
+ fetch-depth: 0
239
+ - name: Download wheel artifacts
240
+ uses: actions/download-artifact@v4
241
+ with:
242
+ name: wheels
243
+ path: dist
244
+ - name: Download source artifacts
245
+ uses: actions/download-artifact@v4
246
+ with:
247
+ name: src_dist
248
+ path: dist
249
+ - name: Download benchmark results
250
+ uses: actions/download-artifact@v4
251
+ with:
252
+ name: benchmark
253
+ path: benchmarks
254
+ - name: Generate release notes
255
+ run: |
256
+ ./scripts/github_release_notes.sh > release_notes.md
257
+ - name: Create Release
258
+ uses: ncipollo/release-action@v1
259
+ with:
260
+ artifacts: "dist/*,benchmarks/*"
261
+ bodyFile: release_notes.md
262
+ token: ${{ secrets.GITHUB_TOKEN }}
263
+
264
+
265
+
@@ -0,0 +1,15 @@
1
+ *.pyc
2
+ *.log
3
+ limits/_version.py
4
+ cover/*
5
+ .mypy_cache/*
6
+ .coverage*
7
+ .test_env
8
+ .tool-versions
9
+ .idea
10
+ build/
11
+ dist/
12
+ htmlcov
13
+ *egg-info*
14
+ .python-version
15
+ .*.swp
@@ -0,0 +1,12 @@
1
+ version: 2
2
+ build:
3
+ os: ubuntu-20.04
4
+ tools:
5
+ python: "3.13"
6
+ commands:
7
+ - pip install uv
8
+ - cd doc
9
+ - uv run --group docs python -m sphinx doc/source $READTHEDOCS_OUTPUT/html -b html
10
+
11
+ sphinx:
12
+ configuration: doc/source/conf.py
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ .
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
@@ -3,6 +3,25 @@
3
3
  Changelog
4
4
  =========
5
5
 
6
+ v5.7.0
7
+ ------
8
+ Release Date: 2026-02-03
9
+
10
+ * Compatibility
11
+
12
+ * Relax extras constraints for redis (<8)
13
+
14
+ v5.6.0
15
+ ------
16
+ Release Date: 2025-09-29
17
+
18
+ * Development
19
+
20
+ * Move all project metadata to pyproject
21
+ * Use uv for development
22
+ * Use hatch for package build
23
+ * Remove versioneer for versioning
24
+
6
25
  v5.5.0
7
26
  ------
8
27
  Release Date: 2025-08-05
@@ -888,3 +907,4 @@ Release Date: 2015-01-08
888
907
 
889
908
 
890
909
 
910
+
@@ -3,12 +3,7 @@ include LICENSE.txt
3
3
  include HISTORY.rst
4
4
  include CONTRIBUTIONS.rst
5
5
  include CLASSIFIERS
6
- include versioneer.py
7
- recursive-include requirements *.txt
8
- recursive-include requirements/storage *.txt
9
6
  recursive-include doc/source *
10
7
  recursive-include doc *.py Make*
11
- include limits/_version.py
12
- include limits/py.typed
13
8
  recursive-include limits *.lua
14
9
  recursive-include limits/resources *
limits-5.7.0/Makefile ADDED
@@ -0,0 +1,11 @@
1
+ lint:
2
+ uv run ruff check --select I limits tests doc
3
+ uv run ruff check limits tests doc
4
+ uv run ruff format --check limits tests doc
5
+ uv run mypy limits
6
+
7
+ lint-fix:
8
+ uv run ruff check --select I --fix limits tests doc
9
+ uv run ruff check --fix limits tests doc
10
+ uv run ruff format limits tests doc
11
+ uv run mypy limits