© Moritz Lenz 2019
Moritz LenzPython Continuous Integration and Deliveryhttps://doi.org/10.1007/978-1-4842-4281-0_5

5. Building Packages

Moritz Lenz1 
(1)
Fürth, Bayern, Germany
 

We will first explore the basics of creating Python source tarballs and then the creation of Debian packages from those tarballs.

5.1 Creating a Python Source Tarball

To create a Python source tarball, you have to write a setup.py script that uses distutils or setuptools. Then python setup.py sdist creates the tarball in the right format.

distutils is part of the Python standard library but lacks some commonly used features. setuptools adds these features by extending distutils. Which of these tools you use is mostly a matter of taste and context.

Here is a pretty minimal setup.py ...

Get Python Continuous Integration and Delivery: A Concise Guide with Examples now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.