Title: [Bug]: Nondeterminism in SVG clipPath element id attributes · Issue #27831 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Nondeterminism in SVG clipPath element id attributes · Issue #27831 · matplotlib/matplotlib
X Title: [Bug]: Nondeterminism in SVG clipPath element id attributes · Issue #27831 · matplotlib/matplotlib
Description: Bug summary Hello - I'm trying to make the astroplan documentation build reproducibly in Debian, and have found a snag: despite configuring the svg.hashsalt to successfully make path identifiers in some SVG plots generated by matplotlib ...
Open Graph Description: Bug summary Hello - I'm trying to make the astroplan documentation build reproducibly in Debian, and have found a snag: despite configuring the svg.hashsalt to successfully make path identifiers in...
X Description: Bug summary Hello - I'm trying to make the astroplan documentation build reproducibly in Debian, and have found a snag: despite configuring the svg.hashsalt to successfully make path identifier...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/27831
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Nondeterminism in SVG clipPath element id attributes","articleBody":"### Bug summary\r\n\r\nHello - I'm trying to make the [`astroplan`](https://github.com/astropy/astroplan) documentation build [reproducibly](https://reproducible-builds.org/) in Debian, and have found a snag: despite configuring the [`svg.hashsalt`](https://matplotlib.org/stable/users/explain/customizing.html?highlight=svg.hashsalt#matplotlibrc-sample) to successfully make `path` identifiers in some SVG plots generated by `matplotlib` deterministic, there is a remaining problem that `clipPath` identifiers are nondeterministic.\r\n\r\nThe cause appears to be the use of Python object ID (via [`id(...)` calls here](https://github.com/matplotlib/matplotlib/blob/c23ccdde6f0f8c071b09a88770e24452f2859e99/lib/matplotlib/backends/backend_svg.py#L622)) when [generating `clippath` IDs](https://github.com/matplotlib/matplotlib/blob/c23ccdde6f0f8c071b09a88770e24452f2859e99/lib/matplotlib/backends/backend_svg.py#L631).\r\n\r\n### Code for reproduction\r\n\r\n```Python\r\nimport matplotlib as mpl\r\nimport matplotlib.pyplot as plt\r\nimport sys\r\n\r\nmpl.rcParams[\"svg.hashsalt\"] = \"fixed-salt\"\r\n\r\nfig = plt.gcf()\r\nfig.add_subplot(projection=\"polar\")\r\n\r\nplt.savefig(sys.stdout.buffer, format=\"svg\")\r\n```\r\n\r\n\r\n### Actual outcome\r\n\r\nDifferences appear in the `clipPath` identifiers and their references from elsewhere in the SVG output.\r\n\r\n### Expected outcome\r\n\r\nWhen an `svg.hashsalt` value is configured, the SVG output should be deterministic.\r\n\r\n### Additional information\r\n\r\nThis could arguably be an enhancement request rather than a bug.\r\n\r\nConfiguring a static `PYTHONHASHSEED` value does not help to produce deterministic results.\r\n\r\n### Operating system\r\n\r\nDebian GNU/Linux (trixie)\r\n\r\n### Matplotlib Version\r\n\r\n3.6.3\r\n\r\n### Matplotlib Backend\r\n\r\nTkAgg\r\n\r\n### Python version\r\n\r\nPython 3.11.8\r\n\r\n### Jupyter version\r\n\r\nN/A\r\n\r\n### Installation\r\n\r\nLinux package manager","author":{"url":"https://github.com/jayaddison","@type":"Person","name":"jayaddison"},"datePublished":"2024-02-28T11:45:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/27831/matplotlib/issues/27831"}
| 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:b319ba2a-d366-885b-518c-79c453fef797 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E476:2F0FE8:224C28F:2E292AF:6A5387D5 |
| html-safe-nonce | 5e70027d34b47c6917bcfb848e91ce2ed2c9b944a48edd026bb78b5908e2540d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDc2OjJGMEZFODoyMjRDMjhGOjJFMjkyQUY6NkE1Mzg3RDUiLCJ2aXNpdG9yX2lkIjoiNDk5NDkyOTI3NjMzODAxNDE2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6fb39b184cd988bd6e91f6a79fe3dc5173a756a14caa182df59d642506311d46 |
| hovercard-subject-tag | issue:2158772732 |
| 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/27831/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9eb831eab64643aef2369581b2e4f588511e1b4f34f75458da4434709912c684/matplotlib/matplotlib/issues/27831 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9eb831eab64643aef2369581b2e4f588511e1b4f34f75458da4434709912c684/matplotlib/matplotlib/issues/27831 |
| og:image:alt | Bug summary Hello - I'm trying to make the astroplan documentation build reproducibly in Debian, and have found a snag: despite configuring the svg.hashsalt to successfully make path identifiers in... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jayaddison |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width