Skip to content

Jusuf-Rrustaj/zip_source

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

zip_source

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.


Usage

Interactive mode - the script will prompt you for everything:

python zip_source.py

CLI 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 --verbose

If no destination is provided, the zip is placed in the parent directory of the source folder.


What gets excluded

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)

Options

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

Media files

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 = True

When enabled, media files bypass the size cap and are always included regardless of size.


Safety features

  • 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+C removes any partial file automatically
  • Secrets protected - .env* files are always excluded, even if media or other flags are enabled

About

Creates a zip archive of a source code directory while excluding common non-source files and folders such as dependencies, build outputs, caches, compiled files, secrets (.env*), lock files, OS junk, and large files. Supports both interactive prompts and CLI arguments, using only the Python standard library.

Resources

Stars

Watchers

Forks

Contributors

Languages