Python Packages – use setuptools and pip

Many ways of creating, distributing and installing packages. E.g.

distutils, setuptools, easy_install, ez_setup, pip.

Multiple formats:

egg, wheel, source dist.

To clear up this mess, the Python Packaging Authorits (PyPA) was setup. Advice is, if creating and distributing a package:

  1. use setuptools

Note: distutils is discontinued and merged into setuptools. easy_install is also merged into setuptools.

If installing a package, use pip and virtualenv.

Note: from Python 3.4, pip comes pre-installed.

Also homebrew installs pip by default with Python.


Notes on  pip

pip list

pip show <specific package>

pip search query

Requirements file

pip freeze > requirements.txt: save project dependencies into requirements.txt

pip install -r requirements.txt: install packages listed in file