Python setuptools: distrobutions
Distrobutions are the files that you provide to users so that they can install your packages.
There are several different formats of distrobution, some target specific platforms, some come precompiled, etc.
distribution types
package format description sdist
source distrobutions are simply .tar.gz archives with all of the files configured in your setup() function. These are the standard packages that you find on pypi.
bdist_wheel
wheels are a new format for packages, and they are gradually replacing eggs as the standard. The advantages are:
- installing packages using C modules do not require a compiler on the user's computer
- they take less time to install
bdist_egg
package project as a zipfile (.egg). Explicitly add .egg to your PYTHONPATH and you may run it's contents. bdist_zip
package project as a zipfile (.zip). Explicitly add .zip to your PYTHONPATH and you may run it's contents. bdist_msi
windows specific installer (see also msi and python_msilib) bdist_dmg
macos specific installer Once configured, you can build a target distribution by adding it as a param on the commandline.
Here are some examples:# sdist python setup.py sdist tar -xvf xxx.tar.gz && cd xxx* && python setup.py install # wheel python setup.py bdist_wheel pip dist/*.whl
zipfile safe
By default,
setup.py
tries to conserve room by compressing files in zip/egg archives.
This may not always be safe or desirable. You can disable this behaviour withzip_files=False
.setuptools.setup( zip_files = False, )