Releases: cevans87/atools
Releases · cevans87/atools
Fix version specifier for `dataclasses`
Fix expire memo with size and duration
v0.14.1 Version 0.14.1
Enable custom `pickler` for persistent memoization
v0.14.0 Add `pickler` argument to memoize.
Fix accidental removal of HEAD^^ in HEAD^
v0.13.1 Fix accidental removal of HEAD^^ in HEAD^
Add memoize.{update|upsert}
Resolve #56
Fix memoize lifetime mishandling NoneType input
v0.12.1 Fix memoize lifetime mishandling NoneType input
Remove `memoize.set_default_db_path` function
Resolve #51
Use pickle to memoize to db
Instead of using some complex `str()` and `eval()` logic to serialize and deserialize python objects, we now use `pickle.{dumps|loads}`. The pickle module does a good job of getting this right. Our previous logic did not. Resolve #45
Bind memo lifetime to arguments that can't be recreated
Arguments that can never be recreated (arguments that use object.__hash__
, which bases hash on id()
) automatically delete memo when they are garbage collected. So, the following example now runs without issue.
class Foo:
pass
@memoize
def bar(foo: Foo) -> None:
pass
foo = Foo()
bar(foo)
assert len(bar.memoize) == 1
del foo
assert len(bar.memoize) == 0
Small bug fixes
- Memoized functions are now tracked with weakref by this package, so they may be garbage collected.
- Memoized functions that use a non-default keygen can now be called with default kwargs omitted.