Notes on packaging XGBoost’s Python package
How to build binary wheels and source distributions
Wheels and source distributions (sdist for short) are the two main mechanisms for packaging and distributing Python packages.
A source distribution (sdist) is a tarball (
.tar.gzextension) that contains the source code.A wheel is a ZIP-compressed archive (with
.whlextension) representing a built distribution. Unlike an sdist, a wheel can contain compiled components. The compiled components are compiled prior to distribution, making it more convenient for end-users to install a wheel. Wheels containing compiled components are referred to as binary wheels.
See Python Packaging User Guide to learn more about how Python packages in general are packaged and distributed.
For the remainder of this document, we will focus on packaging and distributing XGBoost.
Building sdists
In the case of XGBoost, an sdist contains both the Python code as well as the C++ code, so that the core part of XGBoost can be compiled into the shared library .