-
Notifications
You must be signed in to change notification settings - Fork 172
Open
Description
Rationale: wheels use zip archives. Zip archives don't allow gaps. It is a practically needed thing to edit wheels metadata. It can be done 3 ways:
- creating a new archive and copying files from an old one there.
- waste of computation and disk space and IO ops. For flash - also extended and unneeded burn.
- splitting archive into 3 parts: before the file being replaced, the file being replaced, and after it. The part
beforeis kept intact, then file is appended, thenafterpart. Plus recomputation of the index. Closer the file being modified to the end - more we can keep intact. IfMETADATAfile is the last one, then we only need to recompute the index. - When a file is compressed, we cannot easily control its blob size in compressed form. When a file in zip archive is stored uncompressed, there is a bijection between uncompressed size and compressed size. If we keep the blob size intact, then we can replace the file in-place without recalculation of indexes and shifting parts after it. The only thing we need to recalculate is CRC.
So I propose:
- to enable 2, store METADATA file the last. Also iteration of the wheel can be optimized using this knowledge.
- to enable 3, store it uncompressed. Then the code replacing metadata with the one of equal size can be as simple as https://github.com/KOLANICH-libs/zipcraft.py/blob/master/zipcraft/__init__.py
About long description ... it may make sense to move it into an own file.
Metadata
Metadata
Assignees
Labels
No labels