Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable matplotlib and plotly in examples #567

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

jorgepiloto
Copy link
Member

@jorgepiloto jorgepiloto commented Oct 23, 2024

This pull-request fixes #301 by ensuring plotly is supported in our theme. Matplotlib support is explored too.

Screenshot 2024-10-25 at 14-25-39 Sphinx-Gallery — Ansys Sphinx Theme

@jorgepiloto jorgepiloto requested a review from a team as a code owner October 23, 2024 13:37
@jorgepiloto jorgepiloto added this to the v1.2 milestone Oct 23, 2024
@github-actions github-actions bot added the enhancement General improvements to existing features label Oct 23, 2024
@jorgepiloto jorgepiloto changed the title feat: enable matplotlib adn plotly in examples feat: enable matplotlib and plotly in examples Oct 23, 2024
doc/source/conf.py Outdated Show resolved Hide resolved
@github-actions github-actions bot added the maintenance Generic maintenance related label Oct 25, 2024
@jorgepiloto
Copy link
Member Author

Plotly and matplotlib are supported. Main issue here is that the different extensions are getting in conflict because "sphinx-gallery" generates a bunch of files. Still working on it.

doc/source/conf.py Outdated Show resolved Hide resolved


def revert_gallery_patterns(app, builder):
"""Revert the gallery excluded patterns."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me might give more explanations here for this revert.

def revert_gallery_patterns(app, builder):
"""Revert the gallery excluded patterns."""
excluded_gallery_pattern = app.config.exclude_patterns
excluded_gallery_pattern.remove("examples/gallery-examples/*.ipynb")
Copy link
Contributor

@MaxJPRey MaxJPRey Oct 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if gallery-examplesdo not exist?
Are we handling the ValueError that will be raised later?

doc/source/conf.py Outdated Show resolved Hide resolved
# Remove the "Download all examples" button from the top level gallery
"download_all_examples": False,
# Modules for which function level galleries are created. In
"image_scrapers": ("pyvista", "matplotlib"),
"image_scrapers": ("pyvista", "matplotlib", plotly_sg_scraper),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this one.

Comment on lines 305 to 314
def revert_exclude_patterns(app, env):
"""Revert the exclude patterns."""
excluded_pattern = env.config.exclude_patterns
excluded_pattern.remove("examples/gallery-examples/*.ipynb")
env.config.exclude_patterns = excluded_pattern


def setup(app: Sphinx) -> Dict:
"""Sphinx hooks to add to the setup."""
app.connect("env-updated", revert_exclude_patterns)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice hack, @Revathyvenugopal162!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add some information about it. Whether it is a docstring or similar.

@Revathyvenugopal162 Revathyvenugopal162 modified the milestones: v1.2, v1.3 Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement General improvements to existing features maintenance Generic maintenance related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request: Plotly support in gallery examples
4 participants