[Distutils] Adding entry points into Distutils ?

Wheat wheatix at gmail.com
Thu May 7 22:14:06 CEST 2009

> 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".

With an entry point, hello.py could simply be:

    def main():
            print 'hello!'

But I agree, the Distutils 'scripts' is conceptually simpler.
since it let's you run a script 'as-is' without first running an
tool to generate a script wrapper. It's only once a script has
on other Python libraries where relying on those libraries being
for import may not work. In this case, the 'scripts' field forces the
to install those libraries in a global location (site-packages), this
isn't always desirable though!

As for including BASH scripts in the 'scripts' field ... I dunno.
entry_points are meant to only annotate Python code! Is including BASH
scripts in the 'scripts' field an abuse of Distutils or is it
usage? The Distutils docs aren't explicit on this, so I'm inclined to
it's acceptable, so this is at least one good reason for keeping the
'scripts' field.

But then having both 'scripts' and 'entry_points/console_scripts' is
less than perfect since it introduces (mostly) unneccessary TIMTOWTDI.

More information about the Distutils-SIG mailing list