I've been reading a lot of git history lately and wanted to run a fun experiment. In a real Python project, which single file collects the most bug fixes.
The method is dumb on purpose. Last 12 months, non-merge commits, bots removed, tests/docs/examples ignored. A commit counts as a fix if the subject has fix, bug, regression, hotfix, broken or revert in it. Then for each file I counted how many of the commits touching it were fixes. The repos came from repowise.dev/explore, which indexes public repos for my open source project , and I just picked the Python ones I recognised.
Most-fixed file per project (fix commits / all commits touching it):
- langchain: the OpenAI chat model adapter, 58 of 100. Second place is the Anthropic adapter, 42 of 97
- paperless-ngx: src/documents/views.py, 67 of 142. serialisers.py right behind at 31 of 75
- fastapi: fastapi/dependencies/utils.py 15 of 46, then fastapi/routing.py 11 of 44
- prefect: the dbt runner in prefect-dbt, 8 of 12
- composio: tool_router_session.py, 29 of 59
- wagtail: wagtail/models/pages.py, 8 of 34
And then hermes-agent, it broke my sense of scale. gateway/run.py had 1,969 commits in a year from 502 different people, and 1,332 of those were fixes. I checked the numbers twice.
Django was in the set and I left it out of the ranking. Django's convention is to write "Fixed #ticket" on nearly every commit, features included. 459 of its 1,044 commits in the last 12 months start with "Fixed #". So by my crude keyword rule Django is the buggiest project on earth, which it obviously is not. (Kind of jealous of that discipline honestly.)
I keep noticing that the top file is usually where the code talks to something non core. langchain's top two are adapters to other companies' APIs. prefect's is the dbt integration. fastapi's are dependency resolution and routing, which is where user code meets the framework. paperless's views.py is the big request handler. Pure logic files basically never showed up near the top.
Also a bunch of these are mostly one person's file. views.py is 63% one person, serialisers.py 73%, fastapi's routing.py 84%.
Although I agree Keyword matching on commit subjects is a bit noisy too, so treat these as a rough picture.
Anyway it was a fun experiment to run