Skip to main content

zipfile-deflate64

PyPI

Extract Deflate64 ZIP archives with Python's zipfile API.

⚠️ Note: This is a fork of zipfile_deflate64 (Apache 2.0) with updated zlib 1.3.1 for macOS build fix.

Installation

pip install zipfile-deflate64

Python 3.6, 3.7, 3.8, 3.9, and 3.10 are supported, with manylinux2014, macOS and Windows wheels published to PyPI.

Usage

Anywhere in a Python codebase:

import zipfile_deflate64  # This has the side effect of patching the zipfile module to support Deflate64

Alternatively, zipfile_deflate64 re-exports the zipfile API, as a convenience:

import zipfile_deflate64 as zipfile

zipfile.ZipFile(...)
...

Design Rationale

The Problem

Recent versions of Microsoft Windows Explorer use Deflate64 compression when creating ZIP files larger than 2GB. With the ubiquity of Windows and the ease of using "Sent to compressed folder", a majority of newly-created large ZIP files use Deflate64 compression.

However, support for Deflate64 in the open-source ecosystem is very poor! Most ZIP libraries have declined to implement Deflate64, citing its proprietary nature.

In the .NET ecosystem, the ZipArchive API supports decompression only. In Java, the Apache Commons Compress APIs support both compression and decompression.

The 7-Zip project probably provides the best general-purpose support for compressing and decompressing Deflate64, but there are several obstacles to general usability:

In the Python ecosystem in particular, there have been several unfulfilled requests ( [1] [2] [3] ) for Deflate64 decompression support.

A Solution

The best hope seems to be the infback9 extension to zlib. This was developed in 2003 by Mark Adler, an original author of zlib, and is kept in the source repository of zlib, but it is not officially supported and contains no build tooling and is not distributed with zlib packages. Additionally, infback9 provides only low-level support for working with Deflate64 bitstreams, with no support for the ZIP archive format (which is out of scope for zlib).

infback9's C-language API is relatively simple, but requires a non-trivial struct and function pointers for initialization and some explicit memory management operations (resizing allocated buffers and proving a Python-friendly malloc) to operate efficiently, so wrapping it with only ctypes seems to be inadequate.

To manage ZIP archive extraction operations, the Python standard library zipfile module provides the essential features and is already ubiquitous in availability and usage. However, zipfile is difficult to extend, as it hardcodes many conditionals for compression formats and does not provide capabilities for easily augmenting or replacing parts of it. Monkey-patching can overcome some of these problems, and the promise of a drop-in, API-compatible patch to a standard library module outweighed the engineering benefits of basing a solution off a more naturally extensible third-party ZIP manipulation package.

Metadata

Release files for zipfile-deflate64-macos 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zipfile-deflate64-macos 0.1.0
File Size Uploaded Provenance Actions
zipfile_deflate64_macos-0.1.0.tar.gz 62.8 kB Without provenance Details for zipfile_deflate64_macos-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zipfile-deflate64-macos 0.1.0
File Interpreter ABI Platform Actions
zipfile_deflate64_macos-0.1.0-cp39-cp39-macosx_10_9_universal2.whl CPython 3.9 CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) Details for zipfile_deflate64_macos-0.1.0-cp39-cp39-macosx_10_9_universal2.whl

Total release size: 91.1 kB

Release files / zipfile_deflate64_macos-0.1.0.tar.gz

Download URL zipfile_deflate64_macos-0.1.0.tar.gz
Size 62.8 kB
Tags Source
SHA-256 checksum
How to use checksums
52e44a7347c12b5323d6b531c4ddc66372202a81a418e6988649f7cbb5d36b8c
BLAKE2b-256 checksum
How to use checksums
3e36f72af3d4593130182960a3fdad2bb1ef339f2135fca4eec9c3fa2c4dcf1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / zipfile_deflate64_macos-0.1.0-cp39-cp39-macosx_10_9_universal2.whl

Download URL zipfile_deflate64_macos-0.1.0-cp39-cp39-macosx_10_9_universal2.whl
Size 28.4 kB
Tags CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
3593662154b02fb3dbcbdff306e95dd4e2a3665c6af7bf8adff5484dcfb14fee
BLAKE2b-256 checksum
How to use checksums
1df6b9102cff7f3115936396f42ef25a9ada068e18078a2398e865c42b6e4b0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for zipfile-deflate64-macos 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page