{"repo":"karlicoss/cachew","free":true,"listed":false,"github":"https://github.com/karlicoss/cachew","clone":"git clone https://github.com/karlicoss/cachew.git","description":"Transparent and persistent cache/serialization powered by type hints","language":"Python","stars":236,"topics":["cache","sqlite","sqlite-database","decorator","namedtuple","dataclass","python-decorator","serialization","mypy"],"license":"MIT","category":"databases-storage","readme_excerpt":"What is Cachew? TLDR: cachew lets you cache function calls into an sqlite database on your disk in a matter of single decorator (similar to functools.lru cache). The difference from functools.lru cache is that cached data is persisted between program runs, so next time you call your function, it will only be a matter of reading from the cache. Cache is invalidated automatically if your function's arguments change, so you don't have to think about maintaining it. In order to be cacheable, your function needs to return a simple data type, or an Iterator over such types. A simple type is defined as: - primitive: str / int / float / bool - JSON-like types ( dict / list / tuple ) - datetime - Exception (useful for error handling ) - NamedTuples - dataclasses That allows to automatically infer schema from type hints (PEP 526) and not think about serializing/deserializing. Thanks to type hints, you don't need to annotate your classes with any special decorators, inherit from some special base classes, etc., as it's often the case for serialization libraries. Motivation I often find myself processing big chunks of data, merging data together, computing some aggregates on it or extracting few bits I'm interested at. While I'm trying to utilize REPL as much as I can, some things are still fragile and often you just have to rerun the whole thing in the process of development. This can be frustrating if data parsing and processing takes seconds, let alone minutes in some cases. Conventio","default_branch":null,"files":null,"tree":[],"storefront":"/r/karlicoss","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/karlicoss/cachew/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}