This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Paul J. Davis (author)
Sat Jul 04 19:43:22 -0700 2009
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sat Jul 04 19:19:47 -0700 2009 | |
| |
MANIFEST | Sat Jul 04 19:19:47 -0700 2009 | |
| |
README.md | Sat Jul 04 19:26:54 -0700 2009 | |
| |
namespace.py | Sat Jul 04 19:43:22 -0700 2009 | |
| |
setup.py | Sat Jul 04 19:42:25 -0700 2009 |
README.md
namespace.py
In a nutshell, namespace.py allows you to create composite namespace packages without altering any submodule.
>>> import namespace
>>> ns = namespace.Namespace()
>>> ns.proxy("ns.path", "os.path")
>>> import ns.path
>>> import sys
>>> ns.path == sys.modules["os.path"]
True
The general idea here is that you'd create a PyPI package for the namespace and then attach the individual subpackages to the namespace. Something like:
# mynamespace.py
import namespace
ns = namespace.Namespace()
ns.proxy("mynamespace.web", "django")
And then client packages could use this namespace package as:
import mynamespace.web.forms as forms
That's perhaps not the best example, but hopefully it gets the idea across.
Other caveats is that this doesn't allow for magical addition to the namespace if a package elects to be in it. I'm not feeling creative enough to think of a good solution to this. I'm pretty sure it could be done with a hook in setuptools though.







