I have a package with the following structure
package/
│
└───__init__.py
│
└───sub/
└───__init__.py
│
└───XWrap.py # implements class X
└───YWrap.py # implements class Y
The first __init__.py
looks like this:
from . import sub
The second __init__.py
looks like this:
from .XWrap import X
from .YWrap import Y
Doing this, the user sees the following
package
│
└───sub
└───X
└───XWrap
└───Y
└───YWrap
I would like to have a cleaner interface where I don't see YWrap
and XWrap
. How can I achieve this?
This is the same question asked in a comment here: Python packages - import by class, not file but couldn't find a definite answer.