python-zipremove
Port variant v15
Summary Extend zipfile with extra remove abilities (3.15)
Package version 0.10.0
Homepage https://github.com/danny0838/zipremove
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v14
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 27 NOV 2026, 01:15:48 UTC
Port created 27 NOV 2026, 01:15:48 UTC
Subpackage Descriptions
single ![PyPI version] ![Python Versions] ![Status] ![License] [Downloads] [Pull request] [Pull request] [Pull request] [Pull request] [Pull request] This package extends the native `zipfile` module with remove-related capabilities. The same codebase is currently being integrated into the CPython standard library and is scheduled to be available natively in Python 3.16. This package serves as a backport to support these future features today. ## Usage * Install this package: `sh pip install zipremove ` * Import and use it as a drop-in replacement for the native `zipfile` module: ```python import zipremove as zipfile with zipfile.ZipFile('archive', 'a') as fh: fh.remove('subfile') ``` * Alternatively, this package automatically monkeypatches the native `zipfile` module upon import. The extended features will become available globally on the built-in `zipfile` classes: ```python from zipfile import ZipFile import zipremove as _ with ZipFile('archive', 'a') as fh: fh.remove('subfile') ``` ## API * `ZipFile.remove(zinfo_or_arcname)` Removes a member entry from the archive's central directory. *zinfo_or_arcname* may be the full path of the member or a `ZipInfo` instance. If multiple members share the same path and a string is provided, only one unspecified entry is removed; pass a specific `ZipInfo` instance to guarantee which member is removed. The archive must be opened with mode 'w', 'x' or 'a'. Returns the removed `ZipInfo` instance. Calling `remove` on a closed ZipFile will raise a `ValueError`. > **Note:** > This method only removes the member's entry from the central directory, > making it inaccessible to most tools. The member's local file entry, > including content and metadata, remains in the archive and is still > forensically recoverable. To completely delete the data and reclaim > space, call `repack` afterwards (preferably passing the returned `ZipInfo` > instance). * `ZipFile.repack(removed=None, *, strict_descriptor=True[, chunk_size])` Rewrites the archive to remove unreferenced local file entries, shrinking its file size. The archive must be opened with mode 'a'. If *removed* is provided, it must be a sequence of `ZipInfo` objects representing the recently removed members, and only their corresponding local file entries will be removed. This is the most efficient and reliable way to reclaim space. A brief example looks like: ```python with ZipFile('spam.zip', 'a') as myzip: removed = [myzip.remove(name) for name in ('ham.txt', 'eggs.txt')] myzip.repack(removed) ``` If *removed* is omitted, the archive is scanned to locate and remove local file entries that are no longer referenced in the central directory.
Configuration Switches (platform-specific settings discarded)
PY314 OFF Build using Python 3.14 PY315 ON Build using Python 3.15
Package Dependencies by Type
Build (only) python315:dev:std
python-pip:single:v15
autoselect-python:single:std
Build and Runtime python315:primary:std
Download groups
main mirror://PYPIWHL/0a/e4/2225c1890ce6e239ca23efabb80a3481229a14a2deaa489f5e89723a5aa6
Distribution File Information
04e15df7083642d5b791e51f597cffef8a92d770ecf5160c529b5a7b53b40100 11280 python-src/zipremove-0.10.0-py3-none-any.whl
Ports that require python-zipremove:v15
python-python-sbom:v15 Write PEP 770 CycloneDX SBOMs into wheels (3.15)