--- license: other license_name: mixed-permissive license_link: LICENSE task_categories: - text-generation language: - en - gle tags: - code - gleam - programming-language - corpus - code-generation size_categories: - 10K50K chars) | 666 | Auto-generated schemas, lookup tables, data dumps | | Stub files (<20 chars) | 316 | Empty/placeholder files | | Unlicensed repos | 42,368 | No license and no Hex package | | Non-permissive licenses | 0 | GPL, AGPL removed | | Exercism repos | 840 | Same exercises solved repeatedly — low diversity | | Content deduplication | 2,642 | Identical code from different repos (kept highest-starred) | **69,413 raw files → 22,581 clean files** (67% reduction) ## Statistics ### Corpus - **22,581 files** from **1,528 repos** - **4.3M lines**, **121M characters** - Median file: 2,692 chars; Mean: 5,352 chars; Max: 49,945 chars ### License Distribution - MIT: 57% (13,068 files) - Apache-2.0: 40% (8,723 files) - Other permissive: 3% (MPL-2.0, BSD, ISC, Unlicense, 0BSD, CC0-1.0) ### Source Distribution - `src/` files: 48% - `test/` files: 24% - `examples/` files: 6% - Other: 22% ### Star Distribution | Stars | Files | % | |-------|-------|---| | 0 | 6,904 | 31% | | 1–4 | 6,842 | 30% | | 5–9 | 3,432 | 15% | | 10–49 | 3,602 | 16% | | 50–99 | 757 | 3.4% | | 100–999 | 918 | 4.1% | | 1000+ | 126 | 0.6% | ## Known Limitations - **`fork` field is unreliable**: GitHub search API doesn't consistently mark forks. All records show `fork=false`. Some near-duplicate fork content may be present (content dedup catches exact copies only). - **Near-duplicate forks**: Diverged forks (e.g., `Ivan-Vakhula07/lustre` vs `lustre-labs/lustre`) survived dedup because their files differ slightly. These are valid Gleam code and not harmful for training. - **Semi-generated content**: `dusty-phillips/monks_of_style` contributes 496 files (2.2%) of auto-generated CSS property wrappers from MDN documentation. Each file is valid Gleam but follows an identical template. - **Hex.pm enrichment incomplete**: Only 44% of files (10,015) have Hex package metadata. The rest are from repos not published on Hex. - **Collection snapshot**: Data was collected on 2026-05-28. Repositories may have changed since. ## Licensing This dataset aggregates code from many repositories, each with their own license. The `license` field in each record contains the normalized SPDX identifier. All included code is under permissive licenses: - MIT - Apache-2.0 - MPL-2.0 - BSD-3-Clause - BSD-2-Clause - ISC - Unlicense - 0BSD - CC0-1.0 The dataset card and curation scripts are released under the same license terms as the underlying code. See individual records for specific license attribution. ## How to Use ```python from datasets import load_dataset # Load full corpus ds = load_dataset("kasuboski/gleam-code-corpus", config="all") # Load only official Gleam repos ds = load_dataset("kasuboski/gleam-code-corpus", config="official") # Load community top (stars >= 10 or hex_downloads >= 1000) ds = load_dataset("kasuboski/gleam-code-corpus", config="community_top") # Access a record record = ds["train"][0] print(record["code"]) # the Gleam source code print(record["repo_url"]) # GitHub URL for attribution print(record["license"]) # SPDX license identifier ``` ## Acknowledgments - The [Gleam](https://gleam.run/) language team and community - [Hex.pm](https://hex.pm/) for package metadata - All the repository authors whose code is included in this corpus