Packaging with setuptools
We will be using the setuptools library to package our project. setuptools is currently the most popular packaging tool for Python. It is an extension of the original, standard library distutils packaging system. setuptools has many features that are not available in distutils and is more actively maintained. Direct use of distutils has been actively discouraged for many years. The distutils module will be deprecated in Python 3.10 and removed from the standard library in Python 3.12.
In this section, we'll be looking at how to set up our project to build packages with setuptools.
Required files
To build a package and publish it, we need to add some files to our project. If you look at the content of the train-project folder in the chapter source code, you will see the following files alongside the train_schedule folder:
CHANGELOG.md LICENSE MANIFEST.in README.md pyproject.toml setup.cfg setup.py
We'll discuss each of these...