cachebox 6.2.7__tar.gz → 6.2.9__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 (89) hide show
  1. {cachebox-6.2.7 → cachebox-6.2.9}/.github/workflows/CI.yml +96 -30
  2. {cachebox-6.2.7 → cachebox-6.2.9}/.github/workflows/docs.yml +3 -3
  3. {cachebox-6.2.7 → cachebox-6.2.9}/.github/workflows/python-test.yml +5 -5
  4. {cachebox-6.2.7 → cachebox-6.2.9}/.gitignore +0 -1
  5. cachebox-6.2.9/AGENTS.md +42 -0
  6. {cachebox-6.2.7 → cachebox-6.2.9}/Cargo.lock +53 -40
  7. {cachebox-6.2.7 → cachebox-6.2.9}/Cargo.toml +16 -17
  8. {cachebox-6.2.7 → cachebox-6.2.9}/PKG-INFO +14 -11
  9. {cachebox-6.2.7 → cachebox-6.2.9}/README.md +3 -0
  10. {cachebox-6.2.7 → cachebox-6.2.9}/cachebox/__init__.py +3 -1
  11. {cachebox-6.2.7 → cachebox-6.2.9}/cachebox/_cachebox.py +6 -7
  12. {cachebox-6.2.7 → cachebox-6.2.9}/cachebox/_core.pyi +195 -307
  13. {cachebox-6.2.7 → cachebox-6.2.9}/cachebox/_wrappers.py +8 -6
  14. {cachebox-6.2.7 → cachebox-6.2.9}/cachebox/utils.py +39 -24
  15. {cachebox-6.2.7 → cachebox-6.2.9}/docs/docs/algorithms.md +37 -37
  16. {cachebox-6.2.7 → cachebox-6.2.9}/docs/docs/faq.md +5 -3
  17. {cachebox-6.2.7 → cachebox-6.2.9}/docs/docs/getting-started.md +36 -11
  18. {cachebox-6.2.7 → cachebox-6.2.9}/docs/docs/index.md +2 -0
  19. {cachebox-6.2.7 → cachebox-6.2.9}/docs/docs/migration.md +5 -0
  20. {cachebox-6.2.7 → cachebox-6.2.9}/docs/docs/tips.md +25 -8
  21. cachebox-6.2.9/pyproject.toml +83 -0
  22. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/raw.rs +29 -19
  23. cachebox-6.2.9/src/internal/lazyheap.rs +565 -0
  24. {cachebox-6.2.7 → cachebox-6.2.9}/src/internal/onceinit.rs +18 -14
  25. {cachebox-6.2.7 → cachebox-6.2.9}/src/internal/utils.rs +21 -6
  26. {cachebox-6.2.7 → cachebox-6.2.9}/src/lib.rs +2 -0
  27. {cachebox-6.2.7 → cachebox-6.2.9}/src/macro_rules.rs +25 -8
  28. {cachebox-6.2.7 → cachebox-6.2.9}/src/policies/fifopolicy.rs +6 -2
  29. {cachebox-6.2.7 → cachebox-6.2.9}/src/policies/lfupolicy.rs +50 -23
  30. {cachebox-6.2.7 → cachebox-6.2.9}/src/policies/nopolicy.rs +7 -0
  31. {cachebox-6.2.7 → cachebox-6.2.9}/src/policies/rrpolicy.rs +44 -11
  32. {cachebox-6.2.7 → cachebox-6.2.9}/src/policies/ttlpolicy.rs +6 -2
  33. {cachebox-6.2.7 → cachebox-6.2.9}/src/policies/vttlpolicy.rs +52 -24
  34. {cachebox-6.2.7 → cachebox-6.2.9}/src/policies/wrapped.rs +16 -9
  35. {cachebox-6.2.7 → cachebox-6.2.9}/src/pyclasses/cache.rs +112 -109
  36. {cachebox-6.2.7 → cachebox-6.2.9}/src/pyclasses/fifocache.rs +112 -111
  37. {cachebox-6.2.7 → cachebox-6.2.9}/src/pyclasses/lfucache.rs +108 -107
  38. {cachebox-6.2.7 → cachebox-6.2.9}/src/pyclasses/lrucache.rs +112 -114
  39. {cachebox-6.2.7 → cachebox-6.2.9}/src/pyclasses/rrcache.rs +115 -118
  40. {cachebox-6.2.7 → cachebox-6.2.9}/src/pyclasses/ttlcache.rs +129 -135
  41. {cachebox-6.2.7 → cachebox-6.2.9}/src/pyclasses/vttlcache.rs +113 -113
  42. cachebox-6.2.9/tests/conftest.py +29 -0
  43. {cachebox-6.2.7 → cachebox-6.2.9}/tests/mixins.py +226 -19
  44. cachebox-6.2.9/tests/test_hashing.py +81 -0
  45. {cachebox-6.2.7 → cachebox-6.2.9}/tests/test_impls.py +228 -33
  46. cachebox-6.2.9/tests/test_policy_model.py +175 -0
  47. {cachebox-6.2.7 → cachebox-6.2.9}/tests/test_utils.py +43 -24
  48. cachebox-6.2.9/uv.lock +1708 -0
  49. cachebox-6.2.7/pyproject.toml +0 -80
  50. cachebox-6.2.7/src/internal/lazyheap.rs +0 -368
  51. cachebox-6.2.7/tests/conftest.py +0 -9
  52. cachebox-6.2.7/uv.lock +0 -1025
  53. {cachebox-6.2.7 → cachebox-6.2.9}/.github/dependabot.yaml +0 -0
  54. {cachebox-6.2.7 → cachebox-6.2.9}/LICENSE +0 -0
  55. {cachebox-6.2.7 → cachebox-6.2.9}/LICENSE-THIRD-PARTY +0 -0
  56. {cachebox-6.2.7 → cachebox-6.2.9}/build.rs +0 -0
  57. {cachebox-6.2.7 → cachebox-6.2.9}/cachebox/py.typed +0 -0
  58. {cachebox-6.2.7 → cachebox-6.2.9}/docs/docs/api/impls.md +0 -0
  59. {cachebox-6.2.7 → cachebox-6.2.9}/docs/docs/api/index.md +0 -0
  60. {cachebox-6.2.7 → cachebox-6.2.9}/docs/docs/api/utils.md +0 -0
  61. {cachebox-6.2.7 → cachebox-6.2.9}/docs/docs/installation.md +0 -0
  62. {cachebox-6.2.7 → cachebox-6.2.9}/docs/mkdocs.yml +0 -0
  63. {cachebox-6.2.7 → cachebox-6.2.9}/rust-toolchain.toml +0 -0
  64. {cachebox-6.2.7 → cachebox-6.2.9}/rustfmt.toml +0 -0
  65. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/alloc.rs +1 -1
  66. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/control/bitmask.rs +0 -0
  67. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/control/group/generic.rs +0 -0
  68. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/control/group/lsx.rs +0 -0
  69. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/control/group/mod.rs +0 -0
  70. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/control/group/neon.rs +0 -0
  71. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/control/group/sse2.rs +0 -0
  72. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/control/mod.rs +0 -0
  73. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/control/tag.rs +0 -0
  74. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/mod.rs +0 -0
  75. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/scopeguard.rs +0 -0
  76. {cachebox-6.2.7 → cachebox-6.2.9}/src/hashbrown/util.rs +0 -0
  77. {cachebox-6.2.7 → cachebox-6.2.9}/src/internal/alias.rs +0 -0
  78. {cachebox-6.2.7 → cachebox-6.2.9}/src/internal/linked_list.rs +0 -0
  79. {cachebox-6.2.7 → cachebox-6.2.9}/src/internal/mod.rs +0 -0
  80. {cachebox-6.2.7 → cachebox-6.2.9}/src/internal/pickle.rs +0 -0
  81. {cachebox-6.2.7 → cachebox-6.2.9}/src/policies/common.rs +0 -0
  82. {cachebox-6.2.7 → cachebox-6.2.9}/src/policies/lrupolicy.rs +0 -0
  83. {cachebox-6.2.7 → cachebox-6.2.9}/src/policies/mod.rs +0 -0
  84. {cachebox-6.2.7 → cachebox-6.2.9}/src/policies/traits.rs +0 -0
  85. {cachebox-6.2.7 → cachebox-6.2.9}/src/pyclasses/base.rs +0 -0
  86. {cachebox-6.2.7 → cachebox-6.2.9}/src/pyclasses/mod.rs +0 -0
  87. {cachebox-6.2.7 → cachebox-6.2.9}/src/typeref.rs +0 -0
  88. {cachebox-6.2.7 → cachebox-6.2.9}/tests/__init__.py +0 -0
  89. {cachebox-6.2.7 → cachebox-6.2.9}/typos.toml +0 -0
