title: Sphinx docs / RST include file from dynamic path?
body: <p>I'm wondering if it's possible to use a dynamic path in a Sphinx and/or RST <code>..include::</code> directive?</p>
  
  <p>My reason for this is I have some developer documentation generated by Sphinx in one repo, but we have a bunch of unit tests in another repo that we want to include in the docs. If I know the path to the file in the other repo, it's pretty standard, like this:</p>
  
  <pre><code>Some text in my RST file
  
  .. include:: ../path/to/other/repo/file.py
  :code: python
  
  Some more text
  </code></pre>
  
  <p>The problem is the relative path to the other repo is not always the same, depending on how things are cloned and installed. For example, on Read The Docs, the other repo is installed in editable mode via <code>requirements.txt</code> into a <code>/src</code> subfolder, locally the repo is in a git folder, etc.</p>
  
  <p>I can add logic into the <code>conf.py</code> file to find the other repo and set a pointer which I can use in the RST files, but I can't figure out if it's possible to have a dynamic path in the <code>..include::</code>?</p>
  
  <p>So far the only workaround I can think of is to have my <code>conf.py</code> find the other repo and create a symlink which I reference in the RST files, which is fine, but I wonder if there's a better way?</p>