This is a quick article I had for quite a while as a draft. It might not be finished or have other problems, but I still want to share it. I wrote this when I did not know much about packaging. I wrote a tutorial how to create Python packages in 2018 as well. In 2020, I gave a Python Packaging Course which is better structured, up-to-date and has way more details.
The following article is a wrap-up of the talk Python Packages from Daniel Hepper given at a German PyCon 2013.
PyPi is the Python Package Index. They distribute packages in form of "eggs". You can install them with easy_install or with pip.
Package Management Tools
Distutils is part of the standard library. When you run
python setup.py install
then distutils is running.
Major disadvantages of distutils are:
- No Meta-data:
- no deinstallation
- no dependencies
- No Package listing (so you can't automatically search pypi)
Setuptools is an extension for distutils. Setuptools offers dependency management. With setuptools, so called 'egg files' were introduced. Those files are comparable to jar files in Java.
Distribute was a fork of setuptools that got merged back to setuptools. So don't use distribute, use setuptools.