[Python-modules-team] Regarding patch for nbsphinx package to make it reproducible

Ankur Mitra am7682 at nyu.edu
Mon Nov 6 18:15:46 UTC 2017


My name is Ankur Mitra and I am a student at NYU. I was working on a debian
package: nbsphinx-0.2.14 (buster) to try to make it reproducible (reference
below). I would like to submit a patch and was hoping you could review it.
I have included a README along with the diff.
Reference: https://tracker.debian.org/pkg/nbsphinx

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20171106/e2afbc5d/attachment.html>
-------------- next part --------------
Index: patch/nbsphinx.py
--- patch.orig/nbsphinx.py
+++ patch/nbsphinx.py
@@ -150,11 +150,10 @@ RST_TEMPLATE = """
 {{ output.data['text/html'] | indent | indent }}
 {%- elif datatype == 'application/javascript' %}
-{% set div_id = uuid4() %}
     .. raw:: html
-        <div id="{{ div_id }}"></div>
+        <div id="{{ '6fa01287-7899-40d7-8d96-45a34ba4efc4' }}"></div>
         <script type="text/javascript">
         var element = document.getElementById('{{ div_id }}');
 {{ output.data['application/javascript'] | indent | indent }}
-------------- next part --------------
Root cause preventing the package from being reproducible: The uuid4() function being used in the nbsphinx.py file seems to generate random uuids each time the package is built. This uuid value is assigned to the div ids whcih causes the binaries to differ each time the package built.

Fix: I could not change the function uuid4() so I had to hard code the value of uuid in the nbsphinx file in order to ensure that the div id remainds constant and the same binaries are produced each time.

The value being used is a random uuid generated from the uuid4() function in python.

More information about the Python-modules-team mailing list