Created by: gwideman, Dec 4, 2013 4:22 pm
Revised by: gwideman, Sep 2, 2014 4:59 pm (8 revisions)

.
  • Work in progress
  • Part of a series which starts here.

Packaging-deployment-installation use cases

Different projects may well suit different deployment methods. Here are some of the dimensions on which projects may differ, prompting different packaging and deployment choices:
  • Product type
    • Library for other Python users: User will be working in a Python environment to call modules supplied in this distribution
    • Application for Python users: The application is somehow related to the user's work in Python, and the user is Python-savvy
    • Application for general use. Python is an implementation detail; the user should not need to be Python-savvy
  • Complexity of distribution package:
    • Number and complexity of Python modules and module packages; directory layout
    • Data and resource files
    • Non-Python executable functionality (liked DLLs or SOs)
      • If shipped as source, need building on target
      • May need special locations so loaders can find them
    • Third-party libraries that project depends upon, to be obtained from a repository like PyPI
  • Degree of cross-platform-ness required
    • If the target is a single OS, the developer might compile any non-Python modules ("extensions", often written in C) and include them in the distribution as binary components. For multiple OS targets, the developer might distribute the non-Python modules as source code, and command the installation process to compile the modules on the user's machine.
  • Broadness of distribution required
    • Delivery to a few known users (copy privately), versus delivery to the public at large (PyPI or other repository)
    • Public/Private/Proprietary
  • Degree of unobtrusiveness required of the installed product on user's machine
  • Degree of savvy required of:
    • Developer creating distribution
    • User performing the installation.

[ DIAGRAMS ]

Tool and format variants

  • Packaging tool variants
    • Distutils
    • Setuptools
    • zc.buildout
    • conda
    • Others?
  • Package Format variants
    • Generally it's an archive file of some kind (zip, gzip)
      • May follow some naming convention?
      • Usually includes metadata of some kind?
    • Variants of this general idea
      • sdist: "source distribution"
      • bdist: "binary distribution"
        • Egg format
        • Egg format variants
      • Wheel format
  • Getting distribution package to user's machine
    • Copy package file to user's machine (or copy the package file to a private file server or website for users to download)
    • Distribute via repository like PyPI
      • Package tool may be able to push to PyPI automatically
      • Install tool may fetch from PyPI automatically
  • Installation tool variants
    • setup.py/setup() using distutils
    • setup.py/setup() using setuptools (involves Easy Install)
    • pip
    • other? Plain old script of some kind?

How the use cases, tools and formats relate to each other

Packaging Tools vs Distribution Formats

Which tools produce and/or consume which formats? To make an informed choice, the developer needs to know the following relationships:
Create distribution

Install distribution
manual
distutils
setuptools
pip
Distribution format
manual
distutils
setuptools
(Easy Install)
pip
Y



zip file
Y



Y



zip with __main__.py
Y




Y


sdist

Y
Y
Y

Y
Y

bdist

Y
Y
Y


Y

egg


Y
N


?

wheel



Y










Y
Y

dumb
Y




Y
Y

rpm (red hat)
Y




Y
Y

msi (windows)
Y












Notes
  • Chart contents as of 2013-11.
    • distutils 3.3.2
    • setuptools 1.1.7
    • pip 1.4.1

Packaging Tools vs key features and distinctions

[Table]

Distribution Formats vs key features and distinctions

Feature
zip+__main__.py
sdist
bdist
egg
wheel
Descr

"Source" distribution
"Binary" or "Built" distribution


Variants
???
Pure; Not pure. (See below)

  • .egg format
  • .egg-info format
  • .egg-link file

Archive file format
zip
zip, tar
zip, tar
zip. Others? (Also: plain directory)
zip
Archive file name
???



PEP 427: Name indicates platform, python version(s), ABI version, product version/build
Versioning




Yes
Contents

  • Pure: includes only *.py source files
  • Not pure: includes source files of other languages, which will need compiling on user's machine.



Metadata
???


.egg-info
.dist-info
Can be "import"ed?



Yes

Supports build during install





Can be uninstalled?




Yes
Notes:
ABI = Application Binary Interface, which applies to the Python interpreter (environment?) and apparently can have version numbering independent of the Python version number.