Namespace packages

The Zen of Python, which you can read by writing import this in the interpreter session, says the following about namespaces:

Namespaces are one honking great idea—let's do more of those!

And this can be understood in at least two ways. The first is a namespace in the context of the language. We all use namespaces without even knowing:

  • The global namespace of a module
  • The local namespace of the function or method invocation
  • The built-in name's namespace

The other kind of namespaces can be provided at packaging levels. These are namespaced packages. This is often an overlooked feature that can be very useful in structuring the package ecosystem in your organization or in a very large project.

Why is it useful?

Namespace packages can ...

Get Expert Python Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.