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
Remove non-determinism #1694
Remove non-determinism #1694
Conversation
@@ -268,7 +268,8 @@ def prepare_writing(self, docnames): | |||
# html_domain_indices can be False/True or a list of index names | |||
indices_config = self.config.html_domain_indices | |||
if indices_config: | |||
for domain in itervalues(self.env.domains): | |||
for domain_name in sorted(self.env.domains.keys()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorted(self.env.domains)
should suffice.
Good idea, apart from removing non-determinism it also makes the repr's much more readable. |
e361416
to
b47a0b3
Compare
Updated. |
To enable packages using Sphinx to build reproducibly, its output needs to be the same from one build to another. Its output now strips memory references such as: <__main__.A at 0x7f68cb685710> In addition, various generated files (objects.inv, searchindex.js, translations) are now written with their keys in a determinstic order. Based on a patch by Chris Lamb <lamby@debian.org>.
LGTM, just waiting for the tests to complete. |
Thanks for merging and apologies for some of the—err—rough edges in the original patch. Mea culpa. On those lines, I think we are actually missing something. For example, take a look here:
... and grep for "genindex.html". Note that the command line option ordering is different (-q vs -Q). I had a quick glance at the Sphinx source to work out where this could be remedied but it was not immediately forthcoming.. More than happy to look further into this if nobody else immediately knows. |
Did anyone have any thoughts re. making the regex "safer"? I don't like how it's applied to every output of |
I think it is quite safe. We're not generating code here, so the very unlikely false positive will be much less important than the better readability for 99%+ of instances. |
If you wanted to limit it you could only apply |
See also <sphinx-doc#1694> Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
See also <sphinx-doc#1694> Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
To enable packages using Sphinx to build reproducibly, its output needs to be the same from one build to another.
Its output now strips memory references such as:
In addition, various generated files (objects.inv, searchindex.js, translations) are now written with their keys in a determinstic order.
Initial patch by @lamby, rebased against master by @mitya57.