Possible to ignore a file with sphinx-gallery?
See original GitHub issueI’m trying to get SG set up with a project that needs an __init__.py
file inside of the examples folder. This is giving sphinx-gallery issues because if there’s no docstring it will error, and if I add a docstring then I get an empty image in the gallery for the init file. Is there a way to tell SG to totally ignore a file (e.g., with a regex or something?)
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (18 by maintainers)
Top Results From Across the Web
Configuration — Sphinx-Gallery 0.11.1-git documentation
Configuration and customization of Sphinx-Gallery is done primarily with a dictionary specified in your conf.py file. A list of the possible keys are...
Read more >Configuration - Sphinx documentation
'library/xml*' – ignores all files and directories starting with library/xml. '**/.svn' – ignores all .svn directories.
Read more >gallery - Jupyter Notebook - MyBinder
However, you can also create your own CSS styles if you prefer (then you don't need to install Sphinx-Gallery). You can load your...
Read more >Writing documentation — Matplotlib 2.2.5 documentation
Don't directly edit the .rst files in docs/gallery and ... The configuration file for Sphinx is doc/conf.py . ... Some possible uses:.
Read more >python - Can sphinx link to documents that are not located in ...
It the README has images or similar that have relative paths that aren't valid within the directory index.rst is in, how do you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am in favour of allowing to ignore completely a file based on a regex (based on
re.search
applied to the full absolute path). It does not seem too hard to do, I am guessing we can just skip files when we walk the examples folders. I may even be in favour of skipping__init__.py
files by default.@nicain if you just want to run the examples in the CI, you just need to do something like:
You will get a non-zero exit code if at least one of the example does not run so your CI will fail. Look at https://github.com/sphinx-gallery/sphinx-gallery/blob/master/.travis.yml for how we do it in sphinx-gallery. This is how examples are tested in all the sphinx-gallery usages I know of, scikit-learn, mne-python, matplotlib, etc …
@choldgraf it would make sense to have an additional variable to completely exclude files from the gallery. I would not say this is very high priority though. I don’t see a good reason what you gain from having the examples inside the package. In particular it feels like
from mypackage.examples.some_example import plot_example; plot_example()
is kind of the same asipython mypackage/examples/some_example.py
. Do you have a link for the project you are mentioning out of curiosity?