This library aims to make it dead simple to create a format-compliant .whl file (wheel). It provides an API comparable to zipfile. Use this if you wish to inspect or create wheels in your code. For a quick look, see the example on the right, which packages the wheelfile module itself into a wheel 🤸. What's the difference between this and wheel?"Wheel" tries to provide a reference implementation for the standard. It is used by setuptools and has its own CLI, but no stable API. The goal of Wheelfile is to provide a simple API. Wheelfile does not depend on Wheel. Thanks to Paul Moore for providing his gist of basic metadata parsing logic, which helped to avoid many foolish mistakes in the initial implementation. |
from wheelfile import WheelFile, __version__
spec = {
'distname': 'wheelfile',
'version': __version__
}
requirements = [
'packaging >= 20.8',
]
with WheelFile(mode='w', **spec) as wf:
wf.metadata.requires_dists = requirements
wf.write('./wheelfile.py')
# 🧀 More examples: buildscript | PEP-517 builder |