Search code examples
pythonsetuptoolseggsoftware-packaging

What are the best practices for creating Python Distributions(eggs) on(and for) Multiple Operating Systems


Ours is a python shop. We have different python packages developed inhouse and will be deployed onto customers' environments(machines).

This is how our development and release cycle happens.

Once developers complete "testing" of a package, a distribution(egg file) of the package is prepared and pushed to a central archiving place. WHen we want to deploy our software to Customers, the same distributions(egg files) will be downloaded and installed in their environment.

Assuming the "testing" happens on multiple operating systems(to check the compatibility of the API across platforms), what is the best practice to prepare distributions and be pushed to the central archiving place.

Is it best to have operating system specific eggs on the archiving server(like, samplepkg-1.0.0.win32.egg and samplepkg-1.0.0.linux.egg ? Not sure how they can be prepared in this way using setuptools. ) Or Have a single egg because API remains same across platforms ? Any other practice which is followed by the community ?


Solution

  • You can use a single package if:

    1. The package does not use functions/classes that are not available on all your target platforms (see e.g. chapters 36-39 of the Python standard library reference for version 2.7.2 for stuff that you shouldn't use in that case)
    2. You are not using extensions written in C/C++ that need to be compiled for every platform.

    It it generally a good idea to stay away from OS specific functions that are not available on all your target platforms. The standard library is quite well documented in that respect.