Gitee Code Dataset
nyuuzyou

folder main (469 files)
filedata/gitee_0000.parquet 1.25GB
filedata/gitee_0001.parquet 1.22GB
filedata/gitee_0002.parquet 1.19GB
filedata/gitee_0003.parquet 1.25GB
filedata/gitee_0004.parquet 1.23GB
filedata/gitee_0005.parquet 1.25GB
filedata/gitee_0006.parquet 1.22GB
filedata/gitee_0007.parquet 1.24GB
filedata/gitee_0008.parquet 1.18GB
filedata/gitee_0009.parquet 1.21GB
filedata/gitee_0010.parquet 1.25GB
filedata/gitee_0011.parquet 1.24GB
filedata/gitee_0012.parquet 1.23GB
filedata/gitee_0013.parquet 1.18GB
filedata/gitee_0014.parquet 1.24GB
filedata/gitee_0015.parquet 1.24GB
filedata/gitee_0016.parquet 1.20GB
filedata/gitee_0017.parquet 1.23GB
filedata/gitee_0018.parquet 1.21GB
filedata/gitee_0019.parquet 1.23GB
filedata/gitee_0020.parquet 1.21GB
filedata/gitee_0021.parquet 1.25GB
filedata/gitee_0022.parquet 1.24GB
filedata/gitee_0023.parquet 1.20GB
filedata/gitee_0024.parquet 1.19GB
filedata/gitee_0025.parquet 1.22GB
filedata/gitee_0026.parquet 1.21GB
filedata/gitee_0027.parquet 1.21GB
filedata/gitee_0028.parquet 1.24GB
filedata/gitee_0029.parquet 1.25GB
filedata/gitee_0030.parquet 1.28GB
filedata/gitee_0031.parquet 1.21GB
filedata/gitee_0032.parquet 1.24GB
filedata/gitee_0033.parquet 1.22GB
filedata/gitee_0034.parquet 1.24GB
filedata/gitee_0035.parquet 1.24GB
filedata/gitee_0036.parquet 1.24GB
filedata/gitee_0037.parquet 1.25GB
filedata/gitee_0038.parquet 1.25GB
filedata/gitee_0039.parquet 1.15GB
filedata/gitee_0040.parquet 1.20GB
filedata/gitee_0041.parquet 1.23GB
filedata/gitee_0042.parquet 1.23GB
filedata/gitee_0043.parquet 1.25GB
filedata/gitee_0044.parquet 1.24GB
filedata/gitee_0045.parquet 1.23GB
filedata/gitee_0046.parquet 1.24GB
filedata/gitee_0047.parquet 1.23GB
filedata/gitee_0048.parquet 1.25GB
Too many files! Click here to view them all.
Type: Dataset
Tags:

