Interview Prep/Python for DevOps/Environments, dependencies & packaging

What is a wheel vs an sdist?

IntermediateConceptEnvironments, dependencies & packaging
Answer
  • sdist (.tar.gz): source distribution; installing it runs a build step, which for C extensions needs a compiler and headers.
  • wheel (.whl): a pre-built zip that is simply unpacked into site-packages. Pure-Python wheels are py3-none-any; binary wheels carry platform tags like manylinux_2_28_x86_64 or musllinux_1_2_aarch64.

pip prefers wheels. When none matches your platform (Alpine/musl, new Python versions, ARM), it falls back to the sdist and compiles, which is why pip install on Alpine can take 20 minutes or fail with gcc: not found.

All Python for DevOps questions Roadmap: Python for automation

More on Environments, dependencies & packaging