Skip to main content

Easily stash the results of expensive functions to disk

Project description

🐿️ Scrat

Easily stash the results of expensive functions to disk.

Get Started

  1. Install with pip install git+https://github.com/javiber/scrat.git (pypi package coming soon)
  2. Initialize stash scrat init
  3. Start saving time:
import scrat as sc
import time

@sc.stash()
def expensive_function(param_1):
    time.sleep(3)
    return param_1

expensive_function(1)  # <- function called
expensive_function(1)  # <- function not called the result is recovered from stash
expensive_function(2)  # <- function called again beacuse the parameters changed

Features

  • Stores results to disk so they can be reused in different runs
  • Automatically re-runs the function if the parameters or the function code changed
  • Automatically saves any result using pickle
  • Automatically saves pandas DataFrames as parquet
  • Customizable to allow other serializers to store any kind of result efficiently
  • Customizable to hash any type of parameter efficiently
  • CLI to control stash

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scrat-0.1.0.tar.gz (11.1 kB view hashes)

Uploaded Source

Built Distribution

scrat-0.1.0-py3-none-any.whl (15.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page