This chapter covers
- The Python package build system
- Building a package using setuptools
- The directory structure of a Python package
- Building a package for multiple targets
Python package builds are the product of coordination between a few different tools driven by a standardized process. One of the biggest choices you have as a package author is which set of tools to use. It can be difficult to assess the nuances of each, especially if you’re new to packaging. Fortunately, tools are standardizing around the same core workflow, so once you learn it you’ve got the agility to switch between tools with minimal effort. This chapter covers what each category of these tools accomplishes and how they work together to produce a package, as well as how package builds vary for different systems.
Important
Before reading on, visit appendix B to install the tools you’ll need for this chapter.
You can use the code companion (https://github.com/daneah/publishing-python-packages) to check your work for the exercises in this chapter.
The following sections cover what happens when you build a package, and what you need to do to build a package successfully. You first need to learn about the pieces of the Python build system itself.
In the root directory for your project, start by running build
using the following command:
$ pyproject-build