Skip to main content

Create composite namespace packages.

Project description

In a nutshell, 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"]

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:

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.

Project details

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
namespace-0.0.1.tar.gz (1.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page