read
Browse files
README.md
CHANGED
|
@@ -1,3 +1,126 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
task_categories:
|
| 4 |
+
- text-generation
|
| 5 |
+
- text-classification
|
| 6 |
+
- question-answering
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
tags:
|
| 10 |
+
- code
|
| 11 |
+
size_categories:
|
| 12 |
+
- 10K<n<100K
|
| 13 |
+
---
|
| 14 |
+
---
|
| 15 |
+
license: mit
|
| 16 |
+
task_categories:
|
| 17 |
+
- text-generation
|
| 18 |
+
- text-classification
|
| 19 |
+
- question-answering
|
| 20 |
+
language:
|
| 21 |
+
- en
|
| 22 |
+
tags:
|
| 23 |
+
- code
|
| 24 |
+
size_categories:
|
| 25 |
+
- 10K<n<100K
|
| 26 |
+
---
|
| 27 |
+
# PyHub: Vetted Python Code from Popular GitHub Repositories
|
| 28 |
+
|
| 29 |
+
[](https://www.python.org/)
|
| 30 |
+
[](LICENSE)
|
| 31 |
+
|
| 32 |
+
A large-scale dataset of Python source code, test files, and documentation scraped from high-quality GitHub repositories. Designed for training code understanding and generation models, particularly for software engineering benchmarks like SWE-bench.
|
| 33 |
+
|
| 34 |
+
## Dataset Statistics
|
| 35 |
+
|
| 36 |
+
- **Total files**: 271,995
|
| 37 |
+
- **Repositories**: 50+ (minimum 50 stars)
|
| 38 |
+
- **File types**: Python source, test files, READMEs
|
| 39 |
+
- **Time period**: Repositories created before January 1, 2020
|
| 40 |
+
- **Size limit**: Maximum 100 MB per repository
|
| 41 |
+
- **License**: MIT
|
| 42 |
+
|
| 43 |
+
## Dataset Structure
|
| 44 |
+
|
| 45 |
+
Each row in `dataset.csv` represents a single file with the following columns:
|
| 46 |
+
|
| 47 |
+
| Column | Description |
|
| 48 |
+
|--------|-------------|
|
| 49 |
+
| `repo_name` | Repository name (e.g., "requests") |
|
| 50 |
+
| `repo_full_name` | Full repository name (e.g., "psf/requests") |
|
| 51 |
+
| `owner` | Repository owner (e.g., "psf") |
|
| 52 |
+
| `stars` | Star count |
|
| 53 |
+
| `license` | SPDX license identifier |
|
| 54 |
+
| `repo_description` | Repository description |
|
| 55 |
+
| `filepath` | Relative path within repository |
|
| 56 |
+
| `file_type` | "python", "test", or "readme" |
|
| 57 |
+
| `language` | "Python", "Markdown", "reStructuredText", or "" |
|
| 58 |
+
| `content` | Full file text |
|
| 59 |
+
| `size_bytes` | File size in bytes |
|
| 60 |
+
| `num_lines` | Number of lines |
|
| 61 |
+
|
| 62 |
+
## File Types
|
| 63 |
+
|
| 64 |
+
- **Python source** (`.py`): Production code files
|
| 65 |
+
- **Test files** (`*test*.py`): Unit tests and test suites
|
| 66 |
+
- **README files** (`README.*`): Documentation in Markdown, reStructuredText, or plain text
|
| 67 |
+
|
| 68 |
+
## Collection Methodology
|
| 69 |
+
|
| 70 |
+
The dataset was collected using a custom GitHub scraper with the following process:
|
| 71 |
+
|
| 72 |
+
1. **Repository selection**: GitHub API search for repositories with x ≥ 50 stars, created before 2020-01-01, non-fork
|
| 73 |
+
2. **Cloning**: Shallow git clone (`--depth 1`) with 100 MB size filter to exclude large monorepos
|
| 74 |
+
3. **File collection**: Recursive walk through cloned repositories, excluding hidden directories (files starting with `.`)
|
| 75 |
+
4. **File type filtering**: Only Python source files (`.py`), test files (`*test*.py`), and README files (`README.*`) were collected
|
| 76 |
+
5. **Content extraction**: UTF-8 encoding with error handling for robust text extraction
|
| 77 |
+
6. **Parallel processing**: 3 concurrent workers for efficient processing
|
| 78 |
+
7. **CSV generation**: All file data consolidated into a single CSV with repository metadata embedded in each row
|
| 79 |
+
|
| 80 |
+
## Quality Filters
|
| 81 |
+
|
| 82 |
+
- **Star threshold**: Minimum 50 stars (indicates community vetting)
|
| 83 |
+
- **Size limit**: 100 MB to exclude monorepos and binary-heavy projects
|
| 84 |
+
- **File type filtering**: Only Python, test, and documentation files
|
| 85 |
+
- **Hidden files excluded**: Files/directories starting with `.` ignored
|
| 86 |
+
- **Encoding handling**: UTF-8 with error fallback
|
| 87 |
+
|
| 88 |
+
## Intended Use Cases
|
| 89 |
+
|
| 90 |
+
- **Code completion**: Training autocompletion models on real-world Python patterns
|
| 91 |
+
- **Bug detection**: Learning from production codebases with established testing practices
|
| 92 |
+
- **Test generation**: Understanding test-code relationships from included test files
|
| 93 |
+
- **Documentation generation**: Learning code-documentation correlations from READMEs
|
| 94 |
+
- **SWE-bench training**: Base dataset for software engineering benchmark preparation
|
| 95 |
+
- **Code understanding**: Repository structure and dependency learning
|
| 96 |
+
|
| 97 |
+
## Limitations
|
| 98 |
+
|
| 99 |
+
- **Temporal bias**: Pre-2020 code, missing modern Python features (type hints, match statements, structural pattern matching)
|
| 100 |
+
- **Popularity bias**: High-star repos only, may not represent niche or edge-case patterns
|
| 101 |
+
- **Size limitation**: 100 MB cap excludes large enterprise monorepos
|
| 102 |
+
- **Language bias**: Primarily English documentation and comments
|
| 103 |
+
- **Static only**: No execution data, test results, or runtime behavior
|
| 104 |
+
|
| 105 |
+
## Recommended Supplements
|
| 106 |
+
|
| 107 |
+
For comprehensive model training, consider supplementing with:
|
| 108 |
+
- Post-2020 repositories for modern Python patterns
|
| 109 |
+
- Smaller repositories for edge-case and niche patterns
|
| 110 |
+
- Synthetic examples for specific bug types
|
| 111 |
+
- Negative examples (buggy code) for robustness
|
| 112 |
+
|
| 113 |
+
## License
|
| 114 |
+
|
| 115 |
+
This dataset is licensed under the MIT License. See the LICENSE file for details.
|
| 116 |
+
|
| 117 |
+
## Contact
|
| 118 |
+
|
| 119 |
+
furkannar168@hotmail.com
|
| 120 |
+
|
| 121 |
+
or you can simply open up an issue for issues or questions that you'd like to adress or ask.
|
| 122 |
+
|
| 123 |
+
---
|
| 124 |
+
|
| 125 |
+
**Note**: This dataset was created using a custom GitHub scraper tool.
|
| 126 |
+
|