Skip to main content

Cash — stop re-running notebooks that haven'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.

📺 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 →


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

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.

Beyond notebooks

@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. 0.2.0 is the current release. 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.2.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.2.0
File Size Uploaded
cash_lib-0.2.0.tar.gz 604.6 kB Details

Built distribution (wheel)

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

Total release size: 1.3 MB

Release files / cash_lib-0.2.0.tar.gz

Download URL cash_lib-0.2.0.tar.gz
Size 604.6 kB
Tags Source
SHA-256 checksum
How to use checksums
28bb7c85eb656359aa1c7b1cbf277afe6bd17c59c414eb9fcc6101b0fa99e04f
BLAKE2b-256 checksum
How to use checksums
57f1da18661dadb70a2ea2b8fb06b886afd7a3297735a6a415dbca1921cf7934
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 29, 2026.

Transparency log

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

Download URL cash_lib-0.2.0-py3-none-any.whl
Size 667.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac100ff508f4e9c7cecea17095923f49fb570f2f42f70b15cc2c7c412e4795fb
BLAKE2b-256 checksum
How to use checksums
0497fdd0d5823545a6b1b657f8853c6906ef970108e52085be1c329bd2ed0d66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 29, 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

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

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