zippy

zippy, working with .zip files

I needed a short bit of Python code to work with .zip files today. After reviewing the docs on the ZipFile module, I decided that, for my needs, writing a couple of classes to abstract some of the dirty work made sense. This resulted in zippy.py. Here are some samples of how zippy helps you:

# Zipping up files
from zippy.zippy import Zip
# Zip up a directory of files
Zip('name_of_zipfile.zip').add_files(['your_directory'])
# Zip up a single text file
Zip('name_of_other_zipfile.zip').add_files(['file3.txt'])

# Unzipping files
from zippy.zippy import Unzip
# The to_path method returns True on success, False on failure
Unzip('name_of_zipfile.zip').to_path('/home/you/your_extracted_files')

It’s a pretty simple set of classes at this point. My main goal was to provide somewhat self-documenting, reusable
code, and I think I’ve done that. Plus, it reminds me of jQuery style ‘chaining’

Suggestions and requests are welcome!

Comments