Datasets:
You need to agree to share your contact information to access this dataset
This repository is publicly accessible, but you have to accept the conditions to access its files and content.
Terms of Use
This dataset is derived from bigcode/the-stack-dedup, which is a gated dataset with its own Terms of Use. Before accessing this dataset, you must first accept the Terms of Use for The Stack by visiting bigcode/the-stack-dedup and clicking "Access repository".
By requesting access to this dataset, you acknowledge that:
You have accepted The Stack's Terms of Use at
bigcode/the-stack-dedup.License compliance: This dataset contains source code from repositories with various
licenses. Any use of the code must abide by the terms of the original licenses, including
attribution clauses when relevant. License information is provided in themax_stars_repo_licenses
field of each record.Data removal: The Stack is regularly updated to enact validated data removal requests.
You agree to update your version of this dataset when notified of removals. Follow the
update thread for
notifications, and use the community discussions
for questions about dataset versions and allowed uses.Redistribution: To host, share, or otherwise provide access to this dataset, you must
include these Terms of Use and require users to agree to them.Contact sharing: Your contact information (email address and username) may be shared
with the dataset maintainers.Security warning: This dataset contains raw source code from public GitHub repositories.
Some files may contain security vulnerabilities, malicious code, or exploits. Do not execute
any code from this dataset without thorough security review. The lint annotations may help
identify some issues but are not a substitute for security auditing.No warranty: This dataset is provided "as is" without warranty of any kind. The lint
annotations are generated automatically by ruff and may contain false positives or miss
real issues.
Log in or Sign Up to review the conditions and access this dataset content.
Instructed Lint Python Files
Lint-annotated Python source code from bigcode/the-stack-dedup, processed with ruff (all 800 stable rules enabled).
Dataset Description
This dataset pairs 12,962,249 Python files from The Stack (deduplicated) with their complete ruff lint diagnostics. Each record contains the original source code, file metadata, license information, and structured lint results.
Motivation
Building training data for code quality models requires large-scale lint annotations. Running
ruff at scale on millions of files is expensive with the standard CLI approach. We built
ruff-batch, a Rust binary that calls ruff's internal
lint_only() API directly via Rayon parallel iteration, achieving 26,337 files/sec with all
800 rules enabled — a 10x speedup over the ruff CLI.
Source Data
- Origin: bigcode/the-stack-dedup, Python split
- Files: 12,962,249
- Linter: ruff (all 800 stable rules, preview disabled)
- Processing time: 8.2 minutes on Apple M3 Ultra (28 cores)
Dataset Structure
Each record contains:
| Field | Type | Description |
|---|---|---|
id |
string | Unique file identifier (git hexsha from The Stack) |
code |
string | Python source code |
path |
string | Original file path in the source repository |
max_stars_repo_licenses |
list[string] | SPDX license identifiers for the most-starred repo containing this file |
max_stars_repo_name |
string | GitHub repository name (owner/repo) |
size |
int | File size in bytes |
diagnostics |
list[object] | Lint diagnostics (see below) |
num_diagnostics |
int | Number of lint issues found |
valid_syntax |
bool | Whether the file has valid Python syntax |
lint_elapsed_us |
int | Microseconds spent linting this file |
Diagnostic Structure
Each diagnostic in the diagnostics list contains:
| Field | Type | Description |
|---|---|---|
code |
string | Ruff rule code (e.g., "F401", "E711") |
message |
string | Human-readable description of the issue |
row |
int | 1-indexed start line number |
col |
int | 1-indexed start column number |
end_row |
int | 1-indexed end line number |
end_col |
int | 1-indexed end column number |
Statistics
- Total files: 12,962,249
- Valid syntax: 95.6%
- Average diagnostics per file: ~102 (with all 800 rules)
- Total diagnostics: ~1.3 billion
Usage
from datasets import load_dataset
ds = load_dataset("tensorvalley/instructed_lint_python_files", split="train", streaming=True)
for record in ds:
print(f"File: {record['path']}")
print(f"License: {record['max_stars_repo_licenses']}")
print(f"Issues: {record['num_diagnostics']}")
for diag in record['diagnostics']:
print(f" {diag['code']} at line {diag['row']}: {diag['message']}")
break
Licensing and Attribution
This dataset contains source code from GitHub repositories with various open-source licenses.
The license for each file is provided in the max_stars_repo_licenses field. Any use of the
code must comply with the terms of the original licenses, including attribution requirements.
The lint annotations themselves are provided under Apache-2.0.
For data provenance, each record includes:
id: The git hexsha, which can be used to trace back to the original commitmax_stars_repo_name: The GitHub repository name for attributionpath: The original file path within the repository
Data Removal
This dataset inherits The Stack's data removal policy. If your code is included and you wish to have it removed, please follow the opt-out process at Am I in The Stack?
When The Stack publishes data removal updates, this dataset will be updated accordingly. Follow the update thread for notifications.
Security Warning
This dataset contains raw source code from public GitHub repositories. Some files may contain:
- Security vulnerabilities (SQL injection, XSS, command injection, etc.)
- Intentionally malicious code
- Backdoors or exploits
- Credential leaks or hardcoded secrets
Do not execute any code from this dataset without thorough security review. The ruff lint annotations identify some code quality issues but are not a security audit and should not be treated as one.
Citation
@misc{{instructed_lint_python_files,
title={{Instructed Lint Python Files}},
author={{Tensor Valley}},
year={{2026}},
howpublished={{\url{{https://huggingface.co/datasets/tensorvalley/instructed_lint_python_files}}}}
}}
If you use the underlying source code, please also cite The Stack:
@inproceedings{{kocetkov2022thestack,
title={{The Stack: 3 TB of permissively licensed source code}},
author={{Denis Kocetkov and Raymond Li and Loubna Ben Allal and Jia Li and Chenghao Mou
and Carlos Mu{{\~n}}oz Ferrandis and Yacine Jernite and Margaret Mitchell
and Sean Hughes and Thomas Wolf and Dzmitry Bahdanau and Leandro von Werra
and Harm de Vries}},
booktitle={{Transactions on Machine Learning Research}},
year={{2022}}
}}
Terms of Use for The Stack
The Stack dataset is a collection of source code in over 300 programming languages. We ask that you read and acknowledge the following points before using the dataset:
The Stack is a collection of source code from repositories with various licenses. Any use of all or part of the code gathered in The Stack must abide by the terms of the original licenses, including attribution clauses when relevant. We facilitate this by providing provenance information for each data point.
The Stack is regularly updated to enact validated data removal requests. By accessing this dataset, you agree to update your own version of The Stack to the most recent usable version specified by the maintainers in the following thread. If you have questions about dataset versions and allowed uses, please also ask them in the dataset's community discussions. We will also notify users via email when the latest usable version changes.
To host, share, or otherwise provide access to The Stack dataset, you must include these Terms of Use and require users to agree to it.
By accessing this dataset, you accept that your contact information (email address and username) can be shared with the dataset maintainers as well.
- Downloads last month
- 5