Create clean ZIP archives that respect .zipignore patterns (gitignore-style).
Project description
SmartZip
Create clean ZIP archives that respect
.zipignorepatterns (gitignore-style).
The Problem
Standard zip tools have no concept of project-specific exclusions. Every time you archive a project you manually exclude node_modules/, build artifacts, .env secrets, and log files — or you accidentally include them.
The Solution
SmartZip reads a .zipignore file from your project (same syntax as .gitignore) and automatically excludes matching files when creating the ZIP archive.
smartzip ./my-project
# → Creates my-project.zip with clean, intentional contents
Installation
Recommended: pipx (isolated global install)
pipx install smartzip
pip
pip install smartzip
From source (contributors)
git clone https://github.com/your-org/smartzip.git
cd smartzip
poetry install
Quick Start
1. Create a .zipignore file in your project:
# .zipignore
node_modules/
dist/
build/
*.log
.env
.env.local
**/__pycache__/
**/*.pyc
2. Run SmartZip:
smartzip ./my-project
Output:
─────────────── SMARTZIP REPORT ───────────────
Excluded:
✗ node_modules/lodash/lodash.js
✗ .env
✗ error.log
Included:
✓ src/app.py
✓ src/utils.py
✓ README.md
Statistics:
Included Files 3
Excluded Files 312
Archive Size 4.2 MB
Archive Path /home/user/my-project.zip
──────────── ✓ Archive created: my-project.zip ────────────
CLI Reference
Basic Usage
smartzip <FOLDER> [OPTIONS]
Options
| Flag | Short | Description |
|---|---|---|
--output PATH |
-o |
Custom output ZIP path (default: {folder}.zip in CWD) |
--dry-run |
Preview inclusions/exclusions without creating an archive | |
--verbose |
-v |
Print each file's include/exclude decision in real time |
--force |
-f |
Overwrite the output file if it already exists |
--version |
Print version and exit | |
--help |
Show help and exit |
Examples
# Archive ./project → creates ./project.zip
smartzip ./project
# Custom output path
smartzip ./project -o release-v1.0.zip
# Dry run — preview only, no archive created
smartzip ./project --dry-run
# Verbose — see every include/exclude decision
smartzip ./project --verbose
# Overwrite existing archive
smartzip ./project --force
# Combine flags
smartzip ./project -o dist/release.zip --verbose --force
.zipignore Reference
.zipignore uses the same syntax as .gitignore (powered by pathspec).
Pattern Syntax
| Pattern | Description | Example Match |
|---|---|---|
node_modules/ |
Directory and all contents | node_modules/lodash/index.js |
*.log |
Wildcard by extension | error.log, logs/access.log |
.env |
Exact filename | .env, config/.env |
temp/* |
Single-level glob | temp/cache.db (not temp/sub/file) |
**/*.pyc |
Recursive wildcard | a/b/c/module.pyc |
!important.log |
Negation — re-include | important.log (if previously matched) |
# comment |
Comment line | (ignored) |
Example .zipignore
# Dependencies
node_modules/
vendor/
# Build artifacts
dist/
build/
*.egg-info/
# Environment & secrets
.env
.env.*
!.env.example
# Logs
*.log
logs/
# Python cache
**/__pycache__/
**/*.pyc
**/*.pyo
# Temporary files
*.tmp
*.temp
temp/
.cache/
# IDE
.idea/
.vscode/
*.swp
# OS
.DS_Store
Thumbs.db
# Test artifacts
.pytest_cache/
htmlcov/
.coverage
Always Excluded
The following are always excluded regardless of .zipignore contents:
.zipignoreitself (tooling artifact, not project content)
Exit Codes
SmartZip follows standard UNIX exit code conventions for use in CI/CD pipelines:
| Code | Meaning |
|---|---|
0 |
Success — archive created (or dry run completed) |
1 |
User error — bad path, output exists, all files excluded |
2 |
Internal error — unexpected failure |
Python API
SmartZip can also be used as a Python library:
from pathlib import Path
from smartzip import run, ArchiveRequest
request = ArchiveRequest(
target=Path("./my-project"),
output=Path("./my-project.zip"),
dry_run=False,
verbose=False,
force=False,
)
result = run(request)
print(f"Archived {result.file_count} files ({result.size_human})")
Platform Support
| Platform | Status |
|---|---|
| Linux | ✅ Fully supported |
| macOS | ✅ Fully supported |
| Windows | ✅ Fully supported |
ZIP archives created on any platform use POSIX / path separators internally, ensuring consistent extraction on all systems.
Contributing
See docs/contributing.md for guidelines.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zipignore-0.1.0.tar.gz.
File metadata
- Download URL: zipignore-0.1.0.tar.gz
- Upload date:
- Size: 38.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25a422287e97311601f01d3b4733348ed1ebae3279b662a0313a13cbff7d9453
|
|
| MD5 |
910e19db0391de7a9f336a31014366e1
|
|
| BLAKE2b-256 |
8f6bd7cc19849827f26779ab5d21f9de8c3721cd5118be39aff197812aaca256
|
Provenance
The following attestation bundles were made for zipignore-0.1.0.tar.gz:
Publisher:
release.yml on TheSuraj01/SafeZip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zipignore-0.1.0.tar.gz -
Subject digest:
25a422287e97311601f01d3b4733348ed1ebae3279b662a0313a13cbff7d9453 - Sigstore transparency entry: 1701312733
- Sigstore integration time:
-
Permalink:
TheSuraj01/SafeZip@03a5ebf7ca624dabe1589a616b52c95d3acb8f82 -
Branch / Tag:
refs/tags/v1.0.4 - Owner: https://github.com/TheSuraj01
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@03a5ebf7ca624dabe1589a616b52c95d3acb8f82 -
Trigger Event:
push
-
Statement type:
File details
Details for the file zipignore-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zipignore-0.1.0-py3-none-any.whl
- Upload date:
- Size: 53.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b8455601304984b0ed9de5e725c03b0e6cc1a7a8fa94ec010852ab52940b929
|
|
| MD5 |
277d73af3095199c7b0af3b861662ef5
|
|
| BLAKE2b-256 |
5a163edf12125fb9595cfc8b36234374f86af3704350fe547020360735104a6a
|
Provenance
The following attestation bundles were made for zipignore-0.1.0-py3-none-any.whl:
Publisher:
release.yml on TheSuraj01/SafeZip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zipignore-0.1.0-py3-none-any.whl -
Subject digest:
2b8455601304984b0ed9de5e725c03b0e6cc1a7a8fa94ec010852ab52940b929 - Sigstore transparency entry: 1701312759
- Sigstore integration time:
-
Permalink:
TheSuraj01/SafeZip@03a5ebf7ca624dabe1589a616b52c95d3acb8f82 -
Branch / Tag:
refs/tags/v1.0.4 - Owner: https://github.com/TheSuraj01
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@03a5ebf7ca624dabe1589a616b52c95d3acb8f82 -
Trigger Event:
push
-
Statement type: