Fix minigallery duplicates and add tests and update documenation#1435
Fix minigallery duplicates and add tests and update documenation#1435lucyleeow merged 12 commits intosphinx-gallery:masterfrom
Conversation
| app.connect("config-inited", post_configure_jupyterlite_sphinx, priority=900) | ||
|
|
||
| if "sphinx.ext.autodoc" in app.extensions: | ||
| app.connect("autodoc-process-docstring", touch_empty_backreferences) |
There was a problem hiding this comment.
Not sure about this @larsoner
Now that we don't use the '.examples' files this is not required for us. But is it possible some 3rd party relies on these empty '.examples' files (created for objects that are never used in any example)?!
There was a problem hiding this comment.
But is it possible some 3rd party relies on these empty '.examples' files (created for objects that are never used in any example)?!
Yeah it probably is, otherwise Sphinx will complain about .. include:: files that are missing
There was a problem hiding this comment.
Alright i will add this back in!
|
Doc build failing due to #1436 |
larsoner
left a comment
There was a problem hiding this comment.
FYI pushed a commit to try to fix CircleCI but it failed, I'll see if I can push another one to fix it
| app.connect("config-inited", post_configure_jupyterlite_sphinx, priority=900) | ||
|
|
||
| if "sphinx.ext.autodoc" in app.extensions: | ||
| app.connect("autodoc-process-docstring", touch_empty_backreferences) |
There was a problem hiding this comment.
But is it possible some 3rd party relies on these empty '.examples' files (created for objects that are never used in any example)?!
Yeah it probably is, otherwise Sphinx will complain about .. include:: files that are missing
|
Okay the remaining CircleCI failure is just from the |
…y into minigal_followup
|
Alright this is green and I'm merging 🤞 Thanks for the review and fixing the CI @larsoner ! |
|
@ogrisel I built the docs locally and checked the duplication is fixed in But best not to trust me and check yourself as well (is there a CI job that uses SG dev?), before I make a new release! Thank you! cc @glemaitre |
|
Feel free to open a draft PR on the scikit learn repo to test the dev version of sg and use the |
|
But since it works locally, i would just trust you instead ;) |
|
It looks fixed: scikit-learn/scikit-learn#30820 |
|
Nice. Thank you very much for that fix. |
|
And thanks for the release |

Follow up to #1430. A few things happening in this PR (sorry!)
Fixes duplicates between object and file inputs
In #1430 the dict key used for objects was
Path(target_dir, filename), whereas the dict key used for file inputs wasPath(src_dir, filename). Thus, files selected via both object and file path would be duplicated.There were two ways I could have fixed this:
target_dir- we would have needed to get thetarget_diranyway to get the thumbnail and it may have been better to raise an error earlier if input path is not in anexamples_dir(done in_get_target_dir) BUT we probably want to sort onPath(src_dir, filename)as it's probably easier for users vsPath(target_dir, filename)src_dirmeaning I write BOTHtarget_dirandsrc_dirtobackreferences_all.json- probably 'safest' as we knowsrc_dirandtarget_dirand do not have to do any complex ambiguity checking (as we do in_get_target_dir) but probably a bit much more expensive?I went with the latter option.
Tests
test_gen_gallery.py- I've had to amendsphinx_gallery/tests/testconfs/src/plot_1.pyto use a SG function, so I can test an object backreference inputtest_full.pyviaminigallery.rst_combine_backreferences,_read_json,_write_json)Docs
backreferences_all.jsonfile and updated to say '.examples' files to be for backward compatibility only