Skip to content Skip to sidebar Skip to footer

Sphinx Docs / Rst Include File From Dynamic Path?

I'm wondering if it's possible to use a dynamic path in a Sphinx and/or RST ..include:: directive? My reason for this is I have some developer documentation generated by Sphinx in

Solution 1:

After playing with this more for a bit, I decided that creating a soft link is the way to go. (At first I was going to use a hard link, but creating that fails on Read The Docs. Soft link works on RTD and in Sphinx.)

So I have code in conf.py that walks the folder structure to find the other repo I need to include files from, then it creates the link (after first removing the old one and checking the version of the repo it found to make sure it's the right one). Then I just do the ..include:: with the soft link and everything is fine.

So overall not a bad solution, and most importantly it works locally and on RTD, and it works regardless of the location of the other repo.

Post a Comment for "Sphinx Docs / Rst Include File From Dynamic Path?"