Suppose I have a project with the following structure:
mypackage
├── mypackage
│ ├── __init__.py
│ ├── someclass.py
│ └── somefunction.py
└── setup.py
Then I have __init__.py
as:
from mypackage.someclass import someclass
from mypackage.somefunction import somefunction
And someclass.py
as:
class Someclass:
...
And somefunction.py
as:
def somefunction:
...
It's not possible to "hide" mypackage.someclass.Someclass
and mypackage.somefunction.somefunction
from users so only mypackage.Someclass
and mypackage.somefunction
are available, right?
But the thing is that Sphinx is actually documentating mypackage.someclass.Someclass
and mypackage.somefunction.somefunction
instead of mypackage.Someclass
and mypackage.somefunction
.
And in the case of mypackage.somefunction.somefunction
, it's not even accessible if I import mypackage
, which is pretty bad.
So, is it possible to have Sphinx document mypackage.Someclass
and mypackage.somefunction
? According to what I read on other answers this might be done by editing __module__
or using autoclass
, but I wasn't able to archieve this right now