[Distutils] two setup scripts

Chris Jerdonek chris.jerdonek at gmail.com
Fri May 18 15:09:22 CEST 2012


I asked the question below about a week ago.  Does anyone have any
thoughts on it?

I'll rephrase it to be simpler.  Does anyone know which arguments to
setup() it is safe to leave out when invoking run "setup.py install"
from a source distribution?  I'm assuming the source distribution
directory is one created using "setup.py sdist" (i.e. one that
contains a PKG-INFO file, a *.egg-info directory, etc).  For example,
it doesn't seem like long_description would be needed.

Since the setup() function was created to be a universal function
usable by both module developers and installers, it seems like it
would be useful to know which subset of arguments need to be provided
in the latter, simpler case.  It would also help to know where the
install command looks for and gets its information from (from the
arguments to setup(), or from the PKG-INFO file, etc).

It seems like a possible improvement to distutils would be for it to
be able to say which arguments to setup() are needed or used by which
setup commands, so that things can be more explicit.  Does that seem
like a worthwhile improvement?  It might be an intermediate step to
making the function less God-like (if that itself is a worthy goal).

Thanks,
--Chris


On Fri, May 11, 2012 at 11:36 AM, Chris Jerdonek
<chris.jerdonek at gmail.com> wrote:
> 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?
>
> Thanks,
> --Chris


More information about the Distutils-SIG mailing list