Skip to main content

A Python utility for zipping directories and files

Project description

Automate dir zipping⚡️

Project Description

CLI for flexibly zipping items.

Features

  • compress files and dirs as required
    • run command for zipping dirs/files of choice
    • run command for defining where compressed files should live

Prerequisites

  • Python 3.12+
  • Git
  • uv (recommended) or pip

Usage

Command Line Interface

Case 1: Compress items from current working directory (cwd)

# Basic compression in cwd
$ uv run zippa pack foo.txt bar.py
$ uv run zippa pack foo.txt dir1/ bar.py
$ uv run zippa pack .

# Specify output location (can be anywhere)
$ uv run zippa pack . --output /path/to/backup.zip
$ uv run zippa pack *.py --output ../python_files.zip
$ uv run zippa pack . --output ~/backups/project.zip

Case 2: Compress items from external directory, output in that directory

# Compress everything in external directory, output there
$ uv run zippa pack . --chdir ~/path/to/dir --output backup.zip

# Compress specific files in external directory, output there
$ uv run zippa pack file1.txt file2.py --chdir ~/path/to/dir --output backup.zip

Case 3: Compress items from external directory, output in different directory

# Compress everything in external directory, output elsewhere
$ uv run zippa pack . --chdir ~/path/to/source --output ~/path/to/output/backup.zip

# Compress specific files in external directory, output elsewhere
$ uv run zippa pack file1.txt file2.py --chdir ~/path/to/source --output ~/path/to/output/backup.zip

Exclude Patterns

# Exclude specific patterns via command line
$ uv run zippa pack . --exclude "*.pyc" --exclude "__pycache__" --exclude "*.log"

# Use custom .zipignore file
$ uv run zippa pack . --exclude-file .myignore

# Combine .zipignore with additional exclusions
$ uv run zippa pack . --exclude-file .zipignore --exclude "*.tmp"

# Exclude patterns with external directory
$ uv run zippa pack . --chdir ~/path/to/project --exclude "*.pyc" --exclude "__pycache__"

.zipignore File

Create a .zipignore file in your project root to define default exclusions:

# .zipignore example
*.pyc
__pycache__/
*.log
*.tmp
.git/
node_modules/
.env
*.DS_Store
build/
dist/
*.egg-info/

Additional Options

# Verbose output
$ uv run zippa pack . --output backup.zip --verbose

# Custom compression level
$ uv run zippa pack . --compress-level 6 --output backup.zip

# Show help
$ uv run zippa --help
$ uv run zippa pack --help

Important Notes

  • Case 1: Items are relative to your current working directory
  • Case 2 & 3: Items are relative to the directory specified by --chdir
  • Output location: Can be anywhere (absolute or relative path)
  • Current limitation: --chdir must come after the items to compress

Future Updates

  • listen to events and compress correspondently
  • implement extraction of compressed items
  • implement compression summary after each compression

Author

Carlos Pumar-Frohberg

🤝 Support

Comments, questions and/or feedback are welcome!

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

zippa-0.1.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

zippa-0.1.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file zippa-0.1.1.tar.gz.

File metadata

  • Download URL: zippa-0.1.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.8

File hashes

Hashes for zippa-0.1.1.tar.gz
Algorithm Hash digest
SHA256 818f20015c44a91a8e3ad3d6bcf756157a818bb718f35d42de2c2a44bd394051
MD5 d1db0fecb5a40caa0b929db5e7823371
BLAKE2b-256 53f1476a1a6facf4950dfead51a24fa8249511496cae01e7571ddecb4b4c63fd

See more details on using hashes here.

File details

Details for the file zippa-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: zippa-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.8

File hashes

Hashes for zippa-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 733550dae6e6e251d217c0fd14b3a9bf761850c3f48fa03abb215ddfc1c3a58e
MD5 a5b9b3ec0b16878cbdae8d8fff9948b4
BLAKE2b-256 99b3d942e5bd291bf35b0cf7d5996b49f850f8ef987d1467cdd3510f9a8735a6

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