Minimal Reproducible Example
A minimal reproducible example is a small, self-contained example that still demonstrates the reported failure. Include the imports, input, and environment details needed to run it. Minimal does not demand the mathematically shortest program. For an intermittent failure, report the conditions, frequency, and any relevant random seed rather than claiming it fails every time.
Remove one part and rerun the example. If the same failure persists, that part is unnecessary for this reproduction; this alone does not prove it is unrelated to every failure in the original program. If the failure disappears, restore the part and investigate what changed. This process narrows the problem even when it does not immediately reveal the cause.
Replace real data with a small synthetic input that preserves the failure. Inline values when file reading is irrelevant; if encoding, delimiters, or file layout trigger the problem, supply a small synthetic file with those properties instead. Rerun after each replacement. Keep relevant library versions and remove credentials and personal data before sharing.
A complete report of the failure has four parts: the small example, what you expected, what happened including the exact message, and the versions involved. The same four parts serve a colleague, a search, a bug report, and your own notes a month later. Keep the reduced example after the fix; it is usually the first test worth writing.
References: how to create a minimal reproducible example, Python errors and exceptions. See it in use in Researching Errors and Organizing Analytical Work.
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
