4

I just want to understand how python wheels fits into the bigger picture of Python development. It's a very general question, but I'm having trouble getting this information from searching online. If anyone can suggest any links, that would be good as well.

martineau
  • 119,623
  • 25
  • 170
  • 301

1 Answers1

1

From the great book "Serious Python"

For most of Python’s existence, there’s been no official standard distribution format. While different distribution tools generally use some common archive format—even the Egg format introduced by setuptools is just a zip file with a different extension—their metadata and package structures are incompatible with each other. This problem was compounded when an official installation standard was finally defined in PEP 376 that was also incompatible with existing formats.

To solve these problems, PEP 427 was written to define a new standard for Python distribution packages called Wheel. The reference implementation of this format is available as a tool, also called Wheel.

Wheel is supported by pip starting with version 1.4. If you’re using setuptools and have the Wheel package installed, it automatically integrates itself as a setuptools command named bdist_wheel. If you don’t have Wheel installed, you can install it using the command pip install wheel

To create wheel you run following command:

$ python setup.py bdist_wheel

The bdist_wheel command creates a .whl file in the dist directory. As with the Egg format, a Wheel archive is just a zip file with a different extension. However, Wheel archives do not require installation—you can load and run your code just by adding a slash followed by the name of your module:

$ python wheel-0.21.0-py2.py3-none-any.whl/wheel -h

One of the advantages of Wheel is that its naming conventions allow you to specify whether your distribution is intended for a specific architecture and/or Python implementation (CPython, PyPy, Jython, and so on). This is particularly useful if you need to distribute modules written in C.

Wheel is a great format for distributing ready-to-install libraries and applications, so you are encouraged to build and upload them to PyPI as well.

Vlad Bezden
  • 83,883
  • 25
  • 248
  • 179