The problem
Dropbox's backend was one of the largest Python codebases anywhere. In their words: "At our scale—millions of lines of Python—the dynamic typing in Python made code needlessly hard to understand and started to seriously impact productivity."
The everyday version of that problem: you open a function and can't tell what it returns, what its arguments should be, or whether it might hand back None.
What they did
- 2014: first serious experiments with the mypy type checker, during a company Hack Week.
- Late 2015: a dedicated three-person team, one of them Guido van Rossum, Python's creator.
- End of 2016: about 420,000 lines annotated.
- 2019: about 4 million lines type-checked in their largest backend repository.
They didn't annotate everything at once. Python's type hints are optional, so annotated and unannotated code run side by side, and the checker only reports on the parts that have hints.
What slowed them down, and the fix
As coverage grew, checking the whole codebase from scratch took over 15 minutes. They fixed it in layers:
- Incremental checking: only re-check modules that changed, and what depends on them.
- Shared caches: download a recent check result instead of starting cold.
- The mypy daemon: keep the analysis in memory, which brought everyday re-checks down to a few seconds.
- mypyc: compiling mypy itself to C made full checks about 4× faster.
The part any team can copy
You don't need 4 million lines to get the benefit. Add hints where a reader most often has to guess, like the functions everyone calls:
def total_cents(prices: list[float]) -> int: return round(sum(prices) * 100) print(total_cents([19.99, 5.01])) print(total_cents.__annotations__)
2500
{'prices': list[float], 'return': <class 'int'>}The hints change nothing at run time; they're read by tools like mypy and by your editor. That's why adding them gradually works: nothing breaks while half the code has them and half doesn't.
Their closing advice: "If you aren't using type checking in your large-scale Python project, now is a good time to get started—nobody who has made the jump I've talked to has regretted it."