Skip to main content

Snapclean

A Python CLI for creating clean, client-safe project snapshots.

Python 3.8+ License: MIT

Snapclean strips development clutter from your project, respects .gitignore, generates a safe .env.example, and produces a clean zip archive ready for sharing with clients or collaborators — all in a single command.


Table of Contents


Features

  • Removes development clutter — .git, node_modules, venv, __pycache__, and more
  • Respects .gitignore — automatically excludes patterns from your ignore file
  • Safe .env handling — excludes secrets and generates a clean .env.example template
  • Size summary — shows original vs. snapshot size and reduction percentage
  • Dry-run mode — preview what would be removed without touching anything
  • Project configuration — persist your preferred options in .snapclean.toml
  • Clean CLI output — readable, minimal terminal output

Installation

From PyPI (recommended):

pip install snapclean

From source:

git clone https://github.com/yourusername/snapclean.git
cd snapclean
pip install -e .

Requirements: Python 3.8+


Quick Start

# Navigate to your project and create a snapshot
cd my-project
snap

That's it. A timestamped zip archive is saved to dist/ by default.


Usage

# Basic snapshot
snap

# Preview what would be removed (no files created)
snap --dry-run

# # Run a build step before snapshotting
# snap --build

# Save the snapshot to a custom directory
snap --output ./release

# Snapshot a different project directory
snap --path ./path/to/project

# Check the installed version
snap version

CLI Reference

Option Default Description
--path TEXT . (current directory) Path to the project to snapshot
--output TEXT dist Directory where the zip archive will be saved

| --dry-run / --no-dry-run | false | Preview removals without creating any files | | --help | — | Show help and exit |


Configuration

To avoid typing options every time, create a .snapclean.toml file in your project root:

output = "release"

With this in place, running snap (no arguments) will use your saved preferences.

Supported config keys:

Key Type Description

| output | string | Output directory for the zip archive |


What Gets Removed

The following are always excluded from the snapshot:

Path / Pattern Reason
.git/ Version control history
node_modules/ Reinstallable JS dependencies
venv/, .venv/ Reinstallable Python environments
__pycache__/ Python bytecode cache
.env Contains secrets — replaced by .env.example
All .gitignore patterns Project-specific ignores

If a .env file is found, Snapclean generates a .env.example with all keys present but values redacted, so recipients know which variables to configure.


Example Output

Removed items:
  - .git/
  - node_modules/
  - venv/
  - .env  →  .env.example generated

Snapshot created: dist/snapshot_20260225_153013.zip

Snapshot Summary
----------------
Original size:  24.2 MB
Snapshot size:  10.4 KB
Reduced by:     99.96%

How It Works

  1. Copies your project to a temporary directory
  2. Removes development files and anything matched by .gitignore
  3. Replaces .env with a generated .env.example
  4. Creates a timestamped zip archive in the output directory
  5. Prints a size reduction summary

Contributing

Contributions are welcome! Here's how to get started:

# Clone the repo
git clone https://github.com/nijil71/SnapClean.git  
cd snapclean

# Create a virtual environment and install dev dependencies
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

License

MIT License — see LICENSE for full details.

Metadata

Release files for snapclean 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 snapclean 0.2.0
File Size Uploaded Provenance Actions
snapclean-0.2.0.tar.gz 6.3 kB Without provenance Details for snapclean-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 13.2 kB

Release files / snapclean-0.2.0.tar.gz

Download URL snapclean-0.2.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ce201e487d3d8fcc6607a7fa836d28fcf4bbfad96a63943116fb95f61e3d16fd
BLAKE2b-256 checksum
How to use checksums
dadb93865f4050d62aaf6bb6dbe8cb69f7ed620e1603ecadc98cc771c1582681
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

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

Download URL snapclean-0.2.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
359477697b6162d77f22dc2e0561a65fa9e3aa6bcff59048be94dd61fc77ea96
BLAKE2b-256 checksum
How to use checksums
d0474d224972b94ec06cd062f624e3f04b5b79ea5c9e12ca4dcbe95443ce42a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Security for snapclean 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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 No 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