Rewrite zip files, modifying compression type and parameters.
Reason this release was yanked:
incorrect project url in metadata
Project description
zipmanip
This is a command line utility that rewrites a zip file. It attempts to leave the archive contents metadata and ordering as unchanged as is possible, but recompresses or decompresses the contents.
This was written to use as a git smudge/clean filter to use when using git to keep a history of zip files. (See below for more on that.)
It may be useful in other cases as well.
Usage with Git
Zipmanip can be used as a clean/smudge filter with git so that zip
archives are stored uncompressed in the git index.
(The motivation is that if the zip contents are not compressed, git should be able to more efficiently pack the deltas between revisions.)
To set this up:
git config filter.zipmanip.clean "zipmanip --compression-method=store"
git config filter.zipmanip.smudge "zipmanip -9"
# optionally, for diff formatting
git config diff.unzip.textconv "unzip -c -a"
Then, edit .gitattributes to set the filter=zipmanip (and, optionally
diff=unzip) on any zip files that you want to store uncompressed.
E.g.
*.FCStd binary filter=zipmanip diff=unzip
*.3mf binary filter=zipmanip diff=unzip
*.amf binary filter=zipmanip diff=unzip
Bugs
On Round-trip Idempotentency
Currently if a zip archive is round tripped — converted to uncompressed, then recompressed — the result will not be byte-wise identical to the original. This is due to (at least) a couple of issues.
Differing compression algorithm and parameters
It may be possible to improve this situation, at least partially, by storing information on the original compression type in the uncompressed archives.
Note that data on compression level may be available from bits 1, 2
and possibly 4 of the ZipInfo.flags.
(See section 4.4.4 of PKZIP Application Note.)
Differing use of "zip64" extended header
Also the use of "extended local header" is not preserved. (This
manifests in .3mf files written by PrusaSlicer. PrusaSlicer always
writes extended headers. (This, I think could be fixed with
appropriate use of the force_zip64 parameters to ZipFile.open.)
Author
Jeff Dairiki dairiki@dairiki.org
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.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zipmanip-0.1.0a1.tar.gz.
File metadata
- Download URL: zipmanip-0.1.0a1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10bc066fccdb0f154d5ed724f07bb32fe09f83aaa9d9b85fa934227cd7599c41
|
|
| MD5 |
d018a3fb467aa65c1eceaa204a902bb0
|
|
| BLAKE2b-256 |
9e24901fdf16360906799ffb0db9a592d36f225abcc82222a741f14c0b34b39c
|
File details
Details for the file zipmanip-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: zipmanip-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75011e59d9e70b2a233935c30d5239caa0b81a00023a025f2f8ee5485106375f
|
|
| MD5 |
5c40454deecb818eee1b67102515da7f
|
|
| BLAKE2b-256 |
454702507e8c414940772b6d2724efbdc31e0350ba3f6c8772ac66557478670e
|