Bug#1037216: mkdocstrings-python-handlers: please make the build reproducible

Chris Lamb lamby at debian.org
Wed Jun 7 21:41:41 BST 2023


Source: mkdocstrings-python-handlers
Version: 0.8.3-1
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: randomness toolchain
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0] we noticed that
mkdocstrings-python-handlers was causing other packages to nod build
reproducibly. Here is python-mkdocs:

    <span class="doc doc-labels">
 -      <small class="doc doc-label doc-label-writable"><code>writable</code></small>
        <small class="doc doc-label doc-label-property"><code>property</code></small>
 +      <small class="doc doc-label doc-label-writable"><code>writable</code></small>
    </span>

This is because the "griffe" Python module populates a Python set()
object with strings such as "property" and "writable", which the
labels.html template (in this package) then naïvely iterates over.

A patch is attached that simply sorts these when rendering using
Jinja's "|sort" filter.

  [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/labels.html b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
index 4f2f72d..0c84067 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
@@ -1,7 +1,7 @@
 {% if labels %}
   {{ log.debug("Rendering labels") }}
   <span class="doc doc-labels">
-    {% for label in labels %}
+    {% for label in labels|sort %}
       <small class="doc doc-label doc-label-{{ label }}"><code>{{ label }}</code></small>
     {% endfor %}
   </span>


More information about the Reproducible-bugs mailing list