Title: [Bug]: Plot directive clutters the output directory with unneeded files · Issue #24005 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Plot directive clutters the output directory with unneeded files · Issue #24005 · matplotlib/matplotlib
X Title: [Bug]: Plot directive clutters the output directory with unneeded files · Issue #24005 · matplotlib/matplotlib
Description: Bug summary Using the Matplotlib plot directive in Sphinx documentation results in cluttering the output directory with all the produced image files in all generated formats even when they are not needed (plot_html_show_formats = False)....
Open Graph Description: Bug summary Using the Matplotlib plot directive in Sphinx documentation results in cluttering the output directory with all the produced image files in all generated formats even when they are not ...
X Description: Bug summary Using the Matplotlib plot directive in Sphinx documentation results in cluttering the output directory with all the produced image files in all generated formats even when they are not ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/24005
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Plot directive clutters the output directory with unneeded files","articleBody":"### Bug summary\r\n\r\nUsing the Matplotlib plot directive in Sphinx documentation results in cluttering the output directory with all the produced image files in all generated formats even when they are not needed (``plot_html_show_formats = False``). This is especially obvious with the ``singlehtml`` builder, where all the necessary images must be inside the ``_images`` subdirectory, but in fact, in addition to ``_images``, the whole directory tree with every image in every format is copied to the output directory, although nothing of it is referenced from the HTML file.\r\n\r\nWhat is more interesting, if another builder is executed first, then its cached images are reused properly — only the necessary files are copied into ``_images``, without cluttering the output directory with unneeded files and subdirectories.\r\n\r\n\r\n### Code for reproduction\r\n\r\nSee a minimal working example at https://github.com/MikhailRyazanov/plot-clutter.\r\n\r\n\r\n### Actual outcome\r\n\r\nFrom step 1 of the example above:\r\n```\r\n$ tree build/singlehtml\r\nbuild/singlehtml\r\n├── _images\r\n│ ├── index-1.svg\r\n│ ├── other-1.svg\r\n│ └── script.svg\r\n├── index-1.pdf\r\n├── index-1.svg\r\n├── index.html\r\n├── objects.inv\r\n├── _static\r\n│ \u003cskipped\u003e\r\n└── subdir\r\n ├── other-1.pdf\r\n ├── other-1.svg\r\n ├── script.pdf\r\n └── script.svg\r\n```\r\n\r\n### Expected outcome\r\n\r\nFrom step 2 of the example above:\r\n```\r\nbuild/singlehtml\r\n├── _images\r\n│ ├── index-1.svg\r\n│ ├── other-1.svg\r\n│ └── script.svg\r\n├── index.html\r\n├── objects.inv\r\n└── _static\r\n \u003cskipped\u003e\r\n```\r\n\r\n### Additional information\r\n\r\nIn practice, this undesired behavior directly affects the downloadable documentation at Read the docs — see [issue #9068 there](https://github.com/readthedocs/readthedocs.org/issues/9068).\r\n\r\n\r\n### Operating system\r\n\r\n_No response_\r\n\r\n### Matplotlib Version\r\n\r\n3.5.2\r\n\r\n### Matplotlib Backend\r\n\r\n_No response_\r\n\r\n### Python version\r\n\r\n_No response_\r\n\r\n### Jupyter version\r\n\r\n_No response_\r\n\r\n### Installation\r\n\r\nLinux package manager","author":{"url":"https://github.com/MikhailRyazanov","@type":"Person","name":"MikhailRyazanov"},"datePublished":"2022-09-25T19:16:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/24005/matplotlib/issues/24005"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ad909bde-1ed0-60e0-4299-d64622935698 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B8C:233A54:110B:154A:6A525DEF |
| html-safe-nonce | 11958f2cc45c74738bdbbec346a92d3546527cd3989c6ad22fa7bcd7ca984502 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjhDOjIzM0E1NDoxMTBCOjE1NEE6NkE1MjVERUYiLCJ2aXNpdG9yX2lkIjoiNzIwNDkyNDQ2ODIyOTIwMTM5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | af21a9d0c55420afa3f736e3cbc012e453ed0e8e6f51665a0db9be73b538ead9 |
| hovercard-subject-tag | issue:1385133679 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/24005/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6fa1e04546e179fe2f280913a5a7ad1699268379dd6f8a908a5345728904bc2d/matplotlib/matplotlib/issues/24005 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6fa1e04546e179fe2f280913a5a7ad1699268379dd6f8a908a5345728904bc2d/matplotlib/matplotlib/issues/24005 |
| og:image:alt | Bug summary Using the Matplotlib plot directive in Sphinx documentation results in cluttering the output directory with all the produced image files in all generated formats even when they are not ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MikhailRyazanov |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width