From 661887ade70fdf9982f9314318f8bc4919fad258 Mon Sep 17 00:00:00 2001 From: "Eric V. Smith" Date: Fri, 20 Apr 2012 06:20:24 -0400 Subject: [PATCH] Another improvement by Nick: a better description of splitting portions among multiple directories. --- pep-0420.txt | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/pep-0420.txt b/pep-0420.txt index 7b0bf6656..364256c24 100644 --- a/pep-0420.txt +++ b/pep-0420.txt @@ -84,19 +84,20 @@ doesn't. Likewise, setuptools supports inspecting zip files, and supports adding portions to its _namespace_packages variable, whereas pkgutil doesn't. -Namespace packages need to be installed in one of two ways: either all -portions of a namespace will be combined into a single directory (and -therefore a single entry in sys.path), or each portion will be -installed in its own directory (and each portion will have a distinct -sys.path entry). - -The current imperative approach causes problems for system vendors. -Vendor packages typically must not provide overlapping files, and an -attempt to install a vendor package that has a file already on disk -will fail or cause unpredictable behavior. As vendors might choose to -package distributions such that they will end up all in a single -directory for the namespace package, all portions would contribute -conflicting __init__.py files. +Namespace packages are designed to support being split across multiple +directories (and hence found via multiple sys.path entries). In this +configuration, it doesn't matter if multiple portions all provide an +``__init__.py`` file, so long as each portion correctly initializes +the namespace package. However, Linux distribution vendors (amongst +others) prefer to combine the separate portions and install them all +into the *same* filesystem directory. This creates a potential for +conflict, as the portions are now attempting to provide the *same* +file on the target system - something that is not allowed by many +package managers. Allowing implicit namespace packages means that the +requirement to provide an ``__init__.py`` file can be dropped +completely, and affected portions can be installed into a common +directory or split across multiple directories as distributions see +fit. Specification =============