Bibtex:
@article{,
title= {Gitee Code Dataset},
journal= {},
author= {nyuuzyou},
year= {},
url= {https://huggingface.co/datasets/nyuuzyou/gitee-code},
abstract= {# Gitee Code Dataset

## Dataset Description

This dataset was compiled from code repositories hosted on [Gitee](https://gitee.com), China's largest code hosting platform and a leading alternative to GitHub in the Chinese developer community. Gitee is widely used by Chinese developers, enterprises, and open-source projects, making this dataset particularly valuable for training code models with strong Chinese language understanding and Chinese coding conventions.

### Dataset Summary

| Statistic | Value |
|-----------|-------|
| **Total Files** | 819,472,785 |
| **Total Repositories** | 3,105,923 |
| **Total Size** | 536 GB (compressed Parquet) |
| **Programming Languages** | 554 |
| **File Format** | Parquet with Zstd compression (468 files) |

### Key Features

- **Large-scale Chinese code corpus**: Contains code from over 3 million repositories, many featuring Chinese comments, documentation, and variable names
- **Diverse language coverage**: Spans 554 programming languages identified by [go-enry](https://github.com/go-enry/go-enry) (based on GitHub Linguist rules)
- **Rich metadata**: Includes repository name, file path, detected language, license information, and file size
- **Enterprise and open-source projects**: Includes code from both individual developers and Chinese enterprises
- **Quality filtered**: Extensive filtering to remove vendor code, build artifacts, generated files, and low-quality content

### Languages

The dataset includes 554 programming languages. The top 30 languages by file count:

| Rank | Language | File Count |
|------|----------|------------|
| 1 | Java | 293,439,777 |
| 2 | JavaScript | 77,715,425 |
| 3 | C | 62,836,721 |
| 4 | C++ | 49,134,251 |
| 5 | HTML | 46,191,063 |
| 6 | Vue | 40,468,646 |
| 7 | PHP | 37,132,954 |
| 8 | C# | 33,842,369 |
| 9 | Python | 25,192,704 |
| 10 | CSS | 20,802,464 |
| 11 | TypeScript | 20,122,528 |
| 12 | Go | 16,176,561 |
| 13 | Shell | 8,371,429 |
| 14 | Makefile | 6,341,964 |
| 15 | Java Server Pages | 6,224,523 |
| 16 | TSX | 5,768,542 |
| 17 | CMake | 5,581,774 |
| 18 | SCSS | 5,291,031 |
| 19 | Objective-C | 4,922,736 |
| 20 | Less | 4,669,672 |
| 21 | Ruby | 3,027,385 |
| 22 | Kotlin | 2,986,211 |
| 23 | Scala | 2,869,640 |
| 24 | Rust | 2,466,122 |
| 25 | Starlark | 2,027,514 |
| 26 | Dart | 2,010,079 |
| 27 | Unix Assembly | 1,900,320 |
| 28 | Fluent | 1,882,380 |
| 29 | HTML+Razor | 1,863,914 |
| 30 | Swift | 1,607,477 |

### Licenses

The dataset includes files from repositories with various licenses. Repositories with restrictive licenses (CC-BY-ND variants, Commons Clause, SSPL) were excluded:

| License | File Count |
|---------|------------|
| apache-2.0 | 273,706,950 |
| mit | 201,880,040 |
| unknown | 195,868,240 |
| agpl-3.0 | 60,181,320 |
| bsd | 30,013,190 |
| gpl-2.0 | 27,831,530 |
| lgpl-3.0 | 11,746,750 |
| lgpl-2.1 | 4,807,600 |
| bsd-3-clause | 4,442,480 |
| cc0-1.0 | 3,144,920 |
| gpl-3.0 | 1,631,590 |
| unlicense | 1,181,930 |
| bsd-2-clause | 1,154,300 |
| epl-1.0 | 1,045,470 |
| Other licenses | ~5,800,000 |

## Dataset Structure

### Data Fields

| Field | Type | Description |
|-------|------|-------------|
| `code` | string | Content of the source file (UTF-8 encoded) |
| `repo_name` | string | Name of the Gitee repository (format: `username/repo`) |
| `path` | string | Path of the file within the repository (relative to repo root) |
| `language` | string | Programming language as identified by [go-enry](https://github.com/go-enry/go-enry) |
| `license` | string | License of the repository (SPDX identifier or "unknown") |
| `size` | int64 | Size of the source file in bytes |

### Data Format

- **Format**: Apache Parquet with Zstd compression
- **File Structure**: 468 files (`gitee_0000.parquet` to `gitee_0467.parquet`)

### Data Splits

All examples are in the train split. There is no validation or test split.

### Example Data Point

```
{
    'code': 'package com.example.demo;nnimport org.springframework.boot.SpringApplication;n...',
    'repo_name': 'username/spring-demo',
    'path': 'src/main/java/com/example/demo/Application.java',
    'language': 'Java',
    'license': 'apache-2.0',
    'size': 1234
}
```

## Dataset Creation

### Pipeline Overview

The dataset was created through a multi-stage pipeline:

1. **Repository Discovery**
2. **Branch Selection**: Selecting the main branch for each repository (priority: `master` > `main` > `develop` > `dev` > first branch)
3. **Repository Downloading**
4. **Content Extraction**: Extracting and filtering source code files
5. **Parquet Generation**: Writing filtered records to Parquet shards with Zstd compression

### Language Detection

Programming languages are detected using [go-enry](https://github.com/go-enry/go-enry), a Go port of GitHub's Linguist library. Only files classified as **Programming** or **Markup** language types are included (Data and Prose types are excluded).

### License Detection

Licenses are detected by:
1. Scanning for license files (`LICENSE`, `LICENSE.txt`, `LICENSE.md`, `COPYING`, etc.)
2. Matching license text against known patterns (MIT, Apache 2.0, GPL variants, BSD, Creative Commons, etc.)
3. Defaulting to "unknown" if no license can be detected

**Blocked Licenses**: The following restrictive licenses are excluded from the dataset:
- `cc-by-nd`, `cc-by-nd-2.0`, `cc-by-nd-3.0`, `cc-by-nd-4.0` (Creative Commons No-Derivatives)
- `commons-clause`
- `sspl`, `sspl-1.0` (Server Side Public License)

### File Filtering

Extensive filtering is applied to ensure data quality:

#### Size Limits
| Limit | Value |
|-------|-------|
| Max repository ZIP size | 48 MB |
| Max single file size | 1 MB |
| Max line length | 1,000 characters |

#### Excluded Directories
- **Configuration**: `.git/`, `.github/`, `.gitlab/`, `.vscode/`, `.idea/`, `.vs/`, `.settings/`, `.eclipse/`, `.project/`, `.metadata/`
- **Vendor/Dependencies**: `node_modules/`, `bower_components/`, `jspm_packages/`, `vendor/`, `third_party/`, `3rdparty/`, `external/`, `packages/`, `deps/`, `lib/vendor/`, `target/dependency/`, `Pods/`
- **Build Output**: `build/`, `dist/`, `out/`, `bin/`, `target/`, `release/`, `debug/`, `.next/`, `.nuxt/`, `_site/`, `_build/`, `__pycache__/`, `.pytest_cache/`, `cmake-build-*`, `.gradle/`, `.maven/`

#### Excluded Files
- **Lock Files**: `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `Gemfile.lock`, `Cargo.lock`, `poetry.lock`, `Pipfile.lock`, `composer.lock`, `go.sum`, `mix.lock`
- **Minified Files**: Any file containing `.min.` in the name
- **Binary Files**: `.exe`, `.dll`, `.so`, `.dylib`, `.a`, `.lib`, `.o`, `.obj`, `.jar`, `.war`, `.ear`, `.class`, `.pyc`, `.pyo`, `.wasm`, `.bin`, `.dat`, `.pdf`, `.doc`, `.docx`, `.xls`, `.xlsx`, `.ppt`, `.pptx`, `.zip`, `.tar`, `.gz`, `.bz2`, `.7z`, `.rar`, `.jpg`, `.jpeg`, `.png`, `.gif`, `.bmp`, `.ico`, `.svg`, `.mp3`, `.mp4`, `.avi`, `.mov`, `.wav`, `.flac`, `.ttf`, `.otf`, `.woff`, `.woff2`, `.eot`
- **System Files**: `.DS_Store`, `thumbs.db`

#### Content Filtering
- **UTF-8 Validation**: Files must be valid UTF-8 encoded text
- **Binary Detection**: Files detected as binary by go-enry are excluded
- **Generated Files**: Files with generation markers in the first 500 bytes are excluded:
  - `generated by`, `do not edit`, `auto-generated`, `autogenerated`, `automatically generated`, `code generator`, `generated code`, `this file is generated`, `@generated`, `<auto-generated`
- **Empty Files**: Files that are empty or contain only whitespace are excluded
- **Long Lines**: Files with any line exceeding 1,000 characters are excluded
- **go-enry Filters**: Additional filtering using go-enry's `IsVendor()`, `IsImage()`, `IsDotFile()`, `IsTest()`, and `IsGenerated()` functions
- **Documentation-only Repos**: Repositories containing only documentation files (no actual code) are skipped

### Source Data

All data originates from public repositories hosted on [Gitee](https://gitee.com).

## Considerations for Using the Data

### Personal and Sensitive Information

The dataset may contain:
- Email addresses in code comments or configuration files
- API keys or credentials that were accidentally committed
- Personal information in comments or documentation

Users should exercise caution and implement appropriate filtering when using this data.

### Licensing Information

This dataset is a collection of source code from repositories with various licenses. Any use of all or part of the code gathered in this dataset must abide by the terms of the original licenses, including attribution clauses when relevant. The license field in each data point indicates the license of the source repository.
},
keywords= {},
terms= {},
license= {},
superseded= {}
}


Send Feedback