maxvonhippel commited on
Commit
55db098
·
verified ·
1 Parent(s): a885a06

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +155 -3
README.md CHANGED
@@ -1,3 +1,155 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RealPBT: A Dataset of 50,000+ PBTs Captured from Real-World Code
2
+
3
+ A large-scale dataset of property-based tests (PBTs) extracted from real-world, permissively licensed Github repos.
4
+ Each PBT comes with overlapping unit tests, and information about the functions it tests.
5
+
6
+ This data was scraped by [Benchify](https://www.benchify.com/). We scraped Hypothesis PBTs for about 24 hours, and Typescript PBTs for about 8 hours, using our own proprietary Github scraper. In each case we turned our scraper off when, anecdotally, we felt it had hit an asymptote in terms of finding new PBTs. However, the choice of *when* to turn the scraper off was unscientific in nature and so the relative sizes of these datasets should not be viewed as a scientific measurement of the popularity of each framework (absolutely or relatively), despite the fact that it probably does roughly reflect that information.
7
+
8
+ ## Dataset Description
9
+
10
+ This dataset contains code examples from thousands of GitHub repositories, focusing on property-based testing using [Hypothesis](https://hypothesis.readthedocs.io/en/latest/) (Python) and [Fast-Check](https://fast-check.dev/) (TypeScript).
11
+
12
+ ### Dataset Statistics
13
+
14
+ - **Property-Based Tests (PBTs)**: 60,628 tests
15
+ - Python PBTs: 54,345 (with detailed metrics, overlapping unit tests, and dependency information)
16
+ - TypeScript PBTs: 6,283 (without the extra stuff mentioned above)
17
+ - **Unit Tests**: 6,343,790 (Python only)
18
+ - **Functions**: 6,845,964 (Python only)
19
+ - **Repositories**: 27,746+ GitHub repos
20
+
21
+ ## Dataset Structure
22
+
23
+ The dataset consists of four JSONL files (one JSON object per line):
24
+
25
+ ### 1. Python Property-Based Tests (`pbts.jsonl`)
26
+
27
+ Each record contains:
28
+ - `id`: Unique test identifier
29
+ - `name`: Test function name
30
+ - `code`: Complete test source code
31
+ - `language`: Programming language (always "python")
32
+ - `source_file`: File path within the repository
33
+ - `start_line`, `end_line`: Line numbers in source file
34
+ - `dependencies`: List of test dependencies (Python only)
35
+ - `repo`: Repository metadata
36
+ - `name`: Repository name
37
+ - `url`: GitHub URL
38
+ - `license`: License type
39
+ - `stars`: GitHub stars
40
+ - `forks`: Fork count
41
+ - `metrics`: Code quality metrics (Python only) from [Radon](https://radon.readthedocs.io/)
42
+ - `loc`: Lines of code
43
+ - `sloc`: Source lines of code
44
+ - `lloc`: Logical lines of code
45
+ - `comments`: Comment lines
46
+ - `avg_complexity`: Average cyclomatic complexity
47
+ - `max_complexity`: Maximum cyclomatic complexity
48
+ - `maintainability_index`: Maintainability score (0-100)
49
+ - `halstead_difficulty`: Halstead difficulty metric
50
+ - `halstead_effort`: Halstead effort metric
51
+ - `summary`: AI-generated natural language description of test behavior (generated with `4o-mini`)
52
+
53
+ ### 2. TypeScript Property-Based Tests (`pbts_typescript.jsonl`)
54
+
55
+ Each record contains:
56
+ - `id`: Unique test identifier
57
+ - `name`: Test function name
58
+ - `code`: Complete test source code
59
+ - `language`: Programming language (always "typescript")
60
+ - `source_file`: File path within repository
61
+ - `start_line`, `end_line`: Line numbers (null - not available)
62
+ - `dependencies`: List of test dependencies (empty - no dependency analysis performed)
63
+ - `repo`: Repository metadata
64
+ - `name`: Repository name
65
+ - `url`: GitHub URL
66
+ - `license`: License type
67
+ - `stars`: GitHub stars
68
+ - `forks`: Fork count
69
+ - `metrics`: Code quality metrics (null - not available)
70
+ - `summary`: AI-generated natural language description of test behavior
71
+ - `mode`: Testing framework used (always "fast-check")
72
+
73
+ ### 3. Unit Tests (`unit_tests.jsonl`)
74
+
75
+ Each record contains:
76
+ - `id`: Unique test identifier
77
+ - `name`: Test function name
78
+ - `code`: Complete test source code
79
+ - `language`: Programming language (always "python")
80
+ - `source_file`: File path within repository
81
+ - `start_line`, `end_line`: Line numbers
82
+ - `repo`: Repository metadata (same structure as PBTs)
83
+
84
+ ### 4. Functions (`functions.jsonl`)
85
+
86
+ Each record contains:
87
+ - `id`: Unique function identifier
88
+ - `name`: Function name
89
+ - `code`: Complete function source code
90
+ - `language`: Programming language (always "python")
91
+ - `source_file`: File path within repository
92
+ - `start_line`, `end_line`: Line numbers
93
+ - `repo`: Repository metadata (same structure as PBTs)
94
+
95
+ ## Language Detection
96
+
97
+ **Python code validation:**
98
+ 1. Uses Python's AST (Abstract Syntax Tree) parser
99
+ 2. Attempts to parse code using `ast.parse()`
100
+ 3. On success, labels as "python"
101
+
102
+ **TypeScript code validation:**
103
+ 1. Checks for fast-check framework patterns (`fc.property`, `fc.assert`)
104
+ 2. Validates basic syntax structure
105
+ 3. Verifies balanced brackets and parentheses
106
+ 4. On success, labels as "typescript"
107
+
108
+ The dataset includes Python (89.6%) and TypeScript (10.4%) PBTs.
109
+
110
+ ## Code Metrics
111
+
112
+ The Python PBT records include code quality metrics:
113
+
114
+ - **Cyclomatic Complexity**: Measures code path complexity
115
+ - **Maintainability Index**: 0-100 score (higher is better)
116
+ - **Halstead Metrics**: Metrics measuring code difficulty and effort
117
+
118
+ ## License Information
119
+
120
+ Each record includes the repository's license. Common licenses in this dataset:
121
+ - MIT
122
+ - Apache-2.0
123
+ - BSD-3-Clause
124
+ - GPL variants
125
+ We only extracted code from repos with licenses we considered permissive. If you believe we made a mistake (either sucking in a license which does not allow this kind of use, or, incorrectly determining the license of a repository) please don't hesitate to let us know and we will update the dataset accordingly.
126
+
127
+ Always check individual record licenses before use.
128
+
129
+ ## Citation
130
+
131
+ If you use this dataset in your research, please cite:
132
+
133
+ ```bibtex
134
+ @dataset{realPBTs,
135
+ title={{RealPBT}: 50,000+ PBTs Captured from Real-World Code},
136
+ author={Max von Hippel, Evan Boehs, Jake Ginesin},
137
+ year={2026},
138
+ publisher={HuggingFace},
139
+ note={Work supported by Benchify, Inc.}
140
+ }
141
+ ```
142
+
143
+ ### Acknowledgments
144
+
145
+ We gratefully acknowledge the following contributors who made this dataset possible:
146
+
147
+ - **[Max von Hippel](https://mxvh.pl)** - Led the project and performed data cleaning, dependency analysis, and data publication
148
+ - **[Evan Boehs](https://boehs.org/)** and **[Jake Ginesin](https://jakegines.in/about)** - Developed and implemented the web scraper for collecting property-based tests from open-source repositories
149
+ - **[Juan Castaño](https://www.linkedin.com/in/jfcastano)** - Set up and managed the database infrastructure and AWS instances used for large-scale scraping operations
150
+ - **[The Dartmouth DALI Lab](https://dali.dartmouth.edu/)** - Extended the scraper to support TypeScript property-based tests using the fast-check framework
151
+ - **Sekpey Herbert Setor Kwame** - Helped with Typescript PBT scraping as a DALI Lab intern
152
+
153
+ ## Contact
154
+
155
+ For questions, concerns, etc., please contact max@benchify.com or maxvh@hey.com.