What happens when you build a Python wheel?

Viewed 80

I'm trying to understand why Python runs setup.py to build a wheel for a pure Python package. Isn't it enough to simply put the files in place? Beyond creating an archive, does it do anything else? What actually happens when you build a pure Python wheel?

1 Answers

Let me explain in simple terms:

If your code is just Python, building a wheel doesn't actually do much work other than creating an archive as you pointed out.

A wheel is more useful when you have some of the functionality in your package implemented in C (which Python allows as a first-class feature). In such cases, anyone installing your package also needs to compile your C code. And if there is lots of such C code, it can take up a lot of time to install your package. This is where a wheel helps - it provides a way of distributing pre-compiled versions of your package so that others can install and use your package relatively quickly.

Related