Simple package to download & unzip archives within notebooks.
Project description
Zipmigo
Zipmigo is intended to assist fledgling data analysts and scientists with the process of downloading a zip file via http and unzipping it into the working directory when working in a notebook environment, saving them time and energy wading through os
, requests
, and running shell commands to inspect the directory structure.
Story
This package was born of the author's hatred for recursive folders within zip files, as well as her need to use the same commands over and over again to download & unpack zip archives. Over the course of a project, she found herself constantly reusing code snippets - a sign that one should wrap it up into a script. However, she was working in google colab, which was designed for collaborative notebook workflows. It seemed that distributing a package on PyPi was the easiest way to import a script into colab for her audience, and thus zipmigo was born.
Installation
Zipmigo is available for commandline installation from PyPi via pip install zipmigo
.
Google Colab
Run !pip install zipmigo
From Source
git clone https://github.com/kaszklar/zipmigo.git
to your directory of choice. cd zipmigo
and install with python setup.py install
.
Examples
Importing
import zipmigo
Download a zip file
Download a file to the current working directory. The status of the connection and the progress of the download will be printed out.
zipmigo.download("https://geo.nyu.edu/download/file/harvard-ntadcd106-shapefile.zip", 'congressdistricts.zip')
Print out the contents of the current working directory & subdirectories
zipmigo.list_dir()
Unzip
Unpack zip file into current directory. If the archive has only directories in the root, those directories will be placed in the current working directory.
zipmigo.unzip("congressdistricts.zip")
Release History
[1.1.0] 2020.08.12
Refactor for namespace
Adjust download control flow
[1.0.1] 2020.05.05
Some error handling and type assertions
Correct readme instructions
[1.0.0] 2020.02.13
Initial Release 🎉
Future features?
- Inspect zip archive prior to opening
- Extract a single file from the archive
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.