ZipIgnore
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
ZipIgnore reads a .zipignore file from your project (same syntax as .gitignore) and automatically excludes matching files when creating the ZIP archive.
zipignore ./my-project
# → Creates my-project.zip with clean, intentional contents
Installation
Recommended: pipx (isolated global install)
pipx install ZipIgnore
pip
pip install ZipIgnore
From source (contributors)
git clone https://github.com/TheSuraj01/SafeZip.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 ZipIgnore:
zipignore ./my-project
Output:
─────────────── ZIPIGNORE 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
zipignore <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
zipignore ./project
# Custom output path
zipignore ./project -o release-v1.0.zip
# Dry run — preview only, no archive created
zipignore ./project --dry-run
# Verbose — see every include/exclude decision
zipignore ./project --verbose
# Overwrite existing archive
zipignore ./project --force
# Combine flags
zipignore ./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
ZipIgnore 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
ZipIgnore 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.
Metadata
Release files for ZipIgnore 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zipignore-1.0.0.tar.gz | 91.5 kB | With provenance | Details for zipignore-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zipignore-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for zipignore-1.0.0-py3-none-any.whl |
Total release size: 198.4 kB
Release files / zipignore-1.0.0.tar.gz
| Download URL | zipignore-1.0.0.tar.gz |
|---|---|
| Size | 91.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcd43452a6f8e96262965807ddbfcb07b5922172768142c371347798d7b90769
|
|
BLAKE2b-256 checksum How to use checksums |
d736ad3ab6710b09fbe7ecbdaefa0f689360023eabcf928392df241d6f87dc5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.
Transparency logRelease files / zipignore-1.0.0-py3-none-any.whl
| Download URL | zipignore-1.0.0-py3-none-any.whl |
|---|---|
| Size | 106.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1aafe116a939711642f1c0fd74b9b582d7b72c6afb011166d9253a74d7ad0e32
|
|
BLAKE2b-256 checksum How to use checksums |
9076474da2c6880aac619e9000eef19434f97d020f72ae1638634754fa5752b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.
Transparency logSecurity for ZipIgnore 1.0.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for zipignore-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.
Transparency logA 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.