I’ve been struggling to get a pip install -e .
to work for this scenario with namespace packages … and realizing that maybe it’s just not a supported use case. Can someone clarify?
In plain language, basically trying to put modules for the same logical package at different directory paths in a single source repo. See below.
Most examples that I’ve seen for packaging up things with namespace packages I think assumes that the packages live in different source roots. Or that each incarnation of the namespace package has its own pip distribution being created. In both of those cases, that would lead to two different setup.py
files that are packaging different “parts” that happen to want their code namespaced in the same packages.
The net-net of what happens is that if I use the structure below and try to pip install -e .
the package for local development is that the .../site-packages/easy-install.pth
file only has an entry for /project/repo
, since that’s where the setup.py
lived and that’s where you told pip the code was (with .
).
So specific questions:
1. Can the same directory representing a namespace show up in different paths of a single project?
2. If so, can there be a single setup.py
at the root of a project that packags the whole project, and accounts correctly for the namespace package incarnations?
3. If so, how do the package_dir
and packages
values get set in setuptools.setup(...)
in that setup.py
?
/project/repo
├── libs
│ ├── my_namespace_pkg
│ │ ├── foo
│ │ │ ├── foo_module.py
│ │ │ └── __init_.py
│ │ └── bar
│ │ ├── bar_module.py
│ │ └── __init_.py
├── src
│ └── my_namespace_pkg
│ ├── baz
│ │ ├── baz_module.py
│ │ └── __init_.py
│ └── qux
│ ├── qux_module.py
│ └── __init_.py
└── setup.py