A Python script that zips a codebase's source files while intelligently skipping everything that doesn't belong; build artifacts, dependency folders, secrets, compiled outputs, and more.
No third-party dependencies. Pure Python stdlib.
Interactive mode - the script will prompt you for everything:
python zip_source.pyCLI mode - pass arguments directly:
python zip_source.py --path ./my-project --dest ~/Desktop
python zip_source.py --path ./my-project --dest ~/Desktop/my-project.zip
python zip_source.py --path ./my-project --dest ~/Desktop --verboseIf no destination is provided, the zip is placed in the parent directory of the source folder.
| Category | Examples |
|---|---|
| Dependency dirs | node_modules, .venv, vendor, site-packages |
| Build outputs | dist, build, out, .next, .nuxt, target |
| Caches | __pycache__, .cache, .turbo, .parcel-cache |
| IDE & VCS | .git, .idea, .vscode, .svn |
| Compiled files | .pyc, .class, .o, .dll, .exe, .wasm |
| Secrets | .env, .env.local, .env.production, etc. |
| Lock files | package-lock.json, poetry.lock, yarn.lock, etc. |
| OS junk | .DS_Store, Thumbs.db, desktop.ini |
| Large files | Any single file over 50 MB (configurable) |
| Flag | Default | Description |
|---|---|---|
--path, -p |
prompted | Path to the codebase directory |
--dest, -d |
parent dir | Output path or directory for the zip |
--verbose, -v |
off | Auto-show all excluded items without prompting |
--max-file-mb |
50 |
Per-file size cap in MB |
By default, images, video, and audio are excluded. To include them (e.g. for projects with a public/ assets folder), open the script and set:
INCLUDE_MEDIA: bool = TrueWhen enabled, media files bypass the size cap and are always included regardless of size.
- No overwrite - if the output zip already exists, a counter suffix is appended (
_1,_2, …) - No self-zip - aborts if the destination is inside the source directory
- Interrupted zips cleaned up -
Ctrl+Cremoves any partial file automatically - Secrets protected -
.env*files are always excluded, even if media or other flags are enabled