distutils have very limited functionality. This is the reason why you should use setuptools. But 'distribute' is compatible to setuptools.
PyPi is the Python Package Index. They distribute packages in form of "eggs". You can install them with easy_install or with pip.
virtualenv / virtualenvwrapper
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 are startet when you install a package with
Setuptools are 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, but use setuptools.
PIP is short for 'PIP installs Python'. It can only install files from sources; so it does not support egg files.
PIP commands are
It might be the case that you have to have a Django 1.4 and a Django 1.5 project. In that case, you need different environments.
$ pip freeze $ virtualenv my_env $ source my_env/bin/activate
A project could have this structure:
$ tree . ├── LICENSE ├── MANIFEST ├── pyconde2013news │ └── __init__.py ├── README └── setup.py
With this setup.py:
from distutils.core import setup setup(name="pycon2013news", version="0.1", py_modules=["pycon2013news"],)
This can directly be registered on PyPi:
python setup.py register
But a problem of this code is that it does not show the dependencies. So you should rather use setuptools for your setup.py:
from setuptools import setup setup(name="pycon2013news", version="0.1", py_modules=["pycon2013news"], description="Reads latest news headlines from the PyCon.DE 2013 website") author="Daniel Hepper", author_email="[email protected]", url="https://github.com/dhepper/pyconde2013news", install_requires=[ "beautifulsoup4==4.3.2", "requests==2.0.0" ]
When you add
scripts argument to setup, you can later execute those.
Entry points are also interesting.