depclean
Get disk space back from projects you aren't working on. depclean scans a folder of code, finds the dependency and cache folders that a reinstall brings back (node_modules, Python virtualenvs, Rust target, build caches, …), shows how much space each project would free, and lets you pick what to remove in a keyboard-driven terminal UI.
depclean ~/code ? help
14 projects · 9.8 GB reclaimable · 3 selected (4.1 GB) ⠼ sizing 2 folders
PROJECT FOLDERS SIZE ↓ MODIFIED
▸ [x] old-dashboard node_modules, .next 2.3 GB 1.4y
▾ [-] ml-experiments .venv, __pycache__ ×12 1.9 GB 8mo
[x] .venv python venv 1.8 GB
[ ] src/__pycache__ python cache 2.1 MB
▸ [ ] side-project node_modules ×3 1.2 GB 12d
▸ [ ] rust-cli target 780 MB 3mo
↑↓ move space select a all enter expand s sort:size / filter d delete q quit
- Safe by design: it only matches a folder when a marker proves what it is (for example,
targetonly next to aCargo.toml, and a virtualenv only if it containspyvenv.cfg). It never follows symlinks, never touches.git, and checks each folder again right before deleting it. - Fast: it shows results right away and measures sizes in the background, updating them live.
- Honest sizes: it reports real disk usage. Files hard-linked elsewhere (such as pnpm's store) are left out of "reclaimable", because deleting them frees nothing.
- Finds stale projects: the MODIFIED column shows when you last touched a project's own files, ignoring dependency folders. Sort by age to see the forgotten ones first.
- No dependencies: it uses only the Python standard library (Python ≥ 3.9).
Install
With uv:
uv tool install git+https://github.com/magnumnighthawk/depclean
or with pipx:
pipx install git+https://github.com/magnumnighthawk/depclean
Or try it without installing:
uvx --from git+https://github.com/magnumnighthawk/depclean depclean ~/code
It's tested on macOS and Linux. On Windows it should work through windows-curses, which is installed automatically, but that hasn't been tested.
Usage
depclean # scan the current folder
depclean ~/code # scan a specific folder
depclean --list ~/code # just print a report, never deletes
depclean --json ~/code # machine-readable report
| Option | |
|---|---|
-l, --list |
Print a report and exit. Never deletes. |
--json |
Report as JSON (implies --list). |
--no-size |
Skip size measurement. |
-d, --depth N |
How many folder levels to search (default 6). |
-x, --exclude GLOB |
Skip matching paths or folder names. Repeatable, e.g. -x '*/keep-me' -x .tox. |
--force-root |
Allow interactive mode on / or your home folder (refused by default). |
Keys
| Key | Action |
|---|---|
↑ ↓ / j k, PgUp PgDn, g G |
Move |
space |
Select a project (all its folders) or a single folder |
a |
Select / clear everything shown |
enter / → |
Expand a project to pick individual folders |
← |
Collapse |
s |
Sort by size, age (oldest first) or name |
/ |
Filter by path or folder name |
d |
Delete the selection (asks for confirmation first) |
? |
Help |
q / esc |
Quit |
Deleting is permanent (not to the Trash), because a Trash full of node_modules frees no space. After deleting, depclean shows how much was freed and lists anything it couldn't remove.
What it removes
| Kind | Folders | Only when | Get it back with |
|---|---|---|---|
| node | node_modules |
always | npm / pnpm / yarn / bun install |
| python venv | any name (.venv, venv, env, …) |
the folder contains pyvenv.cfg |
recreate the venv, then pip/uv/poetry install |
| python cache | __pycache__, .pytest_cache, .mypy_cache, .ruff_cache, .tox, .nox |
always | recreated automatically |
| build cache | .next, .nuxt, .turbo, .parcel-cache, .svelte-kit, .angular |
always | next build / dev run |
| rust | target |
next to Cargo.toml |
cargo build |
| cocoapods | Pods |
next to Podfile |
pod install |
| gradle | build, .gradle |
next to build.gradle(.kts) / settings.gradle(.kts) |
gradle build |
It deliberately does not remove dist, vendor, build without Gradle, or target without Cargo, because those often hold things you can't regenerate.
Results are grouped by project: the nearest enclosing git repository, otherwise the nearest folder with a manifest (package.json, pyproject.toml, Cargo.toml, …).
Development
git clone https://github.com/magnumnighthawk/depclean && cd depclean
uv run pytest
uv run ruff check
uv run depclean --list ~/code
Releasing to PyPI
.github/workflows/release.yml publishes to PyPI with trusted publishing whenever a v* tag is pushed. One-time setup: on PyPI, add a pending publisher for project depclean, repository magnumnighthawk/depclean, workflow release.yml, environment pypi. Then:
git tag v0.1.0 && git push --tags
License
MIT
Metadata
Release files for depclean 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| depclean-0.1.0.tar.gz | 35.0 kB | With provenance | Details for depclean-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| depclean-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for depclean-0.1.0-py3-none-any.whl |
Total release size: 56.7 kB
Release files / depclean-0.1.0.tar.gz
| Download URL | depclean-0.1.0.tar.gz |
|---|---|
| Size | 35.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
359cb34ac2fcfd710ed22784991de0fffb2e34c00abbff05c9d7aae25d2a449c
|
|
BLAKE2b-256 checksum How to use checksums |
5291884f6b7020561397f105a9f3a3800d338eb13db6cabf97762f8ac8a0c75a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 11, 2026.
Transparency logRelease files / depclean-0.1.0-py3-none-any.whl
| Download URL | depclean-0.1.0-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d85d981d97b05ca9fd52895428f68c7bc6f4769b48c2ba22581577561aee79c
|
|
BLAKE2b-256 checksum How to use checksums |
75a2119ed65cd040d0d51eac612e75037d91654fe17c3dff085ec7d44b7b37c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 11, 2026.
Transparency logSecurity for depclean 0.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for depclean-0.1.0.tar.gz
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 Nov 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.