On May 7, 2009, at 10:20 AM, Tres Seaver wrote:

-----BEGIN PGP SIGNED MESSAGE-----
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.hellm...@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.

pip installs my scripts into a virtualenv without any issue and without using entry points, AFAICT.

I guess if we move to requiring entry points and disallowing simple script distribution I'll need to find another way to package virtualenvwrapper. Since it's a bash script, it doesn't have entry points. I've been using setuptools to package it so it can be installed via easy_install, since it is a Python development tool.

Doug

_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to