The unwritten rules

Habits most codebases rely on without ever stating them. I write each one down and test it against real code and data, to see whether it deserves to stay.

8 posts · 2026
Subscribe
From the series

When to merge duplicate code

Whether two similar functions should become one depends on whether they change together, and git already knows. A real history from httpx, a script that counts co-changes across a repository, a browser tool for one pair, and a third answer that is neither copying nor abstracting: generate one copy and check it.

craftdesign-patternspython
  1. Systems

    Every latency number answers one question

    A checkout page hangs while the dashboard says 23 ms. The mean, a percentile and a share under a threshold each answer a different question, only two of them add up across hosts, and an averaged p99 can be wrong by a factor of three in either direction.

    observabilityperformance
    Aug 2026
  2. Software craft

    Code review economics

    On three busy repositories the wait for a first review grows much more slowly than a PR's size, so a change split into eight PRs reviewed one after another waits three to eight times as long. Opening them side by side helps less than it looks, and only one reviewer taking them together is no worse than one PR. The measurement, the rule that falls out of it, and a tool to run it on your own PRs.

    craftteams
    Oct 2026
  3. Software craft

    Keeping optional Python imports optional

    A test that checks importing a library leaves its optional dependency unloaded, and proves it got far enough to notice.

    pythontesting
    Aug 2026
  4. Software craft

    Green on my laptop, red in CI

    A pytest plugin passed every test from the source checkout and failed twice in CI, because only the installed wheel told pytest the plugin existed.

    pythontesting
    Sep 2026
  5. Software craft

    How many concepts is too many

    Framework debates trade concept counts that measure different things. Count what the smallest real program makes its user write, in separate columns and per reader, find the rules the count can't see by misspelling them, and keep an extra concept only when it moves a check earlier or gives users a seam they can see.

    pythonapi-design
    Oct 2026
  6. Software craft

    The one-sentence API design test

    Six AI agents each designed one extension to my framework, and each design held up on its own. Side by side they disagreed about names every user touches. One question sorted them out, and writing down the rules my existing code already followed made the answer countable.

    api-designai-agents
    Oct 2026
  7. Software craft

    What plugin discovery actually checks

    A plugin you can see in pip list comes back “not found”. Python hosts turn installed entry points into loaded code in four checks, and the order of those checks decides whether a plugin's code runs before anyone asks if it fits, and whether the error your code catches says why.

    pythonpackaging
    Sep 2026
  1. Aug 25, 2026 26 min read Systems

    Every latency number answers one question

    A checkout page hangs while the dashboard says 23 ms. The mean, a percentile and a share under a threshold each answer a different question, only two of them add up across hosts, and an averaged p99 can be wrong by a factor of three in either direction.

    observabilityperformancestatistics
  2. Oct 13, 2026 26 min read Software craft

    Code review economics

    On three busy repositories the wait for a first review grows much more slowly than a PR's size, so a change split into eight PRs reviewed one after another waits three to eight times as long. Opening them side by side helps less than it looks, and only one reviewer taking them together is no worse than one PR. The measurement, the rule that falls out of it, and a tool to run it on your own PRs.

    craftteamsstatistics
  3. Aug 31, 2026 11 min read Software craft

    Keeping optional Python imports optional

    A test that checks importing a library leaves its optional dependency unloaded, and proves it got far enough to notice.

    pythontesting
  4. Sep 15, 2026 11 min read Software craft

    Green on my laptop, red in CI

    A pytest plugin passed every test from the source checkout and failed twice in CI, because only the installed wheel told pytest the plugin existed.

    pythontesting
  5. Oct 2, 2026 16 min read Software craft

    How many concepts is too many

    Framework debates trade concept counts that measure different things. Count what the smallest real program makes its user write, in separate columns and per reader, find the rules the count can't see by misspelling them, and keep an extra concept only when it moves a check earlier or gives users a seam they can see.

    pythonapi-designframeworks
  6. Oct 21, 2026 12 min read Software craft

    The one-sentence API design test

    Six AI agents each designed one extension to my framework, and each design held up on its own. Side by side they disagreed about names every user touches. One question sorted them out, and writing down the rules my existing code already followed made the answer countable.

    api-designai-agentspython
  7. Sep 4, 2026 18 min read Software craft

    What plugin discovery actually checks

    A plugin you can see in pip list comes back “not found”. Python hosts turn installed entry points into loaded code in four checks, and the order of those checks decides whether a plugin's code runs before anyone asks if it fits, and whether the error your code catches says why.

    pythonpackagingplugins