Chapter 24. Packaging Programs and Extensions
In this chapter, abridged for print publication, we describe the packaging ecosystem’s development. We provide additional material in the online version of this chapter, available in the GitHub repository for this book. Among other topics (see “Online Material” for a complete list), in the online version we describe poetry, a modern standards-compliant Python build system, and compare it with the more traditional setuptools approach.
Suppose you have some Python code that you need to deliver to other people and groups. It works on your machine, but now you have the added complication of making it work for other people. This involves packaging your code in a suitable format and making it available to its intended audience.
The quality and diversity of the Python packaging ecosystem have greatly improved since the last edition, and its documentation is both better organized and much more complete. These improvements are based on careful work to specify a Python source tree format independent of any specific build system in PEP 517, “A Build-System Independent Format for Source Trees,” and the minimum build system requirements in PEP 518, “Specifying Minimum Build System Requirements for Python Projects.” The “Rationale” section of the latter document concisely describes why these changes were required, the most significant being removal of the need to run the setup.py file to discover (presumably by observing tracebacks) the build’s ...
Get Python in a Nutshell, 4th Edition 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.