[Request for help] Making brian reproducible

Felix C. Stegerman flx at obfusk.net
Thu Jun 10 15:55:03 BST 2021


Hi!

* Nilesh Patra <nilesh at nileshpatra.info> [2021-06-07 21:16]:
> * Only _some_ files in the documentation it vendors has stuff (like tags, examples, links) in random order across different builds.
> By the looks of it, it seems this randomness is due to the way data is being inserted into files with the brian2/sphinxext/generate_examples.py script,
> but I am having trouble figuring it out beyond this point.
> 
> My changes are pushed here[1], the failing reprotest CI can be found here[2], and this is the diffoscope[3]
> 
> [1]: https://salsa.debian.org/med-team/brian/-/blob/make-reproducible
> [2]: https://salsa.debian.org/med-team/brian/-/jobs/1688958
> [3]: http://paste.debian.net/1200330/

I've briefly looked at the diffoscope output and the code.

One of the problems seems to be that auto_find_examples() from
brian2/sphinxext/examplefinder.py loops over the lists "tutorials" and
"examples", the order of which depends on the file system.

I haven't tested it, but I think this patch would help:

--- a/brian2/sphinxext/examplefinder.py
+++ b/brian2/sphinxext/examplefinder.py
@@ -54,9 +54,9 @@
     '''
     name = obj.__name__
     examples_map = get_examples_map()
-    examples = the_examples_map[name]
+    examples = sorted(the_examples_map[name])
     tutorials_map = get_tutorials_map()
-    tutorials = the_tutorials_map[name]
+    tutorials = sorted(the_tutorials_map[name])
     if len(examples+tutorials)==0:
         return ''
     txt = 'Tutorials and examples using this'

- Felix



More information about the Reproducible-builds mailing list