Skip to main content

Cash — stop re-running work that hasn't changed

PyPI version Downloads Python 3.10+ CI Docs License: MIT Status: Beta

Two lines. Zero config. Restart-and-run-all in seconds instead of minutes.

import cash
%cash_on

That's it. The next time you re-run the notebook, every statement that hasn't changed is restored from cache instead of recomputed. Outside notebooks, the same engine wraps any function as @cash.cache.

📺 Watch the 90-second demo — Cash caching a real notebook, end to end:

https://github.com/user-attachments/assets/3f376660-aeb5-4794-89cc-532a04f82f32

Or try it live in your browser — no install:

Open In Colab Binder

Read the docs →


Two ways to use cash

Pick the path that matches how you write code — both ride the same engine:

  • In a notebook — add %cash_on and every cell caches itself, statement-level, with a badge above each cell. For interactive work in Jupyter, Colab, or VS Code.
  • In a script — wrap a function with @cash.cache and it caches by its arguments and its own source. For modules, pipelines, and batch jobs.

Why Cash is different

Most caching tools cache cells or function calls. Cash caches statements — the individual lines inside a cell — and tracks the dependency graph between them.

  • Statement-level, not cell-level. Change one line in a 20-line cell → that line and its dependents recompute. The other 19 stay cached.
  • Dependency-aware. Cash builds a lineage graph. Touch config → only cells that read config (transitively) re-run.
  • File-aware. Cash intercepts pd.read_csv, np.load, open, etc. Replace data.csv → dependent cells recompute automatically.
  • Mutation-aware. df.append(...) and += are detected, so you don't get stale reads.
  • Survives kernel restarts. The cache lives on disk by default. Restart, run the cell, get the value back instantly.
  • Zero-config. %cash_on and you're done. No decorators, no config file.

Cash saves time on re-runs — restoring an unchanged result instead of recomputing it, not speeding the first execution up. The more a statement costs to compute relative to the size of its result, the more a restore saves; %cash_stats reports your actual numbers, and says so plainly when caching cost you time. See the benchmarks for how that plays out on real workloads.


Install

pip install cash-lib

Optional extras: pip install "cash-lib[all]" (pandas, polars, redis, s3, …). See installation.

Quick start

In a notebook

Cell 1 — turn it on:

import cash
%cash_on

Cell 2 — your normal code:

import pandas as pd
df = pd.read_csv("large_dataset.csv")   # tracked: file change → recompute
summary = df.describe()

Re-run the notebook:

  • ✅ Nothing changed → restored from cache instantly.
  • 🔄 large_dataset.csv changed → the cells that read it recompute.
  • ⚡ Only the analysis changed → the load stays cached, only the analysis recomputes.

Cash shows a badge above each cell summarizing what it did — see Reading the Cash badge.

In a script

@cash.cache caches any Python function across processes, with the same dependency- and file-awareness. Impure functions (LLM calls, HTTP, file writes) are flagged by default, since their side effects only run on the first call.

import cash

@cash.cache
def expensive(x):
    return x ** 2 + sum(range(x))

Full walkthrough in the decorator guide.


Learn more

Status

Beta. The public API is stabilizing, but this is a 0.x release — the cache format may still change between minor versions, so run %cash_repair --full after upgrading (see versioning & compatibility). The known limitations are documented honestly.

Bug reports welcome: the badge has a "Report a bug" button, %cash_feedback prints how, or open an issue.

Contributing

See CONTRIBUTING.md. Good first issues are tagged on the tracker.

License

MIT — see LICENSE.

Metadata

Release files for cash-lib 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cash-lib 0.4.0
File Size Uploaded
cash_lib-0.4.0.tar.gz 735.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cash-lib 0.4.0
File Interpreter ABI Platform
cash_lib-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / cash_lib-0.4.0.tar.gz

Download URL cash_lib-0.4.0.tar.gz
Size 735.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6e56fe81e5728cade8742745204a6435a82d34395cbe47efb28a4638fcb62450
BLAKE2b-256 checksum
How to use checksums
5f5a9f82ff82d0fa0ceb4cfa1273064fe757ff492694407a2cee41a98e673c32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release files / cash_lib-0.4.0-py3-none-any.whl

Download URL cash_lib-0.4.0-py3-none-any.whl
Size 801.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20843b14e2d2d2a3aa562a75469f99ee8bd31437be0f3182cfe43f225ad449bb
BLAKE2b-256 checksum
How to use checksums
e663bb19fca2b520f287e2f884d72432f921939b41c9d0310836e37f8e94cee2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release history Release notifications | RSS feed

0.12.0

2 release files

0.11.0

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page