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.1.1 is the first public 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.1.1

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.1.1
File Size Uploaded
cash_lib-0.1.1.tar.gz 583.7 kB Details

Built distribution (wheel)

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

Total release size: 1.2 MB

Release files / cash_lib-0.1.1.tar.gz

Download URL cash_lib-0.1.1.tar.gz
Size 583.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8e50a5f801ca6cab39e195428162245dd991e908a4485e16820f397bd45e717b
BLAKE2b-256 checksum
How to use checksums
fafa863f7fc408ad52bbf3442b1b600318283fad186502fec29b6d6d00c0c5d9
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 24, 2026.

Transparency log

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

Download URL cash_lib-0.1.1-py3-none-any.whl
Size 645.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddb471f877517b0b413269f630035f56abc15bba4407fb582b44c66f2b3ec063
BLAKE2b-256 checksum
How to use checksums
907fb032fb77091f57f244f5f55ab3e54fadb8154151cdcbeb09ddf4a31ce452
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 24, 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

0.2.0

2 release files

This release

0.1.1 This release

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