DeadWeight
Find the dead weight in your projects before it eats your disk.
DeadWeight is a small CLI for developers who collect virtual environments, node_modules, build folders, and caches across dozens of repositories. Point it at a directory, and it shows what is heavy, how stale each project looks, and how much space you can reclaim.
Features
- Scans a directory tree for heavy artifacts:
venv,.venv,node_modules,__pycache__,.pytest_cache,dist,build,.pio. - Detects custom virtual environments by their
pyvenv.cfgmarker, even when the folder is namedmy_envoratlas vpn env. - Reports Git state for every project with reported artifacts: clean, dirty (with a change count), no repository, or Git error.
- Shows the date of the last commit so you can spot abandoned projects.
- Rich, colorized report with per-project and total reclaimable space.
- Progress bar while scanning, written to
stderrso machine-readable output stays clean. --min-sizefilter to ignore the small stuff.--older-than DAYSfilter to focus on abandoned projects with stale Git history.--jsonoutput for dashboards, scripts, and cron jobs.--cleanis opt-in and always asks for explicit confirmation first.--clean --selectshows a numbered list and deletes only the artifacts you choose.- Read-only by default. Symlinks and Windows junctions are never followed.
Requirements
- Python 3.11 or newer
- Git (optional, but required for repository status)
- rich (installed automatically)
Installation
From PyPI:
pipx install deadweight-cli
The package is named deadweight-cli and installs the deadweight command.
From a source checkout:
git clone https://github.com/ASCTeam-prog/deadweight.git
cd deadweight
pipx install .
Or install it into the current environment in editable mode:
pip install -e .
The package exposes a single deadweight command:
deadweight --help
Binary Downloads
Prebuilt one-file binaries for every supported platform are attached to each GitHub Release:
| Platform | Download |
|---|---|
| Windows x64 | deadweight-windows-x64.exe |
| Linux x64 | deadweight-linux-x64 |
| macOS arm64 | deadweight-macos-arm64 |
On Linux and macOS, make the downloaded file executable with chmod +x <file> before running it. If macOS Gatekeeper blocks the unsigned binary, remove the quarantine flag with xattr -d com.apple.quarantine <file>.
Usage
deadweight [PATH] [--min-size MB] [--older-than DAYS] [--clean] [--select] [--json]
| Option | Description |
|---|---|
PATH |
Directory to scan. Defaults to the current directory. |
--min-size MB |
Only report heavy directories of at least this size (in MB). |
--older-than DAYS |
Only report projects whose last commit is older than this many days. |
--clean |
After the report, delete the found artifacts after confirmation. |
--select |
With --clean, show a numbered list and delete only the selected artifacts. |
--json |
Print the report as JSON instead of a table. |
--version |
Print the version and exit. |
Scan the current directory
deadweight
Scan a projects folder
deadweight ~/projects
Only look at artifacts larger than 100 MB
deadweight ~/projects --min-size 100
Only look at abandoned projects
deadweight ~/projects --older-than 180
This includes only projects whose last commit is older than 180 days. Projects without a Git repository, without commits, or with Git errors are excluded while the filter is active. The default value is 0, which disables the filter. It also applies to --json, --clean, and --select.
Export a machine-readable report
deadweight ~/projects --json > report.json
Clean up interactively
deadweight ~/projects --clean
--clean prints the report first, then asks once to confirm deletion of everything that was found:
Delete 14 directories and free 6.4 GB? [y/n] (n):
Nothing is deleted unless you answer y. Every target is re-checked before removal: it must still be a known artifact directory or a valid virtual environment, and it must live inside the scanned root.
Choose exactly what to clean
deadweight ~/projects --clean --select
--select adds a numbered list of every artifact with its project and size. Enter one or more numbers separated by commas, a range such as 3-5, a combination such as 1, 3-5, or all. An empty answer cancels the cleanup.
The final confirmation is still required, and only the selected directories are removed.
Sample output
DeadWeight v1.0.2
4 targets scanned in /home/dev/projects
┌───────────────┬───────────┬─────────────┬─────────────────────────────────────────────┬──────────┐
│ Project │ Git │ Last commit │ Heavy artifacts │ Size │
├───────────────┼───────────┼─────────────┼─────────────────────────────────────────────┼──────────┤
│ data-pipeline │ no git │ — │ .venv 3.1 GB │ 3.3 GB │
│ │ │ │ build 220.8 MB │ │
│ legacy-api │ dirty (3) │ 2024-11-02 │ .venv 1.2 GB │ 1.2 GB │
│ │ │ │ __pycache__ 12.4 MB │ │
│ web-dashboard │ clean │ 2026-05-18 │ node_modules 840.1 MB │ 885.8 MB │
│ │ │ │ dist 45.7 MB │ │
├───────────────┼───────────┼─────────────┼─────────────────────────────────────────────┼──────────┤
│ TOTAL │ │ │ 6 dirs · 3 projects │ 5.4 GB │
└───────────────┴───────────┴─────────────┴─────────────────────────────────────────────┴──────────┘
Total junk: 5.4 GB
Can free: 5.39 GB
How projects are detected
- If the scanned directory is a Git repository, it is treated as one project. Artifacts are searched recursively, but
.git, symlinks, and junctions are skipped. - Otherwise, every first-level subdirectory is treated as a separate project.
- Any directory containing a
pyvenv.cfgfile is treated as a virtual environment, even if its name is notvenvor.venv(for example,my_envoratlas vpn env). - Artifacts found directly in the scanned root, including custom environments, are reported under the root folder's own name instead of being treated as projects.
- Found artifact directories are never traversed further, so nested caches are counted once and their parent's size wins.
- Projects with no artifacts above the size threshold are omitted from the report.
JSON output
{
"tool": "deadweight",
"version": "1.0.2",
"scanned_path": "/home/dev/projects",
"scanned_projects": 4,
"generated_at": "2026-12-05T12:00:00+00:00",
"min_size_mb": 0.0,
"older_than_days": 0,
"projects": [
{
"name": "legacy-api",
"path": "/home/dev/projects/legacy-api",
"git": {
"status": "dirty",
"changed_files": 3,
"last_commit": "2024-11-02T09:14:00+00:00",
"error": null
},
"heavy_dirs": [
{
"path": "/home/dev/projects/legacy-api/.venv",
"name": ".venv",
"size_bytes": 1288490188,
"size": "1.2 GB"
}
],
"total_size_bytes": 1288490188,
"total_size": "1.2 GB"
}
],
"totals": {
"projects": 1,
"heavy_dirs": 1,
"total_size_bytes": 1288490188,
"total_size": "1.2 GB",
"reclaimable_gb": 1.2
}
}
The totals.reclaimable_gb field makes it easy to feed the result into dashboards or alerting.
Safety
- DeadWeight is read-only by default.
- Deletion requires both
--cleanand ayanswer to the confirmation prompt. --selectis only accepted together with--clean, and the final confirmation is still mandatory.--cleanand--jsoncannot be combined, so a prompt can never corrupt JSON output.- Only known artifact directory names or directories containing a valid
pyvenv.cfgmarker are eligible for deletion. - Symlinks, junctions, unreadable directories, and locked files do not crash the scan; they are skipped or reported.
- The last line of defense: every deletion target is verified to be inside the scanned root.
Development
git clone https://github.com/ASCTeam-prog/deadweight.git
cd deadweight
pip install -e .
python deadweight.py --help
python deadweight.py . --min-size 10
python -m unittest discover -s tests -v
The test suite creates disposable projects in a temporary directory, including custom-named virtual environments, and exercises selective cleanup. Run a manual scan against a scratch directory before trying --clean on real projects.
License
MIT
Metadata
Release files for deadweight-cli 1.0.2
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 |
|---|---|---|---|---|
| deadweight_cli-1.0.2.tar.gz | 19.2 kB | With provenance | Details for deadweight_cli-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| deadweight_cli-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for deadweight_cli-1.0.2-py3-none-any.whl |
Total release size: 32.8 kB
Release files / deadweight_cli-1.0.2.tar.gz
| Download URL | deadweight_cli-1.0.2.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d7aa6cfecd32063b4e0876f5f526c8933ba4d97d68f024d68ce3e891900b934
|
|
BLAKE2b-256 checksum How to use checksums |
eb40261971a47b5b8f11b4685dca5caa8a62318cb5d7dd7009c36cb26b3cbe47
|
| 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 Dec 5, 2026.
Transparency logRelease files / deadweight_cli-1.0.2-py3-none-any.whl
| Download URL | deadweight_cli-1.0.2-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c8fc29ffefbd39dc5d69d1605e99f69f63ef152a71b861b031daf8516eb238f
|
|
BLAKE2b-256 checksum How to use checksums |
da337fcc1aed77ba80f87a5673f0167fdaf4e3b507da145c28779252ae07474b
|
| 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 Dec 5, 2026.
Transparency logSecurity for deadweight-cli 1.0.2
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 deadweight_cli-1.0.2.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 Dec 5, 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.