All notable changes to this project will be documented in this file. The format is based on Keep a Changelog.
This project adheres to Semantic Versioning.
Nothing yet.
0.0.8 - 2021-08-03
-
Since
WheelFile
write methods now haveskipdir=True
default (see below), writing recursively from a directory will no longer produce entries for directories. This also means, that attempting to write an empty directory (or any directory, even withrecursive=False
) is no longer possible, unlessskipdir=False
is specified.This does not apply to
writestr_*
methods - attempting to write to anarcname
ending in/
will produce an entry that is visible as a directory. -
WheelFile.validate
will now fail and raiseValueError
ifWHEEL
build tag field (.wheeldata.build
) contains a value that is different from the wheel name (.build_tag
).
WheelFile.from_wheelfile
- a constructor class-method that makes it possible to recreate a wheel and: rename it (change distname, version, buildnumber and/or tags), append files to it, change its metadata, etc.WheelFile.METADATA_FILENAMES
- a static field with a set of names of metadata files managed by this class.WheelFile.writestr_distinfo
- similar towrite_distinfo
, this is a safe shortcut for writing into.dist-info
directory.WheelFile.__init__
now takes configuration arguments known fromZipFile
:compression
,compression
,allowZip64
, andstrict_timestamps
. They work the same way, except that they are keyword only inWheelFile
, and the default value forcompression
iszipfile.ZIP_DEFLATED
.WheelFile
write methods now take optionalcompress_type
andcompresslevel
arguments known fromZipFile
.- New
skipdir
argument inWheelFile
write methods:write
,write_data
, andwrite_distinfo
. WhenTrue
(which is the default), these methods will not write ZIP entries for directories into the archive.
- Docstring of the
WheelFile.filename
property, which was innacurate. MetaData.from_str
will now correctly unpackKeywords
field into a list of strings, instead of a one-element list with a string containing comma-separated tags.
0.0.7 - 2021-07-19
-
Default compression method is now set to
zipfile.ZIP_DEFLATED
. -
Wheels with directory entries in their
RECORD
files will now makeWheelFile
raiseRecordContainsDirectoryError
. -
Lazy mode is now allowed, in a very limited version - most methods will still raise exceptions, even when the documentation states that lazy mode suppresses them.
Use it by specifying
l
in themode
argument, e.g.WheelFile("path/to/wheel", mode='rl')
. This may be used to read wheels generated with previous version of wheelfile, which generated directory entries inRECORD
, making them incompatible with this release. -
In anticipation of an actual implementation,
WheelFile.open()
raisesNotImplementedError
now, as it should. Previously only adef ...: pass
stub was present.
- Implemented
WheelFile.namelist()
, which, similarily toZipFile.namelist()
, returns a list of archive members, but omits the metadata files which should not be written manually:RECORD
,WHEEL
andMETADATA
. - Added
WheelFile.infolist()
. Similarily to thenamelist()
above - it returns aZipInfo
for each member, but omits the ones corresponding to metadata files. RecordContainsDirectoryError
exception class.distinfo_dirname
anddata_dirname
properties, for easier browsing.
- Wheel contents written using
write(..., recursive=True)
no longer contain entries corresponding to directories in theirRECORD
. - Removed a bunch of cosmetic mistakes from exception messages.
0.0.6 - 2021-07-01
This release introduces backwards-incompatible changes in WheelFile.write
.
Overall, it makes the method safer and easier to use. One will no longer create
a wheel-bomb by calling write('./')
.
If you were passing relative paths as filename
without setting arcname
, you
probably want to set resolve=False
for retaining compatibility with this
release. See the "Changed" section.
WheelFile.write
andWheelFile.write_data
now have a new, keyword-onlyresolve
argument, that substitutes the defaultarcname
with the name of the file the path infilename
points to. This is set toTrue
by default now.- New
WheelFile.write_distinfo
method, as a safe shorthand for writing to.dist-info/
. - New
resolved
utility function. - New
ProhibitedWriteError
exception class.
WheelMeta
no longer prohibits reading metadata in versions other than v2.1. It uses2.1
afterwards, and its still not changeable though.- Since
WheelFile.write
andWheelFile.write_data
methods haveresolve
argument set toTrue
by default now, paths are no longer being put verbatim into the archive, only the filenames they point to. Setresolve
toFalse
to get the old behavior, the one exhibited byZipFile.write
. - Parts of
WheelFile.__init__
have been refactored for parity between "named" and "unnamed" modes, i.e. it no longer raises different exceptions based on whether it is given a file, path to a directory, path to a file, or an io buffer. - Wheels generated by
WheelFile
are now reproducible. The modification times written into the resulting archives using.write(...)
no longer differ between builds consisting of the same, unchanged files - they are taken from the files itself.
WheelFile
no longer accepts arguments of types other thanVersion
andstr
in itsversion
argument, when an io buffer is given.TypeError
is raised instead.MetaData
started accepting keywords given via single string (comma separated). Previously this support was documented, but missing.- The
wheelfile
package itself should now have the keywords set properly ;).
0.0.5 - 2021-05-12
- Added
ZipInfo38
requirement - v0.0.4 has been released without it by mistake.
0.0.4 - 2021-05-05
WheelFile.write
andWheelFile.write_data
now accept arecursive
keyword-only argument, which makes both of them recursively add the whole directory subtree, if thefilename
argument was pointing at one.
WheelFile.write
andWheelFile.write_data
are recursive by default.- Backported support to python 3.6 (thanks, e2thenegpii!)
0.0.3 - 2021-03-28
Big thanks to e2thenegpii for their contributions - both of the fixes below came from them.
- Fixed an issue breaking causing long METADATA lines to be broken into multiple shorter lines
- Fixed the production of RECORD files to encode file hashes with base64 per PEP 376
0.0.2 - 2021-01-24
- Read mode (
'r'
) now works. - Added
write_data
andwritestr_data
methods toWheelFile
class. Use these methods to write files to.data/
directory of the wheel. - Added
build_tag
andlanguage_tag
,abi_tag
, andplatform_tag
parameters toWheelFile.__init__
, with their respective properties. - Tag attributes mentioned above can also be inferred from the filename of the specified file.
- Accessing the mode with which the wheelfile was opened is now possible using
mode
attribute.
- Default tag set of
WheelData
class is now['py3-none-any']
. Previously, universal tag ("py2.py3-none-any"
) was used. - Fixed issues with comparing
MetaData
objects that have empty descriptions. After parsing a metadata text with empty payload, the returned object has an empty string inside description, instead ofNone
, which is used byMetaData.__init__
to denote that no description was provided. This means that these two values are the effectively the same thing in this context.MetaData.__eq__
now refelcts that.
0.0.1 - 2021-01-16
- First working version of the library.
- It's possible to create wheels from scratch.