Cash — stop re-running work that hasn't changed
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:
Two ways to use cash
Pick the path that matches how you write code — both ride the same engine:
- In a notebook — add
%cash_onand 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.cacheand 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 readconfig(transitively) re-run. - File-aware. Cash intercepts
pd.read_csv,np.load,open, etc. Replacedata.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_onand 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.csvchanged → 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
- Documentation home · Why Cash? · Quick start
- Reading the badge · Magic commands · Annotations
- The decorator · Backends · Command-line interface
- Known limitations · Benchmarks · Versioning & compatibility
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)
| File | Size | Uploaded | |
|---|---|---|---|
| cash_lib-0.4.0.tar.gz | 735.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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 logRelease 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