Skip to main content

Sweepito

CI Release PyPI Python 3.11+ License Ruff pre-commit

Safely clean generated project artifacts (caches, build output, test reports and tool leftovers) across languages, frameworks, game engines, data and infrastructure tooling.

Sweepito is a command-line tool: you install it and run sweepito. It is not a Python library and has no Python API to import.

Why Sweepito?

Every ecosystem leaves its own clutter behind: __pycache__/, .next/, Cargo target/, Gradle build/, .terraform/, .ipynb_checkpoints/, and many more. Cleaning them by hand means remembering each tool's quirks, and the usual shortcuts are risky: rm -rf build happily deletes a committed build/ folder, and git clean -fdx removes everything untracked, including your .env.

Sweepito is one tool for all of it, built around a simple rule: it only removes paths that Git already ignores and does not track, and only when the project's own marker files prove what the folder is. A build/ directory is a candidate beside a CMakeLists.txt or pom.xml, never because of its name alone.

What you get

  • 29 technology profiles and 142 rules, detected automatically from marker files (Cargo.toml, pom.xml, package.json, ...). Repositories with several technologies and nested projects are handled per project.
  • Conservative by default. Only safe caches are cleaned. Build output is opt-in, and dependency directories such as node_modules/ need an explicit flag as well.
  • Previews you can trust. scan shows exactly what clean would remove, with sizes and the reclaimable total.
  • One config format for every language, with custom cleanup rules and profiles.
  • Git hooks: post-commit cleanup through the pre-commit framework or a native hook, silent when there is nothing to do.
  • Machine-readable output (--json) and meaningful exit codes for automation.
  • Small and cross-platform: it runs on Linux, macOS and Windows, and works on any project in any language as long as the project is a Git repository.

Safety model

Guarantee How
Tracked files are never deleted Candidates come from Git's own ignore list, and tracked paths are re-checked right before deleting
Nothing outside the project Paths are resolved and confined to the project root; absolute paths and .. are rejected
Links are not followed Symlinks and Windows junctions are removed as links, never traversed
.git/ is untouched It is never a candidate
A name alone is not enough A rule needs its marker file, and generic names are anchored beside it
Risky rules are opt-in high-impact rules (dependencies, environments) never run unless you ask: --enable RULE or --risk high-impact
Not a Git repo? Refuse Override only with --no-git-check, which counts as high impact
Failures are reported Locked or protected files are listed and the run exits with code 1; nothing is forced

Built-in rules never target application data, infrastructure state (*.tfstate), secrets (.env*) or IDE settings.

Install

Requires Python 3.11 or later and Git. Because Sweepito is a program rather than a library, pipx and uv are the best fit: they keep it out of your project environments, and your project does not need to be a Python project.

pipx install sweepito          # or: uv tool install sweepito
uvx sweepito scan              # run once without installing

Check the install with sweepito --version, and your setup with sweepito doctor.

No Python? Download a native installer from the releases: a setup.exe for Windows, and a .deb or .rpm for Linux. See Packaging.

Quick start

sweepito scan                              # what would be removed (safe rules only)
sweepito scan --risk configurable          # include build output
sweepito clean                             # remove, asking first
sweepito clean --enable rust.target --yes  # also remove Cargo target/, no prompt
sweepito rules                             # list every rule and its risk
sweepito init                              # write a starter sweepito.toml

Example:

$ sweepito scan --risk configurable
Project: /home/dev/myapp   profiles: common, node, python, rust
                    Cleanup candidates
┌────────────────┬──────────────────┬──────────┬──────────────┐
│ Rule           │ Path             │     Size │ Risk         │
├────────────────┼──────────────────┼──────────┼──────────────┤
│ python.pytest  │ .pytest_cache/   │   3.2 KB │ safe         │
│ python.pycache │ src/__pycache__/ │  87.8 KB │ safe         │
│ node.next      │ web/.next/       │ 210.0 MB │ configurable │
│ rust.target    │ engine/target/   │   1.8 GB │ configurable │
└────────────────┴──────────────────┴──────────┴──────────────┘
4 candidate(s), 2.0 GB reclaimable.
Nothing deleted. Run 'sweepito clean' to remove them.

Output is rendered with Rich (tables, panels, colour). Add --json for plain machine-readable output, or --no-color to turn colour off.

Profiles

Sweepito covers web and Node.js tooling, Python, JVM languages, .NET, Go, Rust, C and C++, PHP, Ruby, Dart and Flutter, Swift, Elixir, R and Jupyter, Terraform, Docker, data engineering, game engines (Unity, Unreal, Godot), and OS and editor junk that is always cleaned. Every profile, with its markers, targets and risk levels, is listed in docs/profiles.md.

Risk levels

Level Behaviour
safe On by default: well-identified caches that regenerate automatically
configurable Opt-in: build output and other things that are slow to rebuild or mildly valuable
high-impact Opt-in with --enable RULE or --risk high-impact: dependencies, environments, experiment data
custom Rules you write yourself: always on, since you chose them. --risk custom runs only these

Use

Selection options work the same for scan, clean, check and report:

sweepito clean -p python -p node                       # only these profiles
sweepito clean --risk configurable -x dist/            # build output, but keep dist/
sweepito clean --enable node.modules
sweepito clean --disable python.hypothesis
sweepito scan --json | jq '.total_bytes'               # for scripts
sweepito check --quiet                                 # exit 1 if anything is left

Configuration

Create sweepito.toml (or a [tool.sweepito] table in pyproject.toml). The format is the same for every language, so non-Python projects need no pyproject.toml.

[defaults]
profiles = ["auto"]            # or ["python", "node"]
risk = "safe"                  # custom | safe | configurable | high-impact

[clean]
enable  = ["rust.target", "node.next"]
disable = ["python.hypothesis"]
exclude = ["dist/", "build/keep-me/"]   # gitignore syntax; always wins

[hook]                         # applies to hook runs only
quiet = true

[[rule]]                       # custom cleanup
id = "custom.test-output"
paths = ["test-results/", "tmp/e2e/**"]

Rules you write yourself always run and are shown as custom, so there is no risk level to choose. Precedence is command line, then config file, then profile defaults, then built-in defaults. Custom rules follow the same safety gates, so a target must still be inside the project, untracked and git-ignored (or opt out of the ignore check per rule with allow_untracked = true, which never applies to tracked files). Details are in docs/guides/configuration.md.

Command line

Command Purpose
scan List cleanup candidates with sizes (never deletes)
clean Delete candidates (-n dry run, -y skip the prompt, --non-interactive for automation)
check Like scan, but exits 1 if candidates exist
report Reclaimable space by profile, rule and risk
profiles List the supported technologies and what detects them (--explain NAME for one)
rules List every cleanup rule and its risk (--explain RULE for one)
config show / validate Show the effective settings or validate the file
init Write a starter sweepito.toml
hook install / uninstall / status Manage the native Git hook (--stage post-commit or pre-commit)
doctor Check Git, the project, the config and hooks (changes nothing)

Run sweepito <command> --help for every option, or read the command line guide, which also covers file patterns, JSON output, recipes and troubleshooting.

Git hook setup

With the pre-commit framework, add to .pre-commit-config.yaml:

repos:
  - repo: https://github.com/coldsofttech/Sweepito
    rev: v0.2.0
    hooks:
      - id: sweepito-clean     # post-commit cleanup
      # - id: sweepito-scan    # report-only at pre-commit
pre-commit install --hook-type post-commit

Without the framework, run sweepito hook install (add --stage pre-commit for the report-only variant). It writes .git/hooks/post-commit, appends to an existing hook instead of replacing it, and sweepito hook uninstall removes only its own block.

Hooks read the same sweepito.toml and honour the [hook] section. A post-commit hook cannot fail a commit; if cleanup fails, it prints a message to stderr.

Output, logs and exit codes

Sweepito does not write log files. Results go to standard output and problems to standard error, so you can redirect them yourself.

  • --json prints one JSON document with the candidates, skipped paths (and why), removed and failed items, and freed bytes.
  • -v explains why paths were skipped, and -q prints nothing unless something needs attention. Hook runs are quiet when there is nothing to clean.
  • sweepito doctor shows the environment, the config in use and installed hooks.
Code Meaning
0 Success, including "nothing to clean"
1 Some items failed or were skipped (for check: candidates exist)
2 Usage or configuration error
3 Unexpected error
4 Safety refusal (not a Git repo, high-impact without the flag, no consent)
130 Interrupted

Documentation

CLI · Configuration · Profiles and rules · Packaging · Architecture · Development · Changelog

See docs/README.md for an overview, and SUPPORT.md if you need help.

Contributing

Contributions are welcome, especially new technologies and rules. Please read CONTRIBUTING.md first; every change keeps the safety invariants and comes with tests. To work on the code, see docs/development.md. Everyone taking part is expected to follow the Code of Conduct.

Security

Because Sweepito deletes files, a bug that removes tracked files, anything outside the project or follows a symlink is a security issue. Please report it privately as described in SECURITY.md and do not open a public issue.

License

MIT

Metadata

Release files for sweepito 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 sweepito 0.2.0
File Size Uploaded Provenance Actions
sweepito-0.2.0.tar.gz 263.9 kB With provenance Details for sweepito-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 314.9 kB

Release files / sweepito-0.2.0.tar.gz

Download URL sweepito-0.2.0.tar.gz
Size 263.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f00ab62955f4115d7d720d3dc4259d1e40fe05d718c7c797b3b6d24ea3303fc4
BLAKE2b-256 checksum
How to use checksums
dc14f344900528310ac61171cfd04fa0283b7158420a176e81e12f291e552d64
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 15, 2026.

Transparency log

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

Download URL sweepito-0.2.0-py3-none-any.whl
Size 51.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f76b6cb183235c8a3d5c8c4cc31d50bfc07b578544596daba44c441012806c9
BLAKE2b-256 checksum
How to use checksums
49d2a736b1332cd950e66d17cd210b0806ff81de3f2882d8d2fadb34370d4c39
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 15, 2026.

Transparency log

Security for sweepito 0.2.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.

Select from 2 files

Attestation for sweepito-0.2.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 15, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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