Single Source of Truth (SSOT)#
Single Source of Truth
“Information must be defined in exactly one location. All subsequent usages must reference or derive from this primary definition.”
Scope of Application
Data: Raw inputs remain immutable; outputs are derived programmatically.
Metadata: Versions and licenses reside in a single configuration.
Parameters: Algorithmic settings are defined centrally.
Integration with DRY
DRY targets procedural logic and behavior.
SSOT targets data and state.
Eliminates conflicting project states.
Guarantees computational reproducibility.
Core Rule
“State must be referenced or derived, never duplicated.”
Example: Project Metadata#
Duplicated State ❌
# pyproject.toml
version = "1.2.0"
# src/mypkgs/__init__.py
__version__ = "1.2.0"
# docs/conf.py
release = "1.2.0"
Version bumps require modifying three separate files. Desynchronization is highly probable.
SSOT ✔
# pyproject.toml
[project]
version = "1.2.0"
# src/mupkgs/__init__.py
from importlib.metadata import version
__version__ = version("my_package")
Defined once. Parsed dynamically. Impossible to desynchronize.