Packaging with Setuptools
We will be using the Setuptools library to package our project. Setuptools is the oldest actively developed packaging tool for Python, and still the most popular. It is an extension of the original, standard library distutils
packaging system. The distutils
module was deprecated in Python 3.10 and removed from the standard library in Python 3.12.
In this section, we will be looking at how to set up our project to build packages with Setuptools.
Project layout
There are two popular conventions for laying out files in a Python project:
- In the src layout, the importable packages that need to be distributed are placed in a folder named
src
within the main project folder. - In the flat layout, the importable packages are placed directly in the top-level project folder.
The src layout has the advantage of being explicit about which files will be included in the distribution. This reduces the likelihood of accidentally including...