Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pip_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@ mkdocs-literate-nav
mkdocs-autorefs
mkdocs-redirects

# Pinned so the committed diagram figures stay byte-reproducible: pydot's SVG
# writer changed between 3.x and 4.x (XML prolog, attribute order, cluster
# titles), which reshuffles every generated SVG without changing the picture.
# See scripts/gen_pipeline_diagrams.py.
pydot==3.0.4

# DataJoint from master for tutorials
git+https://github.com/datajoint/datajoint-python.git@master
28 changes: 20 additions & 8 deletions scripts/gen_pipeline_diagrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,11 @@
by the pydot that produced the committed figures and as literal spaces by
4.0.1, which shows up as a whole-file diff with no visual change. Compare
rendered content, not bytes, when the pydot version moves. Nothing pins pydot.
- **One collapsed edge is traversal-order dependent.** A collapsed edge inherits
the attributes of whichever foreign key in its bundle is visited first
(``diagram.py``, ``_collapse_graph``: ``if not new_graph.has_edge(...)``), with
no aggregation over the bundle. Where a bundle mixes a primary and a secondary
foreign key — ``lab -> session`` here, which bundles ``Subject -> Session``
(primary) and ``User -> Session`` (secondary) — the edge renders solid or
dashed depending on order alone. The committed figure has it solid; this script
produces dashed. Both are outputs of the same renderer.
- **Node emission order is hash-seeded.** ``dj.Diagram`` iterates sets of
table-name strings when emitting, so node and cluster order follows the
per-process string hash. This script therefore re-execs itself with
``PYTHONHASHSEED=0``; without that, two identical runs disagree on order while
rendering the same picture. Upstream: datajoint-python#1551.

A non-empty diff after a DataJoint upgrade is the signal to review the notation
and the surrounding prose together — see issue #246.
Expand All @@ -68,6 +65,21 @@
import tempfile
from pathlib import Path

# Re-exec with a fixed string-hash seed before anything imports datajoint.
#
# dj.Diagram iterates sets of table-name strings on its emission path, so the
# order nodes and clusters land in the SVG follows str.__hash__, which Python
# salts per process (PEP 456). The rendered picture is identical either way —
# same coordinates, colors and edges — but the bytes are not, which makes
# --check unusable and buries real notation changes in reordering noise.
# Upstream: datajoint/datajoint-python#1551. Remove this block once that lands.
#
# PYTHONHASHSEED only takes effect at interpreter start, so it cannot be set
# from inside the process.
if os.environ.get("PYTHONHASHSEED") != "0":
os.environ["PYTHONHASHSEED"] = "0"
os.execv(sys.executable, [sys.executable, *sys.argv])

import datajoint as dj

sys.path.insert(0, str(Path(__file__).resolve().parent))
Expand Down
39 changes: 16 additions & 23 deletions src/images/imaging-schema.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading