Skip to main content

Create clean, client-safe, reproducible project snapshots from your codebase.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snapclean-0.2.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snapclean-0.2.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file snapclean-0.2.0.tar.gz.

File metadata

  • Download URL: snapclean-0.2.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for snapclean-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ce201e487d3d8fcc6607a7fa836d28fcf4bbfad96a63943116fb95f61e3d16fd
MD5 41fdfaa65f71f50d1e2ac82da7f57427
BLAKE2b-256 dadb93865f4050d62aaf6bb6dbe8cb69f7ed620e1603ecadc98cc771c1582681

See more details on using hashes here.

File details

Details for the file snapclean-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: snapclean-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for snapclean-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 359477697b6162d77f22dc2e0561a65fa9e3aa6bcff59048be94dd61fc77ea96
MD5 f1cd33d465f72dd79fde4fc7be712fd6
BLAKE2b-256 d0474d224972b94ec06cd062f624e3f04b5b79ea5c9e12ca4dcbe95443ce42a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page