I wonder if is there any reliable and consistant way to get a Python package's "import name" / namespace. For example;
Package; django-haystack
Import name; haystack
or
Package; ipython
Import name; IPython
So far I know, PyPi doesn't store that information that I've checked with PyPiXmlRpc.
I also tried to automate to download the package, extract it and dig the .egg-info but some packages doesn't have that folder at all.
Any help will be appreciated and will be used for a good-manner gadget :)
Note that what you call a package here is not a package but a distribution. A distribution can contain zero or more modules or packages. That means there is no one-to-one mapping of distributions to packages.
I'm not sure there is a way to detect what modules and packages will be installed by a distribution, other than actually installing it and introspect filesystem changes for newly added packages, modules and pth files.