Reputation: 1452
is it possible for me to have 2 decoupled python packages where the first part of the namespace is identical:
pyPackageOne:
package_one
|
|-companyname
|
|-__init__py
|-moduleone
|
|-__init__.py
|-dostuff.py
pyPackageTwo:
package_two
|
|-companyname
|
|-__init__py
|-moduletwo
|
|-__init__.py
|-dothings.py
so companyname is a shared prefix in the name?
I want to be able to install and use both packages:
$ pip install moduleone
$ pip install moduletwo
>>> from companyname.moduleone import dostuff
>>> from companyname.moduletwo import dothings
I'm using python 3.6
Upvotes: 1
Views: 487
Reputation: 1452
as Pax0r said in his comment, my original structure works. see my minimal example:
https://github.com/omerholz/pymoduleone
https://github.com/omerholz/pymoduletwo
the place where this strategy fails is when I try to use one package inside another: for example if dothings.py
includes: from companyname.moduleone import dostuff
we'll get ModuleNotFoundError: No module named 'companyname.moduleone'
Upvotes: 1