gitee-code / README.md
nyuuzyou's picture
Super-squash branch 'main' using huggingface_hub
185b9eb verified
metadata
annotations_creators:
  - machine-generated
language_creators:
  - found
language:
  - code
  - zh
  - en
license: other
multilinguality:
  - multilingual
pretty_name: Gitee Code Dataset
size_categories:
  - 100M<n<1B
source_datasets:
  - original
task_categories:
  - text-generation
tags:
  - code
  - chinese
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/*.parquet
    default: true
dataset_info:
  features:
    - name: code
      dtype: string
    - name: repo_name
      dtype: string
    - name: path
      dtype: string
    - name: language
      dtype: string
    - name: license
      dtype: string
    - name: size
      dtype: int64

Gitee Code Dataset

Dataset Description

This dataset was compiled from code repositories hosted on Gitee, 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 (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
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;\n\nimport 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, 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.

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.