@@ -37,12 +37,12 @@ jobs:
37
37
  with:
38
38
  persist-credentials: false
39
39
 
40
- - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
40
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
41
41
  with:
42
42
  python-version: "3.14"
43
43
 
44
44
  - name: "Install uv"
45
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
45
+ uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
46
46
  with:
47
47
  # zizmor: ignore[cache-poisoning]
48
48
  enable-cache: ${{ github.event_name == 'pull_request' }}
@@ -54,24 +54,55 @@ jobs:
54
54
  run: ${{ matrix.command }}
55
55
 
56
56
  build-linux:
57
- runs-on: ubuntu-latest
57
+ # The manylinux2014 i686 container can't resolve vault.centos.org on ubuntu-26.04.
58
+ #
59
+ # https://github.com/PyO3/maturin-action/issues/484
60
+ runs-on: ubuntu-24.04
58
61
  strategy:
59
62
  matrix:
60
63
  platform:
61
- - { target: x86_64-unknown-linux-gnu, arch: x86_64, interpreter: *interpreters }
62
- - { target: i686-unknown-linux-gnu, arch: x86, interpreter: *interpreters }
63
- - { target: aarch64-unknown-linux-gnu, arch: aarch64, interpreter: *interpreters }
64
- - { target: armv7-unknown-linux-gnueabihf, arch: armv7, interpreter: *interpreters }
65
- - { target: s390x-unknown-linux-gnu, arch: s390x, interpreter: *interpreters }
66
- - { target: powerpc64le-unknown-linux-gnu, arch: ppc64le, interpreter: *interpreters }
67
- - { target: riscv64gc-unknown-linux-gnu, arch: riscv64, interpreter: *interpreters }
64
+ - {
65
+ target: x86_64-unknown-linux-gnu,
66
+ arch: x86_64,
67
+ interpreter: *interpreters,
68
+ }
69
+ - {
70
+ target: i686-unknown-linux-gnu,
71
+ arch: x86,
72
+ interpreter: *interpreters,
73
+ }
74
+ - {
75
+ target: aarch64-unknown-linux-gnu,
76
+ arch: aarch64,
77
+ interpreter: *interpreters,
78
+ }
79
+ - {
80
+ target: armv7-unknown-linux-gnueabihf,
81
+ arch: armv7,
82
+ interpreter: *interpreters,
83
+ }
84
+ - {
85
+ target: s390x-unknown-linux-gnu,
86
+ arch: s390x,
87
+ interpreter: *interpreters,
88
+ }
89
+ - {
90
+ target: powerpc64le-unknown-linux-gnu,
91
+ arch: ppc64le,
92
+ interpreter: *interpreters,
93
+ }
94
+ - {
95
+ target: riscv64gc-unknown-linux-gnu,
96
+ arch: riscv64,
97
+ interpreter: *interpreters,
98
+ }
68
99
 
69
100
  steps:
70
101
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
71
102
  with:
72
103
  persist-credentials: false
73
104
 
74
- - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
105
+ - uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
75
106
  with:
76
107
  activate-environment: true
77
108
  enable-cache: false
@@ -89,7 +120,7 @@ jobs:
89
120
  --interpreter ${{ matrix.platform.interpreter }}
90
121
  --compatibility pypi
91
122
 
92
- - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
123
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
93
124
  with:
94
125
  name: wheels-linux-${{ matrix.platform.arch }}
95
126
  path: dist
@@ -99,18 +130,38 @@ jobs:
99
130
  strategy:
100
131
  matrix:
101
132
  platform:
102
- - { target: x86_64-unknown-linux-musl, arch: x86_64, interpreter: *interpreters }
103
- - { target: i686-unknown-linux-musl, arch: x86, interpreter: *interpreters }
104
- - { target: aarch64-unknown-linux-musl, arch: aarch64, interpreter: *interpreters }
105
- - { target: armv7-unknown-linux-musleabihf, arch: armv7, interpreter: *interpreters }
106
- - { target: riscv64gc-unknown-linux-musl, arch: riscv64, interpreter: *interpreters }
133
+ - {
134
+ target: x86_64-unknown-linux-musl,
135
+ arch: x86_64,
136
+ interpreter: *interpreters,
137
+ }
138
+ - {
139
+ target: i686-unknown-linux-musl,
140
+ arch: x86,
141
+ interpreter: *interpreters,
142
+ }
143
+ - {
144
+ target: aarch64-unknown-linux-musl,
145
+ arch: aarch64,
146
+ interpreter: *interpreters,
147
+ }
148
+ - {
149
+ target: armv7-unknown-linux-musleabihf,
150
+ arch: armv7,
151
+ interpreter: *interpreters,
152
+ }
153
+ - {
154
+ target: riscv64gc-unknown-linux-musl,
155
+ arch: riscv64,
156
+ interpreter: *interpreters,
157
+ }
107
158
 
108
159
  steps:
109
160
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
110
161
  with:
111
162
  persist-credentials: false
112
163
 
113
- - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
164
+ - uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
114
165
  with:
115
166
  activate-environment: true
116
167
  enable-cache: false
@@ -128,7 +179,7 @@ jobs:
128
179
  --interpreter ${{ matrix.platform.interpreter }}
129
180
  --compatibility pypi
130
181
 
131
- - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
182
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
132
183
  with:
133
184
  name: wheels-musllinux-${{ matrix.platform.arch }}
134
185
  path: dist
@@ -138,16 +189,31 @@ jobs:
138
189
  strategy:
139
190
  matrix:
140
191
  platform:
141
- - { runner: windows-latest, target: x64, arch: x64, interpreter: *interpreters }
142
- - { runner: windows-latest, target: x86, arch: x86, interpreter: *interpreters_without_pypy }
143
- - { runner: windows-11-arm, target: aarch64, arch: arm64, interpreter: *interpreters_win_arm64 }
192
+ - {
193
+ runner: windows-latest,
194
+ target: x64,
195
+ arch: x64,
196
+ interpreter: *interpreters,
197
+ }
198
+ - {
199
+ runner: windows-latest,
200
+ target: x86,
201
+ arch: x86,
202
+ interpreter: *interpreters_without_pypy,
203
+ }
204
+ - {
205
+ runner: windows-11-arm,
206
+ target: aarch64,
207
+ arch: arm64,
208
+ interpreter: *interpreters_win_arm64,
209
+ }
144
210
 
145
211
  steps:
146
212
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
147
213
  with:
148
214
  persist-credentials: false
149
215
 
150
- - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
216
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
151
217
  with:
152
218
  python-version: "3.x"
153
219
  architecture: ${{ matrix.platform.arch }}
@@ -163,7 +229,7 @@ jobs:
163
229
  --interpreter ${{ matrix.platform.interpreter }}
164
230
  --compatibility pypi
165
231
 
166
- - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
232
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
167
233
  with:
168
234
  name: wheels-windows-${{ matrix.platform.target }}
169
235
  path: dist
@@ -181,7 +247,7 @@ jobs:
181
247
  with:
182
248
  persist-credentials: false
183
249
 
184
- - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
250
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
185
251
  with:
186
252
  python-version: "3.x"
187
253
 
@@ -196,7 +262,7 @@ jobs:
196
262
  --interpreter ${{ matrix.platform.interpreter }}
197
263
  --compatibility pypi
198
264
 
199
- - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
265
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
200
266
  with:
201
267
  name: wheels-macos-${{ matrix.platform.target }}
202
268
  path: dist
@@ -215,14 +281,14 @@ jobs:
215
281
  args: --out dist
216
282
 
217
283
  - name: Upload sdist
218
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
284
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
219
285
  with:
220
286
  name: wheels-sdist
221
287
  path: dist
222
288
 
223
289
  release:
224
290
  runs-on: ubuntu-latest
225
- if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch'
291
+ if: github.ref_type == 'tag'
226
292
  needs:
227
293
  - build-linux
228
294
  - build-musllinux
@@ -235,7 +301,7 @@ jobs:
235
301
  contents: write
236
302
 
237
303
  steps:
238
- - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
304
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
239
305
  with:
240
306
  pattern: wheels-*
241
307
  merge-multiple: true
@@ -243,6 +309,6 @@ jobs:
243
309
 
244
310
  - name: Publish to PyPI
245
311
  if: github.ref_type == 'tag'
246
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
312
+ uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
247
313
  with:
248
314
  packages-dir: dist
@@ -15,12 +15,12 @@ jobs:
15
15
  with:
16
16
  fetch-depth: 0
17
17
 
18
- - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
18
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
19
19
  with:
20
20
  python-version: 3.14
21
21
 
22
22
  - name: "Install uv"
23
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
23
+ uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
24
24
  with:
25
25
  enable-cache: false
26
26
 
@@ -52,4 +52,4 @@ jobs:
52
52
  path: "."
53
53
 
54
54
  - id: deployment
55
- uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
55
+ uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
@@ -40,19 +40,19 @@ jobs:
40
40
 
41
41
  - uses: dtolnay/rust-toolchain@stable # zizmor: ignore[unpinned-uses]
42
42
 
43
- - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
43
+ - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
44
44
  if: github.event_name == 'pull_request' && github.run_attempt == 1
45
45
  with:
46
46
  lookup-only: false # zizmor: ignore[cache-poisoning]
47
47
  shared-key: ${{ matrix.python-version }}
48
48
 
49
- - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
49
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
50
50
  with:
51
51
  python-version: ${{ matrix.python-version }}
52
52
  allow-prereleases: true
53
53
 
54
54
  - name: "Install uv"
55
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
55
+ uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
56
56
  with:
57
57
  enable-cache: false
58
58
 
@@ -88,12 +88,12 @@ jobs:
88
88
 
89
89
  - uses: dtolnay/rust-toolchain@stable # zizmor: ignore[unpinned-uses]
90
90
 
91
- - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
91
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
92
92
  with:
93
93
  python-version: "3.13"
94
94
 
95
95
  - name: "Install uv"
96
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
96
+ uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
97
97
  with:
98
98
  enable-cache: false
99
99
 
@@ -5,6 +5,5 @@ __pycache__
5
5
  /.coverage
6
6
  /.pytest_cache
7
7
  /htmlcov
8
- /backup
9
8
  /.benchmarks
10
9
  /.hypothesis
@@ -0,0 +1,42 @@
1
+ # cachebox
2
+
3
+ In-memory cache for Python. The hot path is a PyO3 extension (`cachebox._core`); `cachebox/` is the public package.
4
+
5
+ ## Working rules
6
+
7
+ - Keep diffs small and match the surrounding style. Do not add a new language, framework, or packaging tool.
8
+ - After a behavior change, rebuild with maturin and run pytest.
9
+ - Do not edit `target/`, `*.so`, `__pycache__`, `.venv`, or other build output. Do not edit `Cargo.lock` or `uv.lock` unless a dependency changed.
10
+ - Do not read or write secrets or `.env`.
11
+ - `src/hashbrown/` is vendored hashbrown (see `LICENSE-THIRD-PARTY`). Change it only when the table itself must change.
12
+ - v6 is the public API. A breaking change needs a note in `docs/docs/migration.md` and a matching update to `cachebox/_core.pyi` and the MkDocs pages.
13
+ - `use-small-offset` is a test-only Cargo feature. Release and publish builds must not enable it.
14
+
15
+ ## Layout
16
+
17
+ - `src/policies/` — eviction (Cache, FIFO, RR, LRU, LFU, TTL, VTTL).
18
+ - `src/pyclasses/` — one PyO3 class per policy, plus key/value/item iterators.
19
+ - `src/internal/` — pickle, `OnceInit` (`__new__` / `__init__`), linked list, hash helpers.
20
+ - `cachebox/_cachebox.py` — public `TTLCache` and `VTTLCache` (subclasses of the Rust types). Other classes are re-exported from `_core`.
21
+ - `cachebox/utils.py` and `_wrappers.py` — `@cached`, key makers, stampede locks.
22
+ - `tests/` — pytest mixins shared across implementations. Rust `#[cfg(test)]` covers the vendored table only.
23
+
24
+ ## Commands
25
+
26
+ ```bash
27
+ uv venv .venv && uv pip install --group ci
28
+ maturin develop --features use-small-offset # local tests; CI does this
29
+ pytest -v -n auto # CI also sets HYPOTHESIS_PROFILE=slow
30
+ typos --config typos.toml
31
+ zizmor .github/
32
+ mkdocs serve --config-file docs/mkdocs.yml
33
+ ```
34
+
35
+ `maturin develop --release` is the documented source install. Wheels are built only by `.github/workflows/CI.yml` on a tag.
36
+
37
+ ## Style
38
+
39
+ - `rustfmt.toml` sets `imports_granularity = "Item"`.
40
+ - Rust edition is whatever `Cargo.toml` says. Edition 2024 denies `unsafe_op_in_unsafe_fn`; the crate allows it in `src/lib.rs`.
41
+ - Python docstrings are Google style. MkDocs (`mkdocstrings`) renders them.
42
+ - Clippy warns on `dbg!` and `print!`. Clippy, rustfmt, and mypy are not CI jobs.
@@ -25,9 +25,9 @@ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
25
25
 
26
26
  [[package]]
27
27
  name = "bitflags"
28
- version = "2.13.1"
28
+ version = "2.13.2"
29
29
  source = "registry+https://github.com/rust-lang/crates.io-index"
30
- checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
30
+ checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
31
31
 
32
32
  [[package]]
33
33
  name = "bumpalo"
@@ -37,7 +37,7 @@ checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
37
37
 
38
38
  [[package]]
39
39
  name = "cachebox"
40
- version = "6.2.7"
40
+ version = "6.2.9"
41
41
  dependencies = [
42
42
  "allocator-api2",
43
43
  "cfg-if",
@@ -50,9 +50,9 @@ dependencies = [
50
50
 
51
51
  [[package]]
52
52
  name = "cc"
53
- version = "1.4.4"
53
+ version = "1.9.0"
54
54
  source = "registry+https://github.com/rust-lang/crates.io-index"
55
- checksum = "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273"
55
+ checksum = "877bf67ac8e52449eb2f9e98a344ea163beb70dd1f9eebe3cc5357dcfeaee4df"
56
56
  dependencies = [
57
57
  "find-msvc-tools",
58
58
  "shlex",
@@ -60,9 +60,9 @@ dependencies = [
60
60
 
61
61
  [[package]]
62
62
  name = "cfg-if"
63
- version = "1.0.4"
63
+ version = "1.0.5"
64
64
  source = "registry+https://github.com/rust-lang/crates.io-index"
65
- checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
65
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
66
66
 
67
67
  [[package]]
68
68
  name = "chrono"
@@ -91,9 +91,9 @@ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
91
91
 
92
92
  [[package]]
93
93
  name = "find-msvc-tools"
94
- version = "0.1.11"
94
+ version = "0.1.15"
95
95
  source = "registry+https://github.com/rust-lang/crates.io-index"
96
- checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890"
96
+ checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
97
97
 
98
98
  [[package]]
99
99
  name = "futures-core"
@@ -151,9 +151,9 @@ dependencies = [
151
151
 
152
152
  [[package]]
153
153
  name = "js-sys"
154
- version = "0.3.104"
154
+ version = "0.3.106"
155
155
  source = "registry+https://github.com/rust-lang/crates.io-index"
156
- checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a"
156
+ checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5"
157
157
  dependencies = [
158
158
  "cfg-if",
159
159
  "futures-util",
@@ -162,9 +162,9 @@ dependencies = [
162
162
 
163
163
  [[package]]
164
164
  name = "libc"
165
- version = "0.2.189"
165
+ version = "0.2.191"
166
166
  source = "registry+https://github.com/rust-lang/crates.io-index"
167
- checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
167
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
168
168
 
169
169
  [[package]]
170
170
  name = "lock_api"
@@ -242,13 +242,15 @@ dependencies = [
242
242
 
243
243
  [[package]]
244
244
  name = "pyo3"
245
- version = "0.29.2"
245
+ version = "0.30.1"
246
246
  source = "registry+https://github.com/rust-lang/crates.io-index"
247
- checksum = "4688ddedf473e32662b9b067670129a8afb8c18e351482c70d62ba4a88171e8b"
247
+ checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
248
248
  dependencies = [
249
249
  "chrono",
250
250
  "libc",
251
+ "lock_api",
251
252
  "once_cell",
253
+ "parking_lot",
252
254
  "portable-atomic",
253
255
  "pyo3-build-config",
254
256
  "pyo3-ffi",
@@ -257,18 +259,18 @@ dependencies = [
257
259
 
258
260
  [[package]]
259
261
  name = "pyo3-build-config"
260
- version = "0.29.2"
262
+ version = "0.30.1"
261
263
  source = "registry+https://github.com/rust-lang/crates.io-index"
262
- checksum = "f41027e41b4bd03f6e60f9f417fe24a6341a6bb744edd62b6f709f2a52ea30e9"
264
+ checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
263
265
  dependencies = [
264
266
  "target-lexicon",
265
267
  ]
266
268
 
267
269
  [[package]]
268
270
  name = "pyo3-ffi"
269
- version = "0.29.2"
271
+ version = "0.30.1"
270
272
  source = "registry+https://github.com/rust-lang/crates.io-index"
271
- checksum = "e591a95526fead067432c3b3a33fc74770b87b1e04e73671090d9c2055a2b327"
273
+ checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
272
274
  dependencies = [
273
275
  "libc",
274
276
  "pyo3-build-config",
@@ -276,26 +278,26 @@ dependencies = [
276
278
 
277
279
  [[package]]
278
280
  name = "pyo3-macros"
279
- version = "0.29.2"
281
+ version = "0.30.1"
280
282
  source = "registry+https://github.com/rust-lang/crates.io-index"
281
- checksum = "73225868fc1cd84eef2c3c230ddb91273bf1de46aeb8a4248da76d32a0924a1c"
283
+ checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
282
284
  dependencies = [
283
285
  "proc-macro2",
284
286
  "pyo3-macros-backend",
285
287
  "quote",
286
- "syn",
288
+ "syn 3.0.9",
287
289
  ]
288
290
 
289
291
  [[package]]
290
292
  name = "pyo3-macros-backend"
291
- version = "0.29.2"
293
+ version = "0.30.1"
292
294
  source = "registry+https://github.com/rust-lang/crates.io-index"
293
- checksum = "571575aa3749fa6216757dd47d2a3e7ef360f329a40f0666a9fbd14889024952"
295
+ checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
294
296
  dependencies = [
295
297
  "heck",
296
298
  "proc-macro2",
297
299
  "quote",
298
- "syn",
300
+ "syn 3.0.9",
299
301
  ]
300
302
 
301
303
  [[package]]
@@ -342,9 +344,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
342
344
 
343
345
  [[package]]
344
346
  name = "smallvec"
345
- version = "1.15.2"
347
+ version = "1.16.3"
346
348
  source = "registry+https://github.com/rust-lang/crates.io-index"
347
- checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
349
+ checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b"
348
350
 
349
351
  [[package]]
350
352
  name = "syn"
@@ -357,6 +359,17 @@ dependencies = [
357
359
  "unicode-ident",
358
360
  ]
359
361
 
362
+ [[package]]
363
+ name = "syn"
364
+ version = "3.0.9"
365
+ source = "registry+https://github.com/rust-lang/crates.io-index"
366
+ checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
367
+ dependencies = [
368
+ "proc-macro2",
369
+ "quote",
370
+ "unicode-ident",
371
+ ]
372
+
360
373
  [[package]]
361
374
  name = "target-lexicon"
362
375
  version = "0.13.5"
@@ -365,15 +378,15 @@ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
365
378
 
366
379
  [[package]]
367
380
  name = "unicode-ident"
368
- version = "1.0.24"
381
+ version = "1.0.27"
369
382
  source = "registry+https://github.com/rust-lang/crates.io-index"
370
- checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
383
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
371
384
 
372
385
  [[package]]
373
386
  name = "wasm-bindgen"
374
- version = "0.2.127"
387
+ version = "0.2.129"
375
388
  source = "registry+https://github.com/rust-lang/crates.io-index"
376
- checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70"
389
+ checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409"
377
390
  dependencies = [
378
391
  "cfg-if",
379
392
  "once_cell",
@@ -384,9 +397,9 @@ dependencies = [
384
397
 
385
398
  [[package]]
386
399
  name = "wasm-bindgen-macro"
387
- version = "0.2.127"
400
+ version = "0.2.129"
388
401
  source = "registry+https://github.com/rust-lang/crates.io-index"
389
- checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1"
402
+ checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535"
390
403
  dependencies = [
391
404
  "quote",
392
405
  "wasm-bindgen-macro-support",
@@ -394,22 +407,22 @@ dependencies = [
394
407
 
395
408
  [[package]]
396
409
  name = "wasm-bindgen-macro-support"
397
- version = "0.2.127"
410
+ version = "0.2.129"
398
411
  source = "registry+https://github.com/rust-lang/crates.io-index"
399
- checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284"
412
+ checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7"
400
413
  dependencies = [
401
414
  "bumpalo",
402
415
  "proc-macro2",
403
416
  "quote",
404
- "syn",
417
+ "syn 3.0.9",
405
418
  "wasm-bindgen-shared",
406
419
  ]
407
420
 
408
421
  [[package]]
409
422
  name = "wasm-bindgen-shared"
410
- version = "0.2.127"
423
+ version = "0.2.129"
411
424
  source = "registry+https://github.com/rust-lang/crates.io-index"
412
- checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf"
425
+ checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6"
413
426
  dependencies = [
414
427
  "unicode-ident",
415
428
  ]
@@ -435,7 +448,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
435
448
  dependencies = [
436
449
  "proc-macro2",
437
450
  "quote",
438
- "syn",
451
+ "syn 2.0.119",
439
452
  ]
440
453
 
441
454
  [[package]]
@@ -446,7 +459,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
446
459
  dependencies = [
447
460
  "proc-macro2",
448
461
  "quote",
449
- "syn",
462
+ "syn 2.0.119",
450
463
  ]
451
464
 
452
465
  [[package]]
@@ -1,25 +1,16 @@
1
1
  [package]
2
2
  name = "cachebox"
3
- version = "6.2.7"
4
- edition = "2021"
3
+ version = "6.2.9"
4
+ edition = "2024"
5
5
  description = "The fastest memoizing and caching Python library written in Rust"
6
6
  readme = "README.md"
7
- license = "MIT"
8
7
  homepage = "https://github.com/awolverp/cachebox"
9
8
  repository = "https://github.com/awolverp/cachebox.git"
10
- authors = ["Ali Pooralijan <awolverp@gmail.com>"]
9
+ license = "MIT"
11
10
 
12
11
  [lib]
13
- name = "cachebox"
14
12
  crate-type = ["cdylib", "rlib"]
15
-
16
- [profile.release]
17
- codegen-units = 1
18
- debug = false
19
- incremental = false
20
- lto = true
21
- panic = "abort"
22
- strip = true
13
+ name = "cachebox"
23
14
 
24
15
  [dependencies]
25
16
  allocator-api2 = "0.4.0"
@@ -27,15 +18,15 @@ cfg-if = "1.0.4"
27
18
  chrono = "0.4.45"
28
19
  fastrand = "2.5.0"
29
20
  parking_lot = { version = "0.12.5", default-features = false }
30
- pyo3 = { version = "0.29.2", default-features = false, features = ["macros", "chrono"] }
21
+ pyo3 = { version = "0.30.1", default-features = false, features = ["chrono", "macros", "parking_lot"] }
31
22
 
32
23
  [build-dependencies]
33
- pyo3-build-config = { version = "0.29.2", default-features = false, features = ["resolve-config"] }
24
+ pyo3-build-config = { version = "0.30.1", default-features = false, features = ["resolve-config"] }
34
25
 
35
26
  [features]
36
- default = ["inline-more", "extension-module"]
37
- inline-more = []
27
+ default = ["extension-module", "inline-more"]
38
28
  extension-module = ["pyo3/extension-module"]
29
+ inline-more = []
39
30
 
40
31
  # testing features
41
32
  use-small-offset = []
@@ -43,3 +34,11 @@ use-small-offset = []
43
34
  [lints.clippy]
44
35
  dbg_macro = "warn"
45
36
  print_stdout = "warn"
37
+
38
+ [profile.release]
39
+ debug = false
40
+ strip = true
41
+ lto = true
42
+ panic = "abort"
43
+ incremental = false
44
+ codegen-units = 1