[Import-SIG] Is ".ns" really the right extension?

P.J. Eby pje at telecommunity.com
Sat Jul 9 23:20:30 CEST 2011


Looking over the example code I added to the PEP draft (based on 
Barry's suggestion), it occurs to me that, like his example, mine is 
still confusing.

And, now that I look more closely at it, I see that the confusion in 
large part comes from the idea of naming something "ThisPart.ns" -- 
it implies that "ThisPart" is the namespace!

And it's not a namespace at all.  It's really a portion of the namespace.

It seems to me that what the actual meaning of a foo.ns file is, "The 
'foo' portion of the this namespace is installed here".  And that 
thus, foo.portion or foo.part or foo.contribution something like that 
would be more appropriate, given the PEP terminology.

I think that a change is needed here to make the PEP's narrative come 
together more cleanly.  I'm leaning towards calling them foo.contrib 
files, as in "The 'foo' distribution contributed to this portion of 
the enclosing package."

(Among other things, this makes the need for repeated files clearer; 
i.e., you add a contribution marker to each package directory you're 
putting files or subdirectories into.)

Overall, the narrative can then lose the constant references to *.ns 
files and instead talk about contribution markers -- i.e. a namespace 
package portion is a directory containing one or more contribution 
markers.  I think this will be clearer than the current text, and in 
particular it should make the example directory layout more meaningful to read.

Notice, too, that Eric Snow's confusion about how .ns files work 
seems to have been influenced by the terminology -- i.e., the 
expectation that a 'zope.ns' file was talking about a 'zope' 
namespace package and identifying the containing directory as part of 
the namespace, rather than the other way around.  Was that the case, 
Eric?  And if so, do you think that these layouts are any clearer?


     ProxyTypes-0.9.tgz:
         peak/
             ProxyTypes.contrib <- marks this as a namespace package portion
             util/
                 ProxyTypes.contrib   <- same for 'peak.util'
                 proxies.py

     Importing-1.10.tgz:
         peak/
             Importing.contrib   <- marks this as a namespace package portion
             util/
                 Importing.contrib   <- same for 'peak.util'
                 imports.py


     site-packages/   (or wherever)
         peak/
             Importing.contrib
             ProxyTypes.contrib   <- both distributions' 
contributions are merged
             util/
                 Importing.contrib   <- at both levels
                 ProxyTypes.contrib
                 imports.py
                 proxies.py

Any other thoughts?



More information about the Import-SIG mailing list