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

  • make syntax for running commands more intuitive
  • implement extraction of compressed items
  • implement compression summary after each compression
  • listen to events and compress correspondently

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.2.tar.gz (8.7 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.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zippa-0.1.2.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zippa-0.1.2.tar.gz
Algorithm Hash digest
SHA256 abe213459ffa9fb9f04ec90758a2846cc519763d03ad168c6a5de257ad75a92d
MD5 d1604d83ec7d888d1a2794ee8ea1b24f
BLAKE2b-256 b1d04c5867ce4dd54adec6c4bdce913b8d5aa4edf07242ae8bc8b8d653ff0648

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zippa-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zippa-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2a653f2b33ff441090abc8d1f47f48cc19076b3e44b838e42fd76f3e5b9ac22a
MD5 dbecfc92b5bbb049ca72f85b2c12b5af
BLAKE2b-256 d77a64ec78333800bd11b7131228e8b10c90a35704c9c84dd94cdda2005bda99

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