At 02:58 PM 5/30/2005 -0500, Ian Bicking wrote:
Ian Bicking wrote:
Hmm... I think I got it wrong, this works fine. Maybe I was confusing this with a bug related to packages with spaces in their names. In particular, WSGIUtils: http://www.owlfish.com/software/wsgiutils/downloads/WSGI%20Utils-0.5.tar.gz I suspect this doesn't work because it creates an egg WSGI_Utils-0.5-py2.4.egg/, with a package name (in WSGI_Utils-0.5-py2.4.egg/EGG-INFO/PKG-INFO) of "WSGI Utils"
Hmm... maybe I'm just confused about how this stuff works. You don't require a Python package name, you require the more abstract name.
Right; you require() the distribution name. I should probably find some examples that clearly use the distribution name. Maybe wxPython would be good, since the distribution is wxPython, but the package is wx. So you "require('wxPython>=2.5')", for example. I'll try to update the docs to make this clearer. And maybe if you install in --multi-version mode or to an alternate directory, easy_install should spit out a couple of example require() spellings for you to use, maybe even copy and paste right into your code. Perhaps something like: """ Installed WSGI_Utils-0.5-py2.4.egg Because this distribution was installed --multi-version or --install-dir, before you can import modules from this package in an application, you will need to 'import pkg_resources' and then use a 'require()' call similar to one of these examples, in order to select the desired version: pkg_resources.require("WSGI-Utils==0.5") # this exact version pkg_resources.require("WSGI-Utils>=0.5") # this version or higher pkg_resources.require("WSGI-Utils") # latest installed version Note also that '/your/instdir/setting' must be on sys.path at runtime for this to work. (e.g. by being the application script directory, by being on PYTHONPATH, or by being added to sys.path by your code.) """ I'll look into about adding a post-install report with this information for multi-version and alternate-directory installs. (That last paragraph above about '/your/instdir/setting' would only appear for --install-dir installs, and would include the actual directory name.)
But case insensitive. So require("wsgi-utils") or require("WSGI_Utils") works, but require('wsgiutils') doesn't. Since require('sqlobject') worked (even though the package name is SQLObject) I had become confused by this.
Yeah, I really didn't want to make it possible to have 'SQLobject' and 'sqlobject' both exist as distributions (even though I believe PyPI currently allows that). It would be just too darn confusing to make a typo and end up with the entirely wrong product, once we have automatic package location via PyPI et al.