readthedocs.org: sphinx.ext.viewcode source links missing
I have the problem that sphinx.ext.viewcode
sourcelinks show up in my local build (using the readthedocs theme) but not on readthedocs builds.
I am not sure if this is a bug report or a question, but I really am running out of ideas what I could be doing wrong. I am a new user of readthedocs so I might be missing something obvious, but there are other bug reports about this (1, 2) and google does not come up with much help either.
source: https://github.com/obestwalter/mau-mau (conf.py)
readthedocs project: http://readthedocs.org/projects/mau-mau/
build (from same code version where it works locally): https://readthedocs.org/projects/mau-mau/builds/3905985/
example (of not working on readthedocs): http://mau-mau.readthedocs.org/en/doc-with-sphinx/code/mau_mau/#submodules
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 2
- Comments: 19 (7 by maintainers)
That is it! since my package has the source explicitely in a source folder, I had to update conf.py with the magic redirect
sys.path.insert(0, os.path.abspath('../src'))
out package contains
./src
and./docs
with./docs/conf.py
(see https://github.com/schubergphilis/data-migrator/)OK, I see that now. There must have been some caching because it wasn’t there before, meaning I’m not sure which thing finally fixed it. (I’ve just realised there is a revision number at the bottom of the docs pages which helps check whether you’ve got the latest version!).
In this case, I think the fixes must have been:
.readthedocs.yml
file that enabled Python 3 (without which I’m probably getting import errors, since this project is Python 3 only)sys.path.insert
hack explicitly in the docs/conf.py. My project is different from the one you linked in that the source lives inproject_root/src
, notproject_root
, which could be the difference here.In addition, I’ve just tried with another project, which has dependencies that need to be installed for the code to be importable. For this case, I also needed to add a
.readthedocs.yml
file with:Thanks for your help, hope this helps other people!
Hello,
I also had this problem and the source code and links started appearing after I added my
src
directory (which contains the directory for the package i’m documenting) tosys.path
.Before that, source links did not appear even though I was building with virtualenv and
autodoc
worked just fine.Sorry, I got confused. I built mau-mau and zarr in my own computer and I was able to see what you mean. I have a
[source]
link that works properly and goes to the code.I’m not sure why this is happening in RTD and I think we will need to research a little. If you have any suggestion or possible cause, I would appreciate.
I’m marking this as a Bug at the moment.