[Python-ideas] PEP 420: implicit namespace sub-package
Gallian Colombeau
gcolombeau at hiphen-plant.com
Mon Aug 27 09:49:20 EDT 2018
Hello,
the PEP 420 (Implicit Namespace Packages) is quite descriptive about the
problem and the solution implemented back in Python 3.3 but I feel there
may be a part missing (but maybe this is categorized as an
implementation detail).
As I understand, for a package to allow being extended in this way, it
must be a namespace package and not contain a marker file. As a matter
of fact, no sub-package until the top level package can have a marker file:
Lib/test/namespace_pkgs
project1
parent
child
one.py
project2
parent
child
two.py
However, what is not discussed is "implicit namespace sub-package". In
Python 3.6 (I guess since the first implementation), if you have this
layout:
Lib/test/namespace_pkgs
project1
parent # Regular package
__init__.py
child # Namespace package
one.py
you get "parent" as a regular package and "parent.child" as a namespace
package and it works (although now, every package data directory became
namespace packages and are importable, which may or may not be
desirable). The point is, does that add any value? I wasn't able to find
any discussion about this and, as far as I can see, there is actually no
use case for this as there is no possible way to contribute to the
"parent.child" namespace. Is that an intended behavior of PEP 420?
Again, I may have missed something or misinterpreted PEP 420 but this
contributes to the "Implicit package directories introduce ambiguity
into file system layouts." point by Nick Coghlan that was supposed to be
addressed in PEP 395.
Wouldn't it be more appropriate to enforce a sub-package to be a regular
package if the parent package is a regular package?
Gallian
--
*Gallian Colombeau *
*Software engineer *
hiphen-plant-logo <http://www.hiphen-plant.com>
*Centre INRA PACA - UMR EMMAH*
/228, route de l'aérodrome - CS 40509
84914 Avignon - Cedex 9 - France /
www.hiphen-plant.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180827/54599ab3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logo-hiphen-baseline-rvb-taille-2.jpg
Type: image/jpeg
Size: 66821 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180827/54599ab3/attachment-0001.jpg>
More information about the Python-ideas
mailing list