-
Notifications
You must be signed in to change notification settings - Fork 210
Description
First of all, many thanks to the developers for this great project!
I'm currently trying to use sphinx-gallery for the examples gallery of scikit-image (http://scikit-image.org/docs/dev/auto_examples/), so that scikit-image can benefit from the developments made in sphinx-gallery in the future.
However, I'm facing some problems with relative paths (that I detail below), and I'm wondering if some developers/users have already successfully used sphinx-gallery for projects that have a separate source directory (when you answer "yes" to the following question in sphinx-quickstart
" > Separate source and build directories (y/n) [n]: y")
I tried to reproduce the problem with a simple example, generated with sphinx-quickstart. I have this doc directory with the following structure
.>>> tree
├── build
├── make.bat
├── Makefile
└── source
├── conf.py
├── conf.py~
├── examples
│ ├── plot_adapt_rgb.py
│ └── README.txt
├── index.rst
├── _static
└── _templates
And when I run make html, the following structure is generated (clipping some lines)
├── build
│ ├── doctrees
│ │ ├── auto_examples
│ │ │ ├── index.doctree
│ │ │ └── plot_adapt_rgb.doctree
│ │ ├── environment.pickle
│ │ └── index.doctree
│ └── html
│ ├── auto_examples
│ │ ├── index.html
│ │ └── plot_adapt_rgb.html
│ ├── _downloads
│ │ ├── plot_adapt_rgb.ipynb
│ │ └── plot_adapt_rgb.py
│ ├── genindex.html
│ ├── index.html
│ ├── objects.inv
│ ├── search.html
│ ├── searchindex.js
│ ├── _sources
│ │ ├── auto_examples
│ │ │ ├── index.txt
│ │ │ └── plot_adapt_rgb.txt
│ │ └── index.txt
│
├── make.bat
├── Makefile
└── source
├── auto_examples
│ ├── images
│ │ ├── sphx_glr_plot_adapt_rgb_001.png
│ │ ├── sphx_glr_plot_adapt_rgb_002.png
│ │ └── thumb
│ │ └── sphx_glr_plot_adapt_rgb_thumb.png
│ ├── index.rst
│ ├── plot_adapt_rgb_codeobj.pickle
│ ├── plot_adapt_rgb.ipynb
│ ├── plot_adapt_rgb.py
│ ├── plot_adapt_rgb.py.md5
│ └── plot_adapt_rgb.rst
├── conf.py
├── conf.py~
├── examples
│ ├── plot_adapt_rgb.py
│ └── README.txt
├── index.rst
├── _static
└── _templates
Images don't get copied because the path in plot_adapt_rgb.rst does not exist
.. image:: /../doc/source/auto_examples/images/sphx_glr_plot_adapt_rgb_001.png
:scale: 47
(sphinx complains about it during the build).
I think the problem comes from this line of code in gen_gallery.py
gallery_dir = os.path.relpath(gallery_dir, app.builder.srcdir)
This issue seems to be related to #50. In #50 it was said that relative paths were not a priority at the moment. However, it seems that a large fraction of major scientific Python packages use a separate source directory: numpy, scipy, mayavi, pandas, ipython have a source directory, while matplotlib or scikit-learn don't.