Chapter 16: Packaging Python
Python is the most popular programming language for machine learning. Combine that with the proliferation of machine learning in our day-to-day lives and it is no surprise that the desire to run Python on edge devices is intensifying. Even in this era of transpilers and WebAssembly, packaging Python applications for deployment remains an unsolved problem. In this chapter, you will learn what choices are out there for bundling Python modules together and when to use one method over another.
We start with a look back at the origins of today's Python packaging solutions, from the built-in standard distutils
to its successor, setuptools
. Next, we examine the pip
package manager, before moving on to venv
for Python virtual environments, followed by conda
, the reigning general-purpose cross-platform solution. Lastly, I will show you how to use Docker to bundle Python applications along with their user space environment for rapid deployment to the cloud...