[Distutils] two setup scripts

Chris Jerdonek chris.jerdonek at gmail.com
Fri May 11 20:36:13 CEST 2012

I have an open-ended question about the idea of creating two setup
scripts for a project: one for end-users (e.g. installing), and
another for all other use cases (e.g. project development).

Here are a few reasons I came across for considering something like this:

The first is that if the project needs to support, say, Python 2.4
through Python 3.2, then having two setup scripts would let you
require (and develop against) Python 2.7 for the developer version,
while supporting all versions only for the simpler end-user version.
This would also let you do things like import from the project itself
in the developer version of your setup script, a process that would
break if running the setup script using Python 3 (assuming you are
using 2to3 for Python 3 support).

The second is that I have a pre-processing step that requires using
pandoc to generate setup()'s long_description from README and HISTORY
files in markdown format prior to uploading to PyPI, and I don't want
end-users to need pandoc.  I am currently dealing with this in code,
but it would be nicer to have simpler code with fewer "if blocks."

The third is simply separation of concerns.

This approach raises the following questions:

(1) Which setup commands should each version of the script support?

(2) Which arguments to setup() are required and/or used for each command?

I would also like to know (2) independent of creating two setup
scripts.  For example, I mentioned long_description above.  The
long_description seems to be available in places like PKG-INFO and in
the DOAP xml file exposed on PyPI, so is it necessary to pass
long_description, etc to setup() for any setup command other than
sdist (which creates PKG-INFO), or is it also necessary to pass that
metadata to setup() even with the upload and install commands?


More information about the Distutils-SIG mailing list