Standard way to distribute utilities with packages

Sridhar Ratnakumar sridhar.ratna at gmail.com
Sun Mar 27 19:01:55 EDT 2011


On Sunday, March 27, 2011 at 1:05 PM, Laszlo Nagy wrote:
I'd like to distribute a pure Python package named "foo". By default it 
> will be placed in lib/site-packages/foo. What if I want to add 
> utilities? Command line or GUI programs that are not full featured 
> applications, but they can be handy for some tasks that are related to 
> the package. Here is what I see:
> 
> * Python places them under "tools" in the Python installation dir (under 
> windows). I'm not sure about Unix.
> 
> Other variants:
> 
> * site-packages/foo/scripts (example: win32)
> * site-packages/foo/util (example: vtk)
> * directory site-packages/foo/tools (example: numpy)
None of the above are standard practices, as far as I know. 
> Is there a PEP number / standard way for this?
No PEP, but - yes - there is a conventional, if not standard, way to do this. It's called "entry points" (part of setuptools or Distribute).

Documentation: http://packages.python.org/distribute/setuptools.html#automatic-script-creation

Example: https://github.com/ActiveState/pythonselect/blob/master/setup.py#L49

Users of your package will need to have Distribute installed, which is available in ActivePython (all platforms), OSX and almost all of the Linux distributions.

-srid





More information about the Python-list mailing list