dependency-cache 0.5.1__tar.gz → 0.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 (35) hide show
  1. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/.github/workflows/CI.yml +3 -3
  2. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/Cargo.lock +64 -12
  3. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/Cargo.toml +3 -2
  4. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/PKG-INFO +4 -4
  5. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/README.md +3 -3
  6. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/pyproject.toml +1 -1
  7. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/dependency_cache/__init__.py +4 -2
  8. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/dependency_cache/dependency_cache.pyi +16 -5
  9. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/examples/custom_scenario_example.py +3 -3
  10. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/test_python.py +25 -4
  11. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/test_python_automagic.py +23 -4
  12. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/src/dependency_cache_base.rs +82 -40
  13. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/src/lib.rs +7 -2
  14. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/src/metadata_hash_manager.rs +1 -1
  15. dependency_cache-0.5.1/src/scenario.rs → dependency_cache-0.6.0/src/override.rs +13 -13
  16. dependency_cache-0.6.0/src/scenario.rs +131 -0
  17. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/uv.lock +67 -67
  18. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/.github/workflows/Test.yml +0 -0
  19. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/.gitignore +0 -0
  20. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/LICENSE +0 -0
  21. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/dependency_cache/plot_dependency_graph.py +0 -0
  22. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/examples/automagic_dependency_example.py +0 -0
  23. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/examples/custom_decorator_example.py +0 -0
  24. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/examples/example.py +0 -0
  25. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/examples/inheritance_example.py +0 -0
  26. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/examples/manual_dependency_example.py +0 -0
  27. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/examples/runtime_dependencies_example.py +0 -0
  28. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/examples/runtime_function_calls_example.py +0 -0
  29. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/examples/serialisable_example.py +0 -0
  30. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/examples/static_function_calls_example.py +0 -0
  31. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/python/examples/use_cache_example.py +0 -0
  32. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/src/decorator.rs +0 -0
  33. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/src/decorator_factory.rs +0 -0
  34. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/src/dependency_graph.rs +0 -0
  35. {dependency_cache-0.5.1 → dependency_cache-0.6.0}/src/py_introspection_utils.rs +0 -0
@@ -83,7 +83,7 @@ jobs:
83
83
  - uses: actions/checkout@v6
84
84
  - uses: actions/setup-python@v6
85
85
  with:
86
- python-version: "3.8"
86
+ python-version: "3.9"
87
87
  - name: Build wheels
88
88
  uses: PyO3/maturin-action@v1
89
89
  with:
@@ -122,7 +122,7 @@ jobs:
122
122
  - uses: actions/checkout@v6
123
123
  - uses: actions/setup-python@v6
124
124
  with:
125
- python-version: "3.8"
125
+ python-version: "3.9"
126
126
  - name: Build wheels
127
127
  uses: PyO3/maturin-action@v1
128
128
  with:
@@ -200,7 +200,7 @@ jobs:
200
200
  - uses: actions/checkout@v6
201
201
  - uses: actions/setup-python@v6
202
202
  with:
203
- python-version: "3.8"
203
+ python-version: "3.9"
204
204
  - name: Build wheels
205
205
  uses: PyO3/maturin-action@v1
206
206
  with:
@@ -28,14 +28,46 @@ dependencies = [
28
28
  "libc",
29
29
  ]
30
30
 
31
+ [[package]]
32
+ name = "crossbeam-deque"
33
+ version = "0.8.8"
34
+ source = "registry+https://github.com/rust-lang/crates.io-index"
35
+ checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"
36
+ dependencies = [
37
+ "crossbeam-epoch",
38
+ "crossbeam-utils",
39
+ ]
40
+
41
+ [[package]]
42
+ name = "crossbeam-epoch"
43
+ version = "0.9.21"
44
+ source = "registry+https://github.com/rust-lang/crates.io-index"
45
+ checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
46
+ dependencies = [
47
+ "crossbeam-utils",
48
+ ]
49
+
50
+ [[package]]
51
+ name = "crossbeam-utils"
52
+ version = "0.8.23"
53
+ source = "registry+https://github.com/rust-lang/crates.io-index"
54
+ checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
55
+
31
56
  [[package]]
32
57
  name = "dependency_cache"
33
58
  version = "0.1.0"
34
59
  dependencies = [
35
60
  "pyo3",
36
61
  "rand",
62
+ "rayon",
37
63
  ]
38
64
 
65
+ [[package]]
66
+ name = "either"
67
+ version = "1.19.0"
68
+ source = "registry+https://github.com/rust-lang/crates.io-index"
69
+ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
70
+
39
71
  [[package]]
40
72
  name = "getrandom"
41
73
  version = "0.4.3"
@@ -83,9 +115,9 @@ dependencies = [
83
115
 
84
116
  [[package]]
85
117
  name = "pyo3"
86
- version = "0.29.2"
118
+ version = "0.30.1"
87
119
  source = "registry+https://github.com/rust-lang/crates.io-index"
88
- checksum = "4688ddedf473e32662b9b067670129a8afb8c18e351482c70d62ba4a88171e8b"
120
+ checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
89
121
  dependencies = [
90
122
  "libc",
91
123
  "once_cell",
@@ -97,18 +129,18 @@ dependencies = [
97
129
 
98
130
  [[package]]
99
131
  name = "pyo3-build-config"
100
- version = "0.29.2"
132
+ version = "0.30.1"
101
133
  source = "registry+https://github.com/rust-lang/crates.io-index"
102
- checksum = "f41027e41b4bd03f6e60f9f417fe24a6341a6bb744edd62b6f709f2a52ea30e9"
134
+ checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
103
135
  dependencies = [
104
136
  "target-lexicon",
105
137
  ]
106
138
 
107
139
  [[package]]
108
140
  name = "pyo3-ffi"
109
- version = "0.29.2"
141
+ version = "0.30.1"
110
142
  source = "registry+https://github.com/rust-lang/crates.io-index"
111
- checksum = "e591a95526fead067432c3b3a33fc74770b87b1e04e73671090d9c2055a2b327"
143
+ checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
112
144
  dependencies = [
113
145
  "libc",
114
146
  "pyo3-build-config",
@@ -116,9 +148,9 @@ dependencies = [
116
148
 
117
149
  [[package]]
118
150
  name = "pyo3-macros"
119
- version = "0.29.2"
151
+ version = "0.30.1"
120
152
  source = "registry+https://github.com/rust-lang/crates.io-index"
121
- checksum = "73225868fc1cd84eef2c3c230ddb91273bf1de46aeb8a4248da76d32a0924a1c"
153
+ checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
122
154
  dependencies = [
123
155
  "proc-macro2",
124
156
  "pyo3-macros-backend",
@@ -128,9 +160,9 @@ dependencies = [
128
160
 
129
161
  [[package]]
130
162
  name = "pyo3-macros-backend"
131
- version = "0.29.2"
163
+ version = "0.30.1"
132
164
  source = "registry+https://github.com/rust-lang/crates.io-index"
133
- checksum = "571575aa3749fa6216757dd47d2a3e7ef360f329a40f0666a9fbd14889024952"
165
+ checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
134
166
  dependencies = [
135
167
  "heck",
136
168
  "proc-macro2",
@@ -170,11 +202,31 @@ version = "0.10.1"
170
202
  source = "registry+https://github.com/rust-lang/crates.io-index"
171
203
  checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
172
204
 
205
+ [[package]]
206
+ name = "rayon"
207
+ version = "1.12.0"
208
+ source = "registry+https://github.com/rust-lang/crates.io-index"
209
+ checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
210
+ dependencies = [
211
+ "either",
212
+ "rayon-core",
213
+ ]
214
+
215
+ [[package]]
216
+ name = "rayon-core"
217
+ version = "1.13.0"
218
+ source = "registry+https://github.com/rust-lang/crates.io-index"
219
+ checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
220
+ dependencies = [
221
+ "crossbeam-deque",
222
+ "crossbeam-utils",
223
+ ]
224
+
173
225
  [[package]]
174
226
  name = "syn"
175
- version = "2.0.119"
227
+ version = "3.0.9"
176
228
  source = "registry+https://github.com/rust-lang/crates.io-index"
177
- checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
229
+ checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
178
230
  dependencies = [
179
231
  "proc-macro2",
180
232
  "quote",
@@ -11,11 +11,12 @@ crate-type = ["cdylib"]
11
11
 
12
12
  [dependencies]
13
13
  rand = "0.10.2"
14
+ rayon = "1.12.0"
14
15
 
15
16
  [dependencies.pyo3]
16
- version = "0.29.*"
17
+ version = "0.*.*"
17
18
  features = [
18
- "abi3-py38",
19
+ "abi3-py39",
19
20
  "extension-module",
20
21
  "experimental-inspect",
21
22
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dependency_cache
3
- Version: 0.5.1
3
+ Version: 0.6.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -121,9 +121,9 @@ uv run ./python/examples/example.py
121
121
  This project is still a work in progress, with everything from API to underlying design subject to change on my whim.
122
122
 
123
123
  Current TODO list (in no particular order):
124
- - add global_variable to link objects together
124
+ - change dependency graph to use indexing and cache key
125
125
  - add validation to static dependencies, ensure methods are of decorator class (?)
126
126
  - improve plot_dependency_graph (maybe to GUI?) with interactive nodes
127
- - add object thread safety for python 3.14+
128
- - work out how best to handle nested objects
127
+ - add static dependency builds on startup, for methods with no arguments
128
+ - add more operation and collection types
129
129
 
@@ -103,8 +103,8 @@ uv run ./python/examples/example.py
103
103
  This project is still a work in progress, with everything from API to underlying design subject to change on my whim.
104
104
 
105
105
  Current TODO list (in no particular order):
106
- - add global_variable to link objects together
106
+ - change dependency graph to use indexing and cache key
107
107
  - add validation to static dependencies, ensure methods are of decorator class (?)
108
108
  - improve plot_dependency_graph (maybe to GUI?) with interactive nodes
109
- - add object thread safety for python 3.14+
110
- - work out how best to handle nested objects
109
+ - add static dependency builds on startup, for methods with no arguments
110
+ - add more operation and collection types
@@ -11,7 +11,7 @@ classifiers = [
11
11
  "Programming Language :: Python :: Implementation :: PyPy",
12
12
  ]
13
13
  keywords = ["caching", "dependency-graph", "invalidation"]
14
- version = "0.5.1"
14
+ version = "0.6.0"
15
15
  description = "A caching library for Python object methods that utilises a dependency graph to track relationships and control invalidation, enabling efficient recomputation"
16
16
  readme = "README.md"
17
17
  license = { text = "MIT" }
@@ -1,8 +1,9 @@
1
1
  from .dependency_cache import (
2
2
  DependencyCacheBase,
3
+ Scenario,
3
4
  automagically_dependency_cached,
4
- custom_scenario,
5
5
  dependency_cached,
6
+ temporary_override,
6
7
  )
7
8
  from .plot_dependency_graph import plot_dependency_graph
8
9
 
@@ -11,5 +12,6 @@ __all__ = [
11
12
  "DependencyCacheBase",
12
13
  "automagically_dependency_cached",
13
14
  "plot_dependency_graph",
14
- "custom_scenario",
15
+ "temporary_override",
16
+ "Scenario",
15
17
  ]
@@ -1,6 +1,8 @@
1
- from collections.abc import Sequence
1
+ from _typeshed import SupportsGetItem
2
2
  from typing import Any, final
3
+ from typing_extensions import disjoint_base
3
4
 
5
+ @disjoint_base
4
6
  class DependencyCacheBase:
5
7
  def __new__(cls, /, *_args, **_kwargs) -> DependencyCacheBase: ...
6
8
  @property
@@ -9,18 +11,27 @@ class DependencyCacheBase:
9
11
  def clear_cached_value(self, /, method_name: str, **kwargs) -> None: ...
10
12
  @property
11
13
  def dependency_graph(self, /) -> dict: ...
12
- def dump_cache(self, /, order: Sequence[str] | None = None) -> dict: ...
14
+ def dump_cache(self, /, order: SupportsGetItem[int, str] | None = None) -> dict: ...
13
15
  def get_cached_value(
14
16
  self, /, method_name: str, strict: bool = True, **kwargs
15
17
  ) -> Any | None: ...
16
18
  def is_cached(self, /, method_name: str, **kwargs) -> bool: ...
17
- def load_cache(self, /, data: dict, order: Sequence[str] | None = None) -> None: ...
19
+ def load_cache(
20
+ self, /, data: dict, order: SupportsGetItem[int, str] | None = None
21
+ ) -> None: ...
18
22
  def update_cached_value(
19
- self, /, method_name: str, value: Any, **kwargs
23
+ self, /, method_name: str, value: Any, must_contain: bool = True, **kwargs
20
24
  ) -> None: ...
21
25
  @property
22
26
  def validation_state(self, /) -> dict: ...
23
27
 
28
+ @final
29
+ class Scenario:
30
+ def __new__(cls, /, objects: Sequence[Any]) -> Scenario: ...
31
+ def collect(self, /, parallel: bool = True) -> list[Any]: ...
32
+ def filter(self, /, predicate: Any) -> Scenario: ...
33
+ def map(self, /, func: Any) -> Scenario: ...
34
+
24
35
  @final
25
36
  class automagically_dependency_cached:
26
37
  def __call__(self, /, func: Any) -> Any: ...
@@ -45,4 +56,4 @@ class dependency_cached:
45
56
  serialisable: bool = False,
46
57
  ) -> dependency_cached: ...
47
58
 
48
- def custom_scenario(items: Sequence[Any]) -> Any: ...
59
+ def temporary_override(objects: Sequence[Any]) -> Any: ...
@@ -1,4 +1,4 @@
1
- from dependency_cache import DependencyCacheBase, automagically_dependency_cached, custom_scenario
1
+ from dependency_cache import DependencyCacheBase, automagically_dependency_cached, temporary_override
2
2
 
3
3
 
4
4
  class ExampleCalculation(DependencyCacheBase):
@@ -37,11 +37,11 @@ if __name__ == "__main__":
37
37
 
38
38
  calcuations = [c]
39
39
  print(f"Result of C = {c.C()}") # # calculates all, prints 3
40
- with custom_scenario(calcuations):
40
+ with temporary_override(calcuations):
41
41
  c.update_cached_value("A", 100)
42
42
  print(f"Result of C = {c.C()}") # recalculates C returns 102
43
43
 
44
- with custom_scenario(calcuations):
44
+ with temporary_override(calcuations):
45
45
  c.update_cached_value("B", 200)
46
46
  print(f"Result of C = {c.C()}") # recalculates C returns 300
47
47
 
@@ -1,5 +1,5 @@
1
1
  import pytest
2
- from dependency_cache import DependencyCacheBase, custom_scenario, dependency_cached, plot_dependency_graph
2
+ from dependency_cache import DependencyCacheBase, Scenario, dependency_cached, plot_dependency_graph, temporary_override
3
3
 
4
4
 
5
5
  class IncorrectInheritance:
@@ -369,17 +369,17 @@ def test_strict_get_raises():
369
369
  (-55, -101),
370
370
  ],
371
371
  )
372
- def test_custom_scenario(x, y):
372
+ def test_temporary_override(x, y):
373
373
  obj = SimpleTestObj(x, y)
374
374
 
375
375
  assert obj.C() == x + y
376
376
 
377
- with custom_scenario([obj]):
377
+ with temporary_override([obj]):
378
378
  obj.update_cached_value("A", x * 10)
379
379
 
380
380
  assert obj.C() == x * 10 + y
381
381
 
382
- with custom_scenario([obj]):
382
+ with temporary_override([obj]):
383
383
  obj.update_cached_value("B", y + 3000)
384
384
 
385
385
  assert obj.C() == x * 10 + (y + 3000)
@@ -387,3 +387,24 @@ def test_custom_scenario(x, y):
387
387
  assert obj.C() == x * 10 + y
388
388
 
389
389
  assert obj.C() == x + y
390
+
391
+
392
+ def test_scenarios():
393
+ objects = [SimpleTestObj(i, i**2) for i in range(1, 4)]
394
+ for obj in objects:
395
+ obj.C()
396
+
397
+ scenario = Scenario(objects)
398
+
399
+ assert scenario.map(lambda x: x.C()).collect(False) == [2, 6, 12]
400
+
401
+ def tweak_object(x):
402
+ print(x.cached_values)
403
+ x.update_cached_value("A", 1, must_contain=False)
404
+ return x
405
+
406
+ assert scenario.map(tweak_object).map(lambda x: x.C()).collect() == [2, 5, 10]
407
+
408
+ assert scenario.map(tweak_object).map(lambda x: x.C()).filter(lambda x: x < 5).collect() == [2]
409
+
410
+ assert [o.A() for o in objects] == [1, 2, 3]
@@ -1,9 +1,10 @@
1
1
  import pytest
2
2
  from dependency_cache import (
3
3
  DependencyCacheBase,
4
+ Scenario,
4
5
  automagically_dependency_cached,
5
- custom_scenario,
6
6
  plot_dependency_graph,
7
+ temporary_override,
7
8
  )
8
9
 
9
10
 
@@ -309,17 +310,17 @@ def test_incorrect_decorator_format():
309
310
  (-55, -101),
310
311
  ],
311
312
  )
312
- def test_custom_scenario(x, y):
313
+ def test_temporary_override(x, y):
313
314
  obj = SimpleTestObj(x, y)
314
315
 
315
316
  assert obj.C() == x + y
316
317
 
317
- with custom_scenario([obj]):
318
+ with temporary_override([obj]):
318
319
  obj.update_cached_value("A", x * 10)
319
320
 
320
321
  assert obj.C() == x * 10 + y
321
322
 
322
- with custom_scenario([obj]):
323
+ with temporary_override([obj]):
323
324
  obj.update_cached_value("B", y + 3000)
324
325
 
325
326
  assert obj.C() == x * 10 + (y + 3000)
@@ -327,3 +328,21 @@ def test_custom_scenario(x, y):
327
328
  assert obj.C() == x * 10 + y
328
329
 
329
330
  assert obj.C() == x + y
331
+
332
+
333
+ def test_scenarios():
334
+ objects = [SimpleTestObj(i, i**2) for i in range(1, 4)]
335
+ for obj in objects:
336
+ obj.C()
337
+
338
+ scenario = Scenario(objects)
339
+
340
+ assert scenario.map(lambda x: x.C()).collect(False) == [2, 6, 12]
341
+
342
+ def tweak_object(x):
343
+ x.update_cached_value("A", 1, must_contain=False)
344
+ return x
345
+
346
+ assert scenario.map(tweak_object).map(lambda x: x.C()).collect() == [2, 5, 10]
347
+
348
+ assert scenario.map(tweak_object).map(lambda x: x.C()).filter(lambda x: x < 5).collect() == [2]
@@ -5,7 +5,7 @@ use pyo3::exceptions::{PyKeyError, PyRuntimeError, PyValueError};
5
5
  use rand::rng;
6
6
  use rand::seq::SliceRandom;
7
7
 
8
- use std::collections::{HashMap, HashSet};
8
+ use std::collections::HashSet;
9
9
 
10
10
  use crate::dependency_graph::{MethodDependencyGraph, ValidationState};
11
11
  use crate::py_introspection_utils::{normalise_function_signature_and_hash, validate_self_only_method};
@@ -14,14 +14,23 @@ use crate::metadata_hash_manager::{CacheKey, MetadataHashManager};
14
14
 
15
15
 
16
16
  pub struct CacheLayer {
17
- pub cache: HashMap<CacheKey, Py<PyAny>>,
17
+ pub cache: Vec<Option<Py<PyAny>>>,
18
18
  pub graph_snapshot: MethodDependencyGraph<CacheKey>, //TODO: maybe less expensive way to handling graph snapshot...
19
19
  }
20
20
 
21
21
 
22
+ #[inline]
23
+ fn set_cache_value(cache: &mut Vec<Option<Py<PyAny>>>, key: usize, value: Py<PyAny>) {
24
+ if key >= cache.len() {
25
+ cache.resize_with(key + 1, || None);
26
+ }
27
+ cache[key] = Some(value);
28
+ }
29
+
30
+
22
31
  #[pyclass(subclass)]
23
32
  pub struct DependencyCacheBase {
24
- pub cache: HashMap<CacheKey, Py<PyAny>>,
33
+ pub cache: Vec<Option<Py<PyAny>>>,
25
34
  pub method_dependency_graph: MethodDependencyGraph<CacheKey>,
26
35
  pub metadata_hash_manager: MetadataHashManager,
27
36
  pub call_stack: Vec<(CacheKey, bool)>,
@@ -35,9 +44,9 @@ impl DependencyCacheBase {
35
44
  return ();
36
45
  }
37
46
  if let Some(layer) = self.cache_stack.last_mut() {
38
- layer.cache.insert(key, value);
47
+ set_cache_value(&mut layer.cache, key, value);
39
48
  } else {
40
- self.cache.insert(key, value);
49
+ set_cache_value(&mut self.cache, key, value);
41
50
  };
42
51
  }
43
52
 
@@ -98,10 +107,10 @@ impl DependencyCacheBase {
98
107
 
99
108
  pub fn get_cached_value_by_key(&self, py: Python<'_>, key: CacheKey) -> Option<Py<PyAny>> {
100
109
  if self.method_dependency_graph.is_valid(key) {
101
- if let Some(temp_cache_value) = self.get_from_temporary_cache(py, &key) {
110
+ if let Some(temp_cache_value) = self.get_from_temporary_cache(py, key) {
102
111
  return Some(temp_cache_value);
103
112
  }
104
- return self.cache.get(&key).map(|obj| obj.clone_ref(py));
113
+ return self.cache.get(key).and_then(|obj| obj.as_ref().map(|v| v.clone_ref(py)));
105
114
  }
106
115
  return None;
107
116
  }
@@ -124,7 +133,7 @@ impl DependencyCacheBase {
124
133
 
125
134
  pub fn push_cache_stack(&mut self) {
126
135
  return self.cache_stack.push(CacheLayer {
127
- cache: HashMap::new(),
136
+ cache: Vec::new(),
128
137
  graph_snapshot: self.method_dependency_graph.clone(),
129
138
  });
130
139
  }
@@ -139,59 +148,91 @@ impl DependencyCacheBase {
139
148
  return Ok(());
140
149
  }
141
150
 
142
- pub fn get_from_temporary_cache(&self, py: Python<'_>, key: &CacheKey) -> Option<Py<PyAny>> {
151
+ pub fn get_from_temporary_cache(&self, py: Python<'_>, key: CacheKey) -> Option<Py<PyAny>> {
143
152
  for layer in self.cache_stack.iter().rev() {
144
- if let Some(v) = layer.cache.get(key) {
153
+ if let Some(Some(v)) = layer.cache.get(key) {
145
154
  return Some(v.clone_ref(py));
146
155
  }
147
156
  }
148
157
  return None;
149
158
  }
150
159
 
151
- pub fn contains_cached_value(&self, key: &CacheKey) -> bool {
152
- if !self.method_dependency_graph.is_valid(*key) {
160
+ pub fn contains_cached_value(&self, key: CacheKey) -> bool {
161
+ if !self.method_dependency_graph.is_valid(key) {
153
162
  return false;
154
163
  }
155
164
  return self.cache_stack
156
165
  .iter()
157
166
  .rev()
158
- .any(|layer| layer.cache.contains_key(key))
159
- || self.cache.contains_key(key);
167
+ .any(|layer| layer.cache.get(key).is_some_and(|obj| obj.is_some()))
168
+ || self.cache.get(key).is_some_and(|obj| obj.is_some());
160
169
  }
161
170
 
162
- pub fn remove_cached_value(&mut self, key: &CacheKey) -> Option<Py<PyAny>> {
171
+ pub fn remove_cached_value(&mut self, key: CacheKey) -> Option<Py<PyAny>> {
163
172
  for layer in self.cache_stack.iter_mut().rev() {
164
- if let Some(v) = layer.cache.remove(key) {
165
- return Some(v);
173
+ if let Some(opt) = layer.cache.get_mut(key) {
174
+ if let Some(v) = opt.take() {
175
+ return Some(v);
176
+ }
166
177
  }
167
178
  }
168
- return self.cache.remove(key);
179
+ if let Some(opt) = self.cache.get_mut(key) {
180
+ return opt.take();
181
+ }
182
+ return None;
169
183
  }
170
184
 
171
- pub fn effective_cache(&self) -> HashMap<&CacheKey, &Py<PyAny>> {
172
- let mut merged: HashMap<&CacheKey, &Py<PyAny>> = self.cache.iter().collect();
173
- for layer in &self.cache_stack {
174
- for (k, v) in &layer.cache {
175
- merged.insert(k, v);
185
+ pub fn effective_cache(&self) -> Vec<(CacheKey, &Py<PyAny>)> {
186
+ let max_len = self
187
+ .cache_stack
188
+ .iter()
189
+ .map(|l| l.cache.len())
190
+ .chain(std::iter::once(self.cache.len()))
191
+ .max()
192
+ .unwrap_or(0);
193
+
194
+ let mut result = Vec::new();
195
+ for i in 0..max_len {
196
+ let mut value: Option<&Py<PyAny>> =
197
+ self.cache.get(i).and_then(|opt| opt.as_ref());
198
+
199
+ for layer in &self.cache_stack {
200
+ if let Some(Some(v)) = layer.cache.get(i) {
201
+ value = Some(v);
202
+ }
203
+ }
204
+
205
+ if let Some(v) = value {
206
+ result.push((i, v));
176
207
  }
177
208
  }
178
- return merged;
209
+ return result;
179
210
  }
180
211
 
181
212
  pub fn clear_effective_cache(&mut self) -> () {
182
- if let Some(layer) = self.cache_stack.last_mut() {
183
- let removed_keys: Vec<CacheKey> = {
184
- let keys = layer.cache.keys().cloned().collect();
185
- layer.cache.clear();
186
- keys
187
- };
213
+ let mut removed_keys: HashSet<CacheKey> = HashSet::new();
214
+
215
+ for layer in self.cache_stack.iter_mut() {
216
+ for (i, obj) in layer.cache.iter_mut().enumerate() {
217
+ if obj.is_some() {
218
+ *obj = None;
219
+ removed_keys.insert(i);
220
+ }
221
+ }
222
+ }
223
+ for (i, obj) in self.cache.iter_mut().enumerate() {
224
+ if obj.is_some() {
225
+ *obj = None;
226
+ removed_keys.insert(i);
227
+ }
228
+ }
229
+
230
+ if removed_keys.is_empty() {
231
+ self.method_dependency_graph.invalidate_all();
232
+ } else {
188
233
  for key in removed_keys {
189
234
  self.method_dependency_graph.temporarily_invalidate(key);
190
235
  }
191
- layer.cache.clear();
192
- } else {
193
- self.method_dependency_graph.invalidate_all();
194
- self.cache.clear();
195
236
  }
196
237
  }
197
238
  }
@@ -202,7 +243,7 @@ impl DependencyCacheBase {
202
243
  #[pyo3(signature = (*_args, **_kwargs))]
203
244
  fn new(_args: &Bound<'_, PyTuple>, _kwargs: Option<&Bound<'_, PyDict>>) -> Self {
204
245
  return Self {
205
- cache: HashMap::new(),
246
+ cache: Vec::new(),
206
247
  method_dependency_graph: MethodDependencyGraph::new(),
207
248
  metadata_hash_manager: MetadataHashManager::new(),
208
249
  call_stack: Vec::new(),
@@ -240,21 +281,22 @@ impl DependencyCacheBase {
240
281
  kwargs: Option<Py<PyDict>>,
241
282
  ) -> PyResult<bool> {
242
283
  let key = self.get_key(py, &method_name, &kwargs)?;
243
- return Ok(self.contains_cached_value(&key));
284
+ return Ok(self.contains_cached_value(key));
244
285
  }
245
286
 
246
287
 
247
- #[pyo3(signature = (method_name, value, **kwargs))]
288
+ #[pyo3(signature = (method_name, value, must_contain=true, **kwargs))]
248
289
  pub fn update_cached_value(
249
290
  &mut self,
250
291
  py: Python<'_>,
251
292
  method_name: String,
252
293
  value: Py<PyAny>,
294
+ must_contain: bool,
253
295
  kwargs: Option<Py<PyDict>>,
254
296
  ) -> PyResult<()> {
255
297
  let key = self.get_key(py, &method_name, &kwargs)?;
256
298
 
257
- if !self.contains_cached_value(&key) {
299
+ if must_contain && !self.contains_cached_value(key) {
258
300
  return Err(PyKeyError::new_err(format!(
259
301
  "Cannot update cached value for '{method_name}'"
260
302
  )));
@@ -278,7 +320,7 @@ impl DependencyCacheBase {
278
320
  ) -> PyResult<()> {
279
321
  let key = self.get_key(py, &method_name, &kwargs)?;
280
322
 
281
- if self.remove_cached_value(&key).is_none() {
323
+ if self.remove_cached_value(key).is_none() {
282
324
  return Err(PyKeyError::new_err(format!(
283
325
  "Cannot clear cached value for '{method_name}'"
284
326
  )));
@@ -478,7 +520,7 @@ impl DependencyCacheBase {
478
520
 
479
521
  let mut base = slf.borrow_mut();
480
522
  let key = base.create_key(py, name, &None)?;
481
- base.cache.insert(key, loaded_value.unbind());
523
+ set_cache_value(base.cache.as_mut(), key, loaded_value.unbind());
482
524
  Ok(())
483
525
  };
484
526
 
@@ -4,13 +4,15 @@ mod dependency_cache_base;
4
4
  mod decorator_factory;
5
5
  mod py_introspection_utils;
6
6
  mod metadata_hash_manager;
7
+ mod r#override;
7
8
  mod scenario;
8
9
 
9
10
  use pyo3::prelude::*;
10
11
 
11
12
  use dependency_cache_base::DependencyCacheBase;
12
13
  use decorator_factory::{ManualDependencyCacheDecoratorFactory, AutomagicDependencyCacheDecoratorFactory};
13
- use scenario::custom_scenario;
14
+ use r#override::temporary_override;
15
+ use scenario::Scenario;
14
16
 
15
17
 
16
18
  #[pymodule]
@@ -26,5 +28,8 @@ mod dependency_cache {
26
28
  use super::AutomagicDependencyCacheDecoratorFactory;
27
29
 
28
30
  #[pymodule_export]
29
- use super::custom_scenario;
31
+ use super::temporary_override;
32
+
33
+ #[pymodule_export]
34
+ use super::Scenario;
30
35
  }
@@ -4,7 +4,7 @@ use pyo3::exceptions::PyKeyError;
4
4
 
5
5
  use std::collections::HashMap;
6
6
 
7
- pub type CacheKey = u64;
7
+ pub type CacheKey = usize;
8
8
 
9
9
  pub struct MetadataHashManager {
10
10
  buckets: HashMap<isize, Vec<CacheKey>>,
@@ -4,23 +4,23 @@ use pyo3::exceptions::PyTypeError;
4
4
  use crate::DependencyCacheBase;
5
5
 
6
6
  #[pyclass]
7
- pub struct Scenario {
8
- items: Vec<Py<PyAny>>,
7
+ pub struct TemporaryOverride {
8
+ objects: Vec<Py<PyAny>>,
9
9
  }
10
10
 
11
11
 
12
12
  #[pymethods]
13
- impl Scenario {
13
+ impl TemporaryOverride {
14
14
  fn __enter__<'py>(slf: &Bound<'py, Self>, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
15
15
  {
16
- let scenario = slf.borrow();
17
- for item in &scenario.items {
18
- let base = item
16
+ let temporary_override = slf.borrow();
17
+ for object in &temporary_override.objects {
18
+ let base = object
19
19
  .bind(py)
20
20
  .cast::<DependencyCacheBase>()
21
21
  .map_err(|_| {
22
22
  PyTypeError::new_err(
23
- "custom_scenario() expects items to inherit from DependencyCacheBase",
23
+ "temporary_override() expects items to inherit from DependencyCacheBase",
24
24
  )
25
25
  })?;
26
26
  base.borrow_mut().push_cache_stack();
@@ -37,14 +37,14 @@ impl Scenario {
37
37
  _traceback: Option<Bound<'_, PyAny>>,
38
38
  ) -> PyResult<bool> {
39
39
  {
40
- let scenario = slf.borrow();
41
- for item in scenario.items.iter() {
42
- let base = item
40
+ let temporary_override = slf.borrow();
41
+ for objects in temporary_override.objects.iter() {
42
+ let base = objects
43
43
  .bind(py)
44
44
  .cast::<DependencyCacheBase>()
45
45
  .map_err(|_| {
46
46
  PyTypeError::new_err(
47
- "custom_scenario() expects items to inherit from DependencyCacheBase",
47
+ "temporary_override() expects items to inherit from DependencyCacheBase",
48
48
  )
49
49
  })?;
50
50
  base.borrow_mut().pop_cache_stack()?;
@@ -56,6 +56,6 @@ impl Scenario {
56
56
 
57
57
 
58
58
  #[pyfunction]
59
- pub fn custom_scenario(items: Vec<Py<PyAny>>) -> PyResult<Scenario> {
60
- return Ok(Scenario { items });
59
+ pub fn temporary_override(objects: Vec<Py<PyAny>>) -> PyResult<TemporaryOverride> {
60
+ return Ok(TemporaryOverride { objects });
61
61
  }
@@ -0,0 +1,131 @@
1
+ use pyo3::prelude::*;
2
+ use pyo3::exceptions::PyTypeError;
3
+ use rayon::prelude::*;
4
+
5
+ use crate::DependencyCacheBase;
6
+
7
+ #[pyclass]
8
+ pub struct Scenario {
9
+ objects: Vec<Py<PyAny>>,
10
+ operations: Vec<Operation>,
11
+ }
12
+
13
+ enum Operation {
14
+ Map(Py<PyAny>),
15
+ Filter(Py<PyAny>),
16
+ }
17
+
18
+ impl Operation {
19
+ fn clone_ref(&self, py: Python<'_>) -> Self {
20
+ return match self {
21
+ Operation::Map(f) => Operation::Map(f.clone_ref(py)),
22
+ Operation::Filter(f) => Operation::Filter(f.clone_ref(py)),
23
+ };
24
+ }
25
+ }
26
+
27
+
28
+ impl Scenario {
29
+ fn apply_operations(&self, object: &Py<PyAny>) -> PyResult<Option<Py<PyAny>>> {
30
+ return Python::attach(|py| {
31
+ let mut current = object.clone_ref(py);
32
+ for op in &self.operations {
33
+ match op {
34
+ Operation::Map(func) => {
35
+ current = func.call1(py, (current,))?;
36
+ }
37
+ Operation::Filter(cond) => {
38
+ let keep: bool = cond
39
+ .call1(py, (current.clone_ref(py),))?
40
+ .extract(py)?;
41
+ if !keep {
42
+ return Ok(None);
43
+ }
44
+ }
45
+ }
46
+ }
47
+ Ok(Some(current))
48
+ });
49
+ }
50
+
51
+ fn push_overrides(&self, py: Python<'_>) -> PyResult<()> {
52
+ for item in &self.objects {
53
+ let base = item.bind(py).cast::<DependencyCacheBase>()?;
54
+ base.borrow_mut().push_cache_stack();
55
+ }
56
+ return Ok(());
57
+ }
58
+
59
+ fn pop_overrides(&self, py: Python<'_>) -> Result<(), PyErr> {
60
+ let mut first_err: Option<PyErr> = None;
61
+ for item in &self.objects {
62
+ let base = item.bind(py).cast::<DependencyCacheBase>()?;
63
+ if let Err(e) = base.borrow_mut().pop_cache_stack() {
64
+ first_err.get_or_insert(e);
65
+ }
66
+ }
67
+ return first_err.map_or(Ok(()), Err);
68
+ }
69
+ }
70
+
71
+
72
+ #[pymethods]
73
+ impl Scenario {
74
+ #[new]
75
+ fn new(py: Python<'_>, objects: Vec<Py<PyAny>>) -> PyResult<Self> {
76
+ for object in &objects {
77
+ object.bind(py).cast::<DependencyCacheBase>().map_err(|_| {
78
+ PyTypeError::new_err(
79
+ "Scenario items must inherit from DependencyCacheBase",
80
+ )
81
+ })?;
82
+ }
83
+ return Ok(Scenario { objects, operations: Vec::new() });
84
+ }
85
+
86
+ fn map(&self, py: Python<'_>, func: Py<PyAny>) -> PyResult<Self> {
87
+ let mut ops: Vec<Operation> = self.operations.iter()
88
+ .map(|op| op.clone_ref(py))
89
+ .collect();
90
+ ops.push(Operation::Map(func));
91
+ return Ok(Scenario {
92
+ objects: self.objects.iter()
93
+ .map(|o| o.clone_ref(py))
94
+ .collect(),
95
+ operations: ops,
96
+ });
97
+ }
98
+
99
+ fn filter(&self, py: Python<'_>, predicate: Py<PyAny>) -> PyResult<Self> {
100
+ let mut ops: Vec<Operation> = self.operations.iter()
101
+ .map(|op| op.clone_ref(py))
102
+ .collect();
103
+ ops.push(Operation::Filter(predicate));
104
+ return Ok(Scenario {
105
+ objects: self.objects.iter()
106
+ .map(|o| o.clone_ref(py))
107
+ .collect(),
108
+ operations: ops,
109
+ });
110
+ }
111
+
112
+ #[pyo3(signature = (parallel = true))]
113
+ fn collect(&self, py: Python<'_>, parallel: bool) -> PyResult<Vec<Py<PyAny>>> {
114
+ self.push_overrides(py)?;
115
+ let results = if parallel {
116
+ py.detach(|| {
117
+ self.objects
118
+ .par_iter()
119
+ .filter_map(|object| self.apply_operations(object).transpose())
120
+ .collect::<PyResult<Vec<_>>>()
121
+ })
122
+ } else {
123
+ self.objects
124
+ .iter()
125
+ .filter_map(|object| self.apply_operations(object).transpose())
126
+ .collect::<PyResult<Vec<_>>>()
127
+ };
128
+ self.pop_overrides(py)?;
129
+ return results;
130
+ }
131
+ }
@@ -1,5 +1,5 @@
1
1
  version = 1
2
- revision = 2
2
+ revision = 5
3
3
  requires-python = ">=3.8"
4
4
  resolution-markers = [
5
5
  "python_full_version >= '3.12'",
@@ -26,7 +26,7 @@ resolution-markers = [
26
26
  "python_full_version < '3.9'",
27
27
  ]
28
28
  dependencies = [
29
- { name = "numpy", version = "1.24.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
29
+ { name = "numpy", version = "1.24.4", source = { registry = "https://pypi.org/simple" } },
30
30
  ]
31
31
  sdist = { url = "https://files.pythonhosted.org/packages/b1/7d/087ee4295e7580d3f7eb8a8a4e0ec8c7847e60f34135248ccf831cf5bbfc/contourpy-1.1.1.tar.gz", hash = "sha256:96ba37c2e24b7212a77da85004c38e7c4d155d3e72a45eeaf22c1f03f607e8ab", size = 13433167, upload-time = "2023-09-16T10:25:49.501Z" }
32
32
  wheels = [
@@ -91,7 +91,7 @@ resolution-markers = [
91
91
  "python_full_version == '3.9.*'",
92
92
  ]
93
93
  dependencies = [
94
- { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" },
94
+ { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" } },
95
95
  ]
96
96
  sdist = { url = "https://files.pythonhosted.org/packages/f5/f6/31a8f28b4a2a4fa0e01085e542f3081ab0588eff8e589d39d775172c9792/contourpy-1.3.0.tar.gz", hash = "sha256:7ffa0db17717a8ffb127efd0c95a4362d996b892c2904db72428d5b52e1938a4", size = 13464370, upload-time = "2024-08-27T21:00:03.328Z" }
97
97
  wheels = [
@@ -169,7 +169,7 @@ resolution-markers = [
169
169
  "python_full_version == '3.10.*'",
170
170
  ]
171
171
  dependencies = [
172
- { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" },
172
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" } },
173
173
  ]
174
174
  sdist = { url = "https://files.pythonhosted.org/packages/66/54/eb9bfc647b19f2009dd5c7f5ec51c4e6ca831725f1aea7a993034f483147/contourpy-1.3.2.tar.gz", hash = "sha256:b6945942715a034c671b7fc54f9588126b0b8bf23db2696e3ca8328f3ff0ab54", size = 13466130, upload-time = "2025-04-15T17:47:53.79Z" }
175
175
  wheels = [
@@ -240,7 +240,7 @@ resolution-markers = [
240
240
  "python_full_version == '3.11.*'",
241
241
  ]
242
242
  dependencies = [
243
- { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.11.*'" },
243
+ { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
244
244
  { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
245
245
  ]
246
246
  sdist = { url = "https://files.pythonhosted.org/packages/58/01/1253e6698a07380cd31a736d248a3f2a50a7c88779a1813da27503cadc2a/contourpy-1.3.3.tar.gz", hash = "sha256:083e12155b210502d0bca491432bb04d56dc3432f95a979b429f2848c3dbe880", size = 13466174, upload-time = "2025-07-26T12:03:12.549Z" }
@@ -329,7 +329,7 @@ wheels = [
329
329
 
330
330
  [[package]]
331
331
  name = "dependency-cache"
332
- version = "0.5.1"
332
+ version = "0.6.0"
333
333
  source = { editable = "." }
334
334
  dependencies = [
335
335
  { name = "matplotlib", version = "3.7.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
@@ -363,7 +363,7 @@ name = "exceptiongroup"
363
363
  version = "1.3.1"
364
364
  source = { registry = "https://pypi.org/simple" }
365
365
  dependencies = [
366
- { name = "typing-extensions", version = "4.13.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
366
+ { name = "typing-extensions", version = "4.13.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9' or python_full_version >= '3.11'" },
367
367
  { name = "typing-extensions", version = "4.16.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9' and python_full_version < '3.11'" },
368
368
  ]
369
369
  sdist = { url = "https://files.pythonhosted.org/packages/50/79/66800aadf48771f6b62f7eb014e352e5d06856655206165d775e675a02c9/exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219", size = 30371, upload-time = "2025-11-21T23:01:54.787Z" }
@@ -569,7 +569,7 @@ resolution-markers = [
569
569
  "python_full_version < '3.9'",
570
570
  ]
571
571
  dependencies = [
572
- { name = "zipp", version = "3.20.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
572
+ { name = "zipp", version = "3.20.2", source = { registry = "https://pypi.org/simple" } },
573
573
  ]
574
574
  sdist = { url = "https://files.pythonhosted.org/packages/98/be/f3e8c6081b684f176b761e6a2fef02a0be939740ed6f54109a2951d806f3/importlib_resources-6.4.5.tar.gz", hash = "sha256:980862a1d16c9e147a59603677fa2aa5fd82b87f223b6cb870695bcfce830065", size = 43372, upload-time = "2024-09-09T17:03:14.677Z" }
575
575
  wheels = [
@@ -584,7 +584,7 @@ resolution-markers = [
584
584
  "python_full_version == '3.9.*'",
585
585
  ]
586
586
  dependencies = [
587
- { name = "zipp", version = "3.23.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" },
587
+ { name = "zipp", version = "3.23.1", source = { registry = "https://pypi.org/simple" } },
588
588
  ]
589
589
  sdist = { url = "https://files.pythonhosted.org/packages/cf/8c/f834fbf984f691b4f7ff60f50b514cc3de5cc08abfc3295564dd89c5e2e7/importlib_resources-6.5.2.tar.gz", hash = "sha256:185f87adef5bcc288449d98fb4fba07cea78bc036455dd44c5fc4a2fe78fed2c", size = 44693, upload-time = "2025-01-03T18:51:56.698Z" }
590
590
  wheels = [
@@ -880,16 +880,16 @@ resolution-markers = [
880
880
  "python_full_version < '3.9'",
881
881
  ]
882
882
  dependencies = [
883
- { name = "contourpy", version = "1.1.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
884
- { name = "cycler", marker = "python_full_version < '3.9'" },
885
- { name = "fonttools", version = "4.57.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
886
- { name = "importlib-resources", version = "6.4.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
887
- { name = "kiwisolver", version = "1.4.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
888
- { name = "numpy", version = "1.24.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
889
- { name = "packaging", marker = "python_full_version < '3.9'" },
890
- { name = "pillow", version = "10.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
891
- { name = "pyparsing", version = "3.1.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
892
- { name = "python-dateutil", marker = "python_full_version < '3.9'" },
883
+ { name = "contourpy", version = "1.1.1", source = { registry = "https://pypi.org/simple" } },
884
+ { name = "cycler" },
885
+ { name = "fonttools", version = "4.57.0", source = { registry = "https://pypi.org/simple" } },
886
+ { name = "importlib-resources", version = "6.4.5", source = { registry = "https://pypi.org/simple" } },
887
+ { name = "kiwisolver", version = "1.4.7", source = { registry = "https://pypi.org/simple" } },
888
+ { name = "numpy", version = "1.24.4", source = { registry = "https://pypi.org/simple" } },
889
+ { name = "packaging" },
890
+ { name = "pillow", version = "10.4.0", source = { registry = "https://pypi.org/simple" } },
891
+ { name = "pyparsing", version = "3.1.4", source = { registry = "https://pypi.org/simple" } },
892
+ { name = "python-dateutil" },
893
893
  ]
894
894
  sdist = { url = "https://files.pythonhosted.org/packages/b6/f0/3836719cc3982fbba3b840d18a59db1d0ee9ac7986f24e8c0a092851b67b/matplotlib-3.7.5.tar.gz", hash = "sha256:1e5c971558ebc811aa07f54c7b7c677d78aa518ef4c390e14673a09e0860184a", size = 38098611, upload-time = "2024-02-16T10:50:56.19Z" }
895
895
  wheels = [
@@ -949,16 +949,16 @@ resolution-markers = [
949
949
  "python_full_version == '3.9.*'",
950
950
  ]
951
951
  dependencies = [
952
- { name = "contourpy", version = "1.3.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" },
953
- { name = "cycler", marker = "python_full_version == '3.9.*'" },
954
- { name = "fonttools", version = "4.60.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" },
955
- { name = "importlib-resources", version = "6.5.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" },
956
- { name = "kiwisolver", version = "1.4.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" },
957
- { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" },
958
- { name = "packaging", marker = "python_full_version == '3.9.*'" },
959
- { name = "pillow", version = "11.3.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" },
960
- { name = "pyparsing", version = "3.3.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" },
961
- { name = "python-dateutil", marker = "python_full_version == '3.9.*'" },
952
+ { name = "contourpy", version = "1.3.0", source = { registry = "https://pypi.org/simple" } },
953
+ { name = "cycler" },
954
+ { name = "fonttools", version = "4.60.2", source = { registry = "https://pypi.org/simple" } },
955
+ { name = "importlib-resources", version = "6.5.2", source = { registry = "https://pypi.org/simple" } },
956
+ { name = "kiwisolver", version = "1.4.7", source = { registry = "https://pypi.org/simple" } },
957
+ { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" } },
958
+ { name = "packaging" },
959
+ { name = "pillow", version = "11.3.0", source = { registry = "https://pypi.org/simple" } },
960
+ { name = "pyparsing", version = "3.3.2", source = { registry = "https://pypi.org/simple" } },
961
+ { name = "python-dateutil" },
962
962
  ]
963
963
  sdist = { url = "https://files.pythonhosted.org/packages/df/17/1747b4154034befd0ed33b52538f5eb7752d05bb51c5e2a31470c3bc7d52/matplotlib-3.9.4.tar.gz", hash = "sha256:1e00e8be7393cbdc6fedfa8a6fba02cf3e83814b285db1c60b906a023ba41bc3", size = 36106529, upload-time = "2024-12-13T05:56:34.184Z" }
964
964
  wheels = [
@@ -1012,15 +1012,15 @@ resolution-markers = [
1012
1012
  "python_full_version == '3.10.*'",
1013
1013
  ]
1014
1014
  dependencies = [
1015
- { name = "contourpy", version = "1.3.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" },
1016
- { name = "cycler", marker = "python_full_version == '3.10.*'" },
1017
- { name = "fonttools", version = "4.63.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" },
1018
- { name = "kiwisolver", version = "1.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" },
1019
- { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" },
1020
- { name = "packaging", marker = "python_full_version == '3.10.*'" },
1021
- { name = "pillow", version = "12.3.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" },
1022
- { name = "pyparsing", version = "3.3.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" },
1023
- { name = "python-dateutil", marker = "python_full_version == '3.10.*'" },
1015
+ { name = "contourpy", version = "1.3.2", source = { registry = "https://pypi.org/simple" } },
1016
+ { name = "cycler" },
1017
+ { name = "fonttools", version = "4.63.0", source = { registry = "https://pypi.org/simple" } },
1018
+ { name = "kiwisolver", version = "1.5.0", source = { registry = "https://pypi.org/simple" } },
1019
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" } },
1020
+ { name = "packaging" },
1021
+ { name = "pillow", version = "12.3.0", source = { registry = "https://pypi.org/simple" } },
1022
+ { name = "pyparsing", version = "3.3.2", source = { registry = "https://pypi.org/simple" } },
1023
+ { name = "python-dateutil" },
1024
1024
  ]
1025
1025
  sdist = { url = "https://files.pythonhosted.org/packages/63/1b/4be5be87d43d327a0cf4de1a56e86f7f84c89312452406cf122efe2839e6/matplotlib-3.10.9.tar.gz", hash = "sha256:fd66508e8c6877d98e586654b608a0456db8d7e8a546eb1e2600efd957302358", size = 34811233, upload-time = "2026-04-24T00:14:13.539Z" }
1026
1026
  wheels = [
@@ -1089,16 +1089,16 @@ resolution-markers = [
1089
1089
  "python_full_version == '3.11.*'",
1090
1090
  ]
1091
1091
  dependencies = [
1092
- { name = "contourpy", version = "1.3.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
1093
- { name = "cycler", marker = "python_full_version >= '3.11'" },
1094
- { name = "fonttools", version = "4.63.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
1095
- { name = "kiwisolver", version = "1.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
1096
- { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.11.*'" },
1092
+ { name = "contourpy", version = "1.3.3", source = { registry = "https://pypi.org/simple" } },
1093
+ { name = "cycler" },
1094
+ { name = "fonttools", version = "4.63.0", source = { registry = "https://pypi.org/simple" } },
1095
+ { name = "kiwisolver", version = "1.5.0", source = { registry = "https://pypi.org/simple" } },
1096
+ { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
1097
1097
  { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
1098
- { name = "packaging", marker = "python_full_version >= '3.11'" },
1099
- { name = "pillow", version = "12.3.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
1100
- { name = "pyparsing", version = "3.3.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
1101
- { name = "python-dateutil", marker = "python_full_version >= '3.11'" },
1098
+ { name = "packaging" },
1099
+ { name = "pillow", version = "12.3.0", source = { registry = "https://pypi.org/simple" } },
1100
+ { name = "pyparsing", version = "3.3.2", source = { registry = "https://pypi.org/simple" } },
1101
+ { name = "python-dateutil" },
1102
1102
  ]
1103
1103
  sdist = { url = "https://files.pythonhosted.org/packages/49/64/f9a391af28f518b11ad45a8a712353c94a0aefce09d3703200e5c54b610a/matplotlib-3.11.1.tar.gz", hash = "sha256:69647db5746941c793d6e445a4cd349323ffb87d9cc958c2ad84a659b4832d30", size = 32612045, upload-time = "2026-07-18T03:39:46.63Z" }
1104
1104
  wheels = [
@@ -1877,12 +1877,12 @@ resolution-markers = [
1877
1877
  "python_full_version < '3.9'",
1878
1878
  ]
1879
1879
  dependencies = [
1880
- { name = "colorama", marker = "python_full_version < '3.9' and sys_platform == 'win32'" },
1881
- { name = "exceptiongroup", marker = "python_full_version < '3.9'" },
1882
- { name = "iniconfig", version = "2.1.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
1883
- { name = "packaging", marker = "python_full_version < '3.9'" },
1884
- { name = "pluggy", version = "1.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },
1885
- { name = "tomli", marker = "python_full_version < '3.9'" },
1880
+ { name = "colorama", marker = "sys_platform == 'win32'" },
1881
+ { name = "exceptiongroup" },
1882
+ { name = "iniconfig", version = "2.1.0", source = { registry = "https://pypi.org/simple" } },
1883
+ { name = "packaging" },
1884
+ { name = "pluggy", version = "1.5.0", source = { registry = "https://pypi.org/simple" } },
1885
+ { name = "tomli" },
1886
1886
  ]
1887
1887
  sdist = { url = "https://files.pythonhosted.org/packages/ae/3c/c9d525a414d506893f0cd8a8d0de7706446213181570cdbd766691164e40/pytest-8.3.5.tar.gz", hash = "sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845", size = 1450891, upload-time = "2025-03-02T12:54:54.503Z" }
1888
1888
  wheels = [
@@ -1897,13 +1897,13 @@ resolution-markers = [
1897
1897
  "python_full_version == '3.9.*'",
1898
1898
  ]
1899
1899
  dependencies = [
1900
- { name = "colorama", marker = "python_full_version == '3.9.*' and sys_platform == 'win32'" },
1901
- { name = "exceptiongroup", marker = "python_full_version == '3.9.*'" },
1902
- { name = "iniconfig", version = "2.1.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" },
1903
- { name = "packaging", marker = "python_full_version == '3.9.*'" },
1904
- { name = "pluggy", version = "1.6.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" },
1905
- { name = "pygments", marker = "python_full_version == '3.9.*'" },
1906
- { name = "tomli", marker = "python_full_version == '3.9.*'" },
1900
+ { name = "colorama", marker = "sys_platform == 'win32'" },
1901
+ { name = "exceptiongroup" },
1902
+ { name = "iniconfig", version = "2.1.0", source = { registry = "https://pypi.org/simple" } },
1903
+ { name = "packaging" },
1904
+ { name = "pluggy", version = "1.6.0", source = { registry = "https://pypi.org/simple" } },
1905
+ { name = "pygments" },
1906
+ { name = "tomli" },
1907
1907
  ]
1908
1908
  sdist = { url = "https://files.pythonhosted.org/packages/a3/5c/00a0e072241553e1a7496d638deababa67c5058571567b92a7eaa258397c/pytest-8.4.2.tar.gz", hash = "sha256:86c0d0b93306b961d58d62a4db4879f27fe25513d4b969df351abdddb3c30e01", size = 1519618, upload-time = "2025-09-04T14:34:22.711Z" }
1909
1909
  wheels = [
@@ -1920,13 +1920,13 @@ resolution-markers = [
1920
1920
  "python_full_version == '3.10.*'",
1921
1921
  ]
1922
1922
  dependencies = [
1923
- { name = "colorama", marker = "python_full_version >= '3.10' and sys_platform == 'win32'" },
1924
- { name = "exceptiongroup", marker = "python_full_version == '3.10.*'" },
1925
- { name = "iniconfig", version = "2.3.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" },
1926
- { name = "packaging", marker = "python_full_version >= '3.10'" },
1927
- { name = "pluggy", version = "1.6.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" },
1928
- { name = "pygments", marker = "python_full_version >= '3.10'" },
1929
- { name = "tomli", marker = "python_full_version == '3.10.*'" },
1923
+ { name = "colorama", marker = "sys_platform == 'win32'" },
1924
+ { name = "exceptiongroup", marker = "python_full_version < '3.11'" },
1925
+ { name = "iniconfig", version = "2.3.0", source = { registry = "https://pypi.org/simple" } },
1926
+ { name = "packaging" },
1927
+ { name = "pluggy", version = "1.6.0", source = { registry = "https://pypi.org/simple" } },
1928
+ { name = "pygments" },
1929
+ { name = "tomli", marker = "python_full_version < '3.11'" },
1930
1930
  ]
1931
1931
  sdist = { url = "https://files.pythonhosted.org/packages/e4/47/b9efed96c114afcfa3c9d3fe98a76a1d14c74a9e266d397cf6eb64be5e01/pytest-9.1.1.tar.gz", hash = "sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313", size = 1636369, upload-time = "2026-06-19T10:58:32.857Z" }
1932
1932
  wheels = [