[Distutils] Adding entry points into Distutils ?

Tres Seaver tseaver at palladion.com
Thu May 7 16:20:46 CEST 2009

Hash: SHA1

Eric Smith wrote:
> Doug Hellmann wrote:
>> On May 7, 2009, at 8:54 AM, Paul Moore wrote:
>>> 2009/5/7 Doug Hellmann <doug.hellmann at gmail.com>:
>>>> I would argue the other way.  Why force authors of console scripts to 
>>>> deal
>>>> with entry points instead of just installing the script as-is?
>>> Please explain "as-is" with reference to ensuring that the script
>>> works cross-platform. I think the benefit of entry points for scripts
>>> is that it generates appropriate wrappers to allow use on all
>>> platforms.
>> I write a python script call hello.py like this:
>>     #!/usr/bin/env python
>>     def main():
>>         print 'hello!'
>>     if __name__ == '__main__':
>>         main()
>> Why make me define an entry point for that?  I can just put it in 
>> /usr/bin or somewhere in the path on Windows and call it as "hello.py".
>> Does setuptools give me something extra for Windows?  I'm not a regular 
>> Windows user, so it's likely that there are features I don't know about.
> Yes. It creates a .exe wrapper [1]. By using entry points, I don't need 
> to care what the target system is. Also, /usr/bin/env might invoke the 
> wrong python.

Exactly:  using entry points for console scripts guarantees that the
python into which the corresponding distribution is installed is the one
used to run the script, which is *highly* desirable.  Otherwise, you end
up with the "just install everything in the system Python's
site-packages" mess.

- --
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Distutils-SIG mailing list