checkpointer 2.14.5__tar.gz → 2.14.6__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 (21) hide show
  1. {checkpointer-2.14.5 → checkpointer-2.14.6}/PKG-INFO +1 -1
  2. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/checkpoint.py +3 -0
  3. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/storages/pickle_storage.py +2 -1
  4. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/storages/storage.py +1 -1
  5. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/utils.py +4 -4
  6. {checkpointer-2.14.5 → checkpointer-2.14.6}/pyproject.toml +1 -1
  7. {checkpointer-2.14.5 → checkpointer-2.14.6}/uv.lock +1 -1
  8. {checkpointer-2.14.5 → checkpointer-2.14.6}/.gitignore +0 -0
  9. {checkpointer-2.14.5 → checkpointer-2.14.6}/.python-version +0 -0
  10. {checkpointer-2.14.5 → checkpointer-2.14.6}/ATTRIBUTION.md +0 -0
  11. {checkpointer-2.14.5 → checkpointer-2.14.6}/LICENSE +0 -0
  12. {checkpointer-2.14.5 → checkpointer-2.14.6}/README.md +0 -0
  13. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/__init__.py +0 -0
  14. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/fn_ident.py +0 -0
  15. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/fn_string.py +0 -0
  16. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/import_mappings.py +0 -0
  17. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/object_hash.py +0 -0
  18. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/print_checkpoint.py +0 -0
  19. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/storages/__init__.py +0 -0
  20. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/storages/memory_storage.py +0 -0
  21. {checkpointer-2.14.5 → checkpointer-2.14.6}/checkpointer/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: checkpointer
3
- Version: 2.14.5
3
+ Version: 2.14.6
4
4
  Summary: checkpointer adds code-aware caching to Python functions, maintaining correctness and speeding up execution as your code changes.
5
5
  Project-URL: Repository, https://github.com/Reddan/checkpointer.git
6
6
  Author: Hampus Hallman
@@ -263,6 +263,9 @@ class CachedFunction(Generic[Fn]):
263
263
  def set(self, value, *args, **kw):
264
264
  self.storage.store(self._get_call_hash(args, kw), value)
265
265
 
266
+ def set_awaitable(self: CachedFunction[Callable[P, Coro[R]]], value: R, *args: P.args, **kw: P.kwargs):
267
+ self.set(AwaitableValue(value), *args, **kw)
268
+
266
269
  def __repr__(self) -> str:
267
270
  initialized = "fn_hash" in self.ident.__dict__
268
271
  fn_hash = self.ident.fn_hash[:6] if initialized else "- uninitialized"
@@ -53,7 +53,8 @@ class PickleStorage(Storage):
53
53
  if invalidated and fn_path.exists():
54
54
  old_dirs = [path for path in fn_path.iterdir() if path.is_dir() and path != version_path]
55
55
  for path in old_dirs:
56
- shutil.rmtree(path)
56
+ for pkl_path in path.glob("**/*.pkl"):
57
+ pkl_path.unlink(missing_ok=True)
57
58
  if old_dirs:
58
59
  print(f"Removed {len(old_dirs)} invalidated directories for {self.cached_fn.__qualname__}")
59
60
  if expired and self.checkpointer.expiry:
@@ -22,7 +22,7 @@ class Storage:
22
22
  return self.checkpointer.directory / self.fn_id()
23
23
 
24
24
  def expired(self, call_hash: str) -> bool:
25
- if not self.checkpointer.expiry:
25
+ if self.checkpointer.expiry is None:
26
26
  return False
27
27
  return self.expired_dt(self.checkpoint_date(call_hash))
28
28
 
@@ -121,15 +121,15 @@ def empty_dirs(path: Path) -> Iterable[Path]:
121
121
  for child in path.iterdir():
122
122
  nonempty_count += 1
123
123
  if child.is_dir():
124
- for grand_child in empty_dirs(child):
125
- yield grand_child
126
- nonempty_count -= child == grand_child
124
+ for descendant in empty_dirs(child):
125
+ yield descendant
126
+ nonempty_count -= child == descendant
127
127
  if nonempty_count == 0:
128
128
  yield path
129
129
 
130
130
  def clear_directory(path: Path):
131
131
  if path.is_dir():
132
132
  for file in path.glob("**/.DS_Store"):
133
- file.unlink()
133
+ file.unlink(missing_ok=True)
134
134
  for directory in empty_dirs(path):
135
135
  directory.rmdir()
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "checkpointer"
3
- version = "2.14.5"
3
+ version = "2.14.6"
4
4
  requires-python = ">=3.11"
5
5
  dependencies = []
6
6
  authors = [
@@ -8,7 +8,7 @@ resolution-markers = [
8
8
 
9
9
  [[package]]
10
10
  name = "checkpointer"
11
- version = "2.14.5"
11
+ version = "2.14.6"
12
12
  source = { editable = "." }
13
13
 
14
14
  [package.dev-dependencies]
File without changes
File without changes
File without changes