I have a GitHub repo (here) which is extremely basic and only meant to reproduce a problem I had with another repo (CPU Health Checks also in my public repos)
It consists on a package called rtdtest which locally is a rtdtest/ folder with an empty __init__.py
. This file has two simple modules cpu_health.py and utilities.py where cpu_health.py imports utilities.py with the statement
import rtdtest.utilities as utilities
In this case making a package is not that necessary but in my "real" repo I need it to access modules in subfolders within the proyect's root folder
My problem is that even though I am able to produce the documentation I want locally with sphinx which includes DocString generated documentation created with automodule
statements in index.rst, when creating the documentation in Read The Docs the build passes but with warning messages
WARNING: autodoc: failed to import module 'cpu_health' from module 'rtdtest'; the following exception was raised: No module named 'rtdtest' WARNING: autodoc: failed to import module 'utilities' from module 'rtdtest'; the following exception was raised: No module named 'rtdtest'
Saying the modules from the package were not imported and suggesting to me that RTD is not recognizing rtdtest as a package but as a module (although I could be wrong there)
Locally the package is found with the line
sys.path.insert(0, os.path.abspath('../..'))
In file conf.py (conf.py is 2 folders ahead of the root folder of the project in docs/sphinx/)
My (minimalistic) configuration files requirements.txt, .readthedocs.yml, setup.py, docs/sphinx/conf.py, and docs/sphinx/requirements.txt are included in the GitHub repo (couldn't put specific links because stackoverflow called the message spam)
And my main documentation file is: index.rst
In the admin Advance Settings section of my repo I have checked the "Install Project" box to "Install your project inside a virtualenv using setup.py install" but I haven't checked other one. For documentation type I chose "Sphinx HTML"
I tried multiple times to edit my conf.py file to add folders to the path using sys.path.insert but no combination of current and parent folders worked.
I also tried replicating the solution proposed in this previous post who apparently had a very similar problem and was able to solve it, but even trying to mimic their configuration files didn't work
Does anyone now what might be the problem? I am sorry in advance if this is clearly stated in the RTD documentation but this is my first time using the tool and I couldn't find a solution there
Please let me know if there is any additional information I should provide to help solving the problem
Cheers and thanks Felipe