[Distutils] Adding entry points into Distutils ?

Eric Smith eric at trueblade.com
Thu May 7 16:15:19 CEST 2009

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.

>> [1] And note especially that .bat files are *not* suitable wrappers on
>> Windows, in spite of the fact that they are commonly used. Their
>> biggest disadvantage is that they don't nest.

Which is why it creates .exe wrappers, not batch files.

[1] http://peak.telecommunity.com/DevCenter/EasyInstall

More information about the Distutils-SIG mailing list