Table of Contents

Created by: gwideman, Nov 1, 2013 6:04 pm
Revised by: gwideman, Nov 15, 2013 3:14 pm (3 revisions)

Overview

Some notes on several Python packaging-related programs, and how to discover their inputs.

Details

Programs/libraries to examine:
  • distutils
  • setuptools
    • easy_install() ?
  • pip
The following table records how to discover the allowed input options, flags etc for each input type.
Inputs
distutils setup()
setuptools setup()
pip [1]

Intended to be called from enclosing setup.py program
Intended to be called from enclosing setup.py program
Stand-alone program invoked directly from command line
command-line args to program or enclosing setup.py
--help and --help command output, except that's incomplete as it doesn't display arguments to options
General: XXXX
Command-specific: Survey Command subtype's attributes
pythonhosted.org/setuptools/setuptools.html#command-reference, but this doesn't list all arguments to each command
'setup.py --help' and 'setup.py --help command' output, but that's incomplete as it doesn't display arguments to options
General: XXXX
Command-specific: Survey Command subtype's attributes
Note: Since setuptools is an extension to distutils, need to determine whether a command is (a) added by setuptools, (b) from distutils unchanged or (c) a distutils command overridden or modified by setuptools.
www.pip-installer.org/en/latest/usage.html, fairly extensive, but sparse layout hard to digest.
General: pip.baseparser.standard_options
Command-specific: Use code to run sufficient pip functionality to build Command objects, whose attributes can then be inspected:
from pip.commands import commands_order
command = pip.commands[commandname](parser)
Then inspect command attribs like __doc__, and cmd_opts.option_list
Also 'pip --help' and 'pip --help command'. (Does list command args, unlike setuptools and distutils.)
Also
arguments to setup(...)
distutils.core.py setup_keywords. Maybe also extension_keywords. See also: Distutils 10. API Reference distutils.core
setuptools setup = distutils.core.setup. But, does setuptools add or modify the allowed arguments?
See setuptools dist.py class Distribution doc comment about added keyword args. Not clear where in the code they actually get added.
[1]
configuration file(s)
See dist.py find_config_files():
  • distutils/distutils.cfg
  • unix ~/.pydistutils.cfg
  • Win: user home \pydistutils.cfg
  • "current dir" /setup.cfg
setopt.py seems to imply that setuptools uses the same config files as distutils.
Also get_config_vars imported from distutils.sysconfig
Requirements file
Any others? Must grep source to see.
environment variables?
Search source for environ (ie: os.environ.get() )
DISTUTILS_DEBUG






















[1] Does pip invoke setup() and if so what's the role of command-line arguments?


Just to test some code
indented line