I have a Python package, felling which has a method:
from felling.src.email import send_email
Following from how Pandas handles imports such as pandas.DataFrame
in felling.__init__.py
I have:
# felling.__init__.py
from felling.src.email import send_email
Which allows someone to import felling.src.email.send_email
by using:
from felling import send_email
With this last import method being the main way I intend send_email
to be imported. Nobody ever runs from pandas.core.api import DataFrame
despite this being valid.
When documenting felling
with Sphinx it documents send_email
as felling.src.email.send_email
not felling.email
. I've read through Pandas docs and cannot figure how they get Sphinx to document pandas.core.api.DataFrame
as pandas.DataFrame
.
How can I do this?
Example .py
# felling.src.email
def send_email(to:str, subject:str):
"""
Send an email
Parameters
----------
to : str
Who should receive the email
subject : str
What should the emails subject be
"""
print(to)
print(subject)
Example .rst
felling methods
===============
A package for logging
felling.src.email
------------------------
.. automodule:: felling.src.email
:members:
:undoc-members:
:show-inheritance:
Felling's tree
├── README.md
├── __init__.py
├── __main__.py
├── resources
│ └── logger.json
├── src
│ ├── __init__.py
│ ├── compare_logs.py
│ ├── configure_felling.py
│ └── email.py
└── version.py