Re: [Distutils] easy_install ./mymodule.py
At 11:11 PM 3/12/2006 +0200, Ville Vainio wrote:
I can't remember whether this has been discussed previously, but I'd like to see the ability to quickly install simple python modules globally, with the usage of
easy_install ./mymodule.py
or even
easy_install http://somesite.com/mymodule.py
If you do this: easy_install "http://somesite.com/mymodule.py#egg=MyProject-0.1" EasyInstall will treat the .py file as being an egg named MyProject, with a version number of 0.1. This should also work with file: URLs, and can also be used as links in a download page or --find-links option. EasyInstall automatically generates a setup.py to go with the .py file, and runs it to create the egg which it then installs.
Additionally, it would be groovy to be able to specify the entry points in .py files, a'la
# setuptools_entrypoint = myscript:main
def main(): """ will be called by 'myscript' script."""
That won't work, but it's possible I could have it look for an assignment like this: __setuptools_entry_points__ = """ [console_scripts] foo = mymodule:main """ On the other hand, this seems like a path to diminishing returns. You might as well start using a setup.py if you need entry points.
On 3/13/06, Phillip J. Eby <pje@telecommunity.com> wrote:
If you do this:
easy_install "http://somesite.com/mymodule.py#egg=MyProject-0.1"
EasyInstall will treat the .py file as being an egg named MyProject, with a version number of 0.1.
Ok, thanks for the pointer. However, would it perhaps make sense to have the option of automatically generating the egg name from the module name (and using the name 'Mymodule", for example).
That won't work, but it's possible I could have it look for an assignment like this:
__setuptools_entry_points__ = """ [console_scripts] foo = mymodule:main """
On the other hand, this seems like a path to diminishing returns. You might as well start using a setup.py if you need entry points.
I'm thinking of the extreme "scaling down" scenario here, shipping only a single .py file (a "script"). When you have a setup.py script you need to bundle it with the module. When in the past you had a directory full of .py scripts that you added to PATH, now you could just go there and do easy_install *.py. -- Ville Vainio - vivainio.googlepages.com vainio.blogspot.com - g[mail | talk]='vivainio'
Ville Vainio wrote:
On 3/13/06, Phillip J. Eby <pje@telecommunity.com> wrote:
If you do this:
easy_install "http://somesite.com/mymodule.py#egg=MyProject-0.1"
EasyInstall will treat the .py file as being an egg named MyProject, with a version number of 0.1.
Ok, thanks for the pointer. However, would it perhaps make sense to have the option of automatically generating the egg name from the module name (and using the name 'Mymodule", for example).
It looks like setuptools determines the name of the file from the URL. I use a Python CGI to serve my files for download. This means that anyone attempting : easy_install "http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?file=configobj.py" Gets an egg containing 'downman.py'. The CGI does send the correct http header containing the filename : Content-Type: application/octet-stream Content-Disposition: attachment; filename= "%s" Content-Length: %s Shouldn't setuptools honour the "Content-Disposition" header ? All the best, Michael Foord http://www.voidspace.org.uk/python/index.shtml
At 09:21 AM 3/13/2006 +0000, Fuzzyman wrote:
Ville Vainio wrote:
On 3/13/06, Phillip J. Eby <mailto:pje@telecommunity.com><pje@telecommunity.com> wrote:
If you do this:
easy_install "http://somesite.com/mymodule.py#egg=MyProject-0.1"
EasyInstall will treat the .py file as being an egg named MyProject, with a version number of 0.1.
Ok, thanks for the pointer. However, would it perhaps make sense to have the option of automatically generating the egg name from the module name (and using the name 'Mymodule", for example).
It looks like setuptools determines the name of the file from the URL.
I use a Python CGI to serve my files for download. This means that anyone attempting :
easy_install "http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?file=configobj.py"
Gets an egg containing 'downman.py'. The CGI does send the correct http header containing the filename :
Content-Type: application/octet-stream Content-Disposition: attachment; filename= "%s" Content-Length: %s
Shouldn't setuptools honour the "Content-Disposition" header ?
EasyInstall has to determine the project name and version from the URL, because otherwise it has no way to know *which* URL to download (in the case where it's scanning pages for links. If you need it to deal with URLs like the one you gave above, you'll need to use the "#egg=Projectname-Version" suffix on the URL. Now, if you mean that when you *do* use that approach, you end up with the wrong filename for the .py, I suppose you have a point. OTOH, why not just change your downman.py to use PATH_INFO? e.g.: http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py/configobj.py I don't process Content-Disposition because currently the choice of filename has to be fixed before the download begins. Changing it would only be useful for the "single .py file" case, because in all other situations the downloaded filename doesn't matter; only the info that was gotten from the URL. But it seems odd to support weird download options for single .py files; why not just put the file directly on the server and be done with it?
participants (3)
-
Fuzzyman -
Phillip J. Eby -
Ville Vainio