Python Packages
Packaging
In Python, the term packaging refers to putting modules you have written in a standard format, so that other programmers can install and use them with ease.
This involves use of the modules setuptools and distutils.
foobar/
LICENSE.txt
README.txt
setup.py
foobar/
init.py
spam.py
ham.py
eggs.py
The next step in packaging is to write the setup.py file.
This contains information necessary to assemble the package so it can be uploaded to PyPI and installed with pip (name, version, etc.).
Example of a setup.py file:
1 | from distutils.core import setup |
Run python setup.py bdist or, for Windows, python setup.py bdist_wininst to build a binary distribution.
Finally, install a package with python setup.py install.
For Windows, many tools are available for converting scripts to executables. For example, py2exe, can be used to package a Python script, along with the libraries it requires, into a single executable.
PyInstaller and cx_Freeze serve the same purpose.
For Macs, use py2app, PyInstaller or cx_Freeze.
REFERENCES
- Packages: https://pypi.python.org/pypi





