[Python-ideas] "Regular" namespace packages

Eugene Toder eltoder at gmail.com
Tue Mar 10 19:00:23 CET 2015


On Tue, Mar 10, 2015 at 1:20 PM, Dmitry Malinovsky <
dmalinovsky at thumbtack.net> wrote:

> Thank you, Guido, however the whole idea is to avoid modifying "first"
> package, so the "first" package author can freely leave his "first"
> namespace for extensions developers without even knowing that such
> extensions exist.
>
The simplest solution is probably to make the installation process of
package "second" to install itself in the directory of "first", or make a
symlink, e.g.:

first/first/__init__.py
first/first/second --> second/first/second # added by package second
second/first/second/__init__.py

Alternatively, you can add "second" to the package __path__ as Guido
pointed above via .pth file[1], to avoid changing anything in the "first"
package.

[1] https://docs.python.org/3.4/library/site.html, especially the part
about lines starting with "import"

Eugene
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150310/86a45480/attachment-0001.html>


More information about the Python-ideas mailing list