DjangoDefects: A Multi-Granularity SZZ-Labeled Defect Dataset for Python
Abstract
DjangoDefects is an inter-release defect prediction benchmark for Python, built from the full version history of the Django web framework. It covers 24 consecutive releases (1.0 to 5.2, September 2008 to April 2025). For every release it provides defect labels at four granularities, all derived from a single SZZ run:- File level: 20,442 file-release instances, 28.4% buggy- Method level: 169,744 function and method instances with their source code, 8.3% buggy- Line level: 14,917 buggy source lines- AST-node level: 5.38 M nodes from a full DFS traversal of each affected file's AST, with typed parent edges (ready to load as a graph), 1.29% buggyA source snapshot of every release is included. All file paths, method spans, line numbers and node spans refer to the code exactly as it shipped in that release.Construction. 5,585 closed, fixed Bug tickets from Django's Trac issue tracker were linked to 4,801 fix commits through Fixed # references. Each fix was traced back to the commits that introduced the bug using SZZ Unleashed, with whitespace-insensitive blame and whitespace and comment filters, giving 6,306 bug records. Releases are assigned by git ancestry rather than by date, which accounts for Django forking each stable branch months before the release tag. Buggy lines are located in each release snapshot by blame identity.Contents.- file_level.zip, method_level.zip, line_level.zip, ast_level.zip: one CSV per release- source_code.zip: every file under django/ at each release tag- code.zip: the pipeline that generated the dataset, the cached ticket-to-commit links, and instructions for reproducing it- README.md: full documentation, including schemas, statistics and threats to validityIntended uses.- Cross-version defect prediction at file and method level- Fine-grained defect localisation at line and AST-node level- Training models that use code structure, such as graph neural networks on the ASTs or code language models on method sourceKnown limitations.- Labels for the most recent releases (about 5.0 to 5.2) are incomplete, because many of their bugs have not been reported or fixed yet.- File and method labels cover every release in which a bug is present. Line and node labels cover only the release that introduced it.- See README.md §7 for the other threats to validity. Licence. The labels, documentation and code are released under CC BY 4.0. The included Django source code is © Django Software Foundation and individual contributors, redistributed under its BSD-3-Clause licence (LICENSE-DJANGO).