File size: 3,724 Bytes
fcc5687
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de9234b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
license: other
license_name: per-file-license
license_link: LICENSE
task_categories:
  - text-generation
language:
  - en
tags:
  - astronomy
  - astrophysics
  - source-code
  - ascl
pretty_name: ASCL Astronomy Source Code
---

# ASCL Astronomy Source Code

The [Astrophysics Source Code Library](https://ascl.net) (ASCL) is a curated registry of
source code used in astronomy and astrophysics research. This dataset contains source files
extracted from ASCL-listed repositories, paired with catalog metadata.

## Dataset Structure

### Manifest (`manifest.parquet`)

One row per ASCL catalog entry with the following fields:

| Field | Description |
| --- | --- |
| `ascl_id` | ASCL identifier (e.g., `[ascl:2306.019]`) |
| `title` | Software title |
| `authors` | Author list |
| `description` | Abstract / description from ASCL |
| `detail_url` | ASCL detail page URL |
| `repo_url` | GitHub/GitLab/Bitbucket URL (if found) |
| `code_site` | Project homepage URL |
| `ads_url` | ADS bibcode URL |
| `license_type` | Detected license (e.g., MIT, GPL-3.0) |
| `license_file` | Path to license file in repo |

### Source Code (`code/*.parquet`)

Stack-style source files extracted from cloned repositories (one row per file):

| Field | Description |
| --- | --- |
| `ascl_id` | ASCL identifier |
| `repo_url` | Source repository URL |
| `file_path` | Relative path within repo |
| `content` | File text content |
| `language` | Detected programming language (from file extension) |
| `license_type` | License detected from the repository |
| `size` | File size in bytes |

## Data Collection Methodology

### Phase 1: Catalog Scrape

The ASCL catalog is scraped to extract metadata for each entry: title, authors, description,
repository URLs, and ADS bibcode links. Only entries with a repository URL on GitHub, GitLab,
or Bitbucket proceed to Phase 2.

### Phase 2: Code Extraction

Each repository is shallow-cloned (`--depth 1`), its license file is detected and classified
via regex pattern matching, and all recognised source files are extracted into Parquet batches.
Language detection uses file extension mapping (Python, C, C++, Fortran, Julia, R,
MATLAB/Octave, IDL, Java, Rust, Go, JavaScript, Shell, and others).

## Limitations

- **Repository coverage**: only repos hosted on GitHub, GitLab, or Bitbucket are included;
  code distributed via tarballs, personal websites, or other non-git hosting is skipped.
- **Shallow clones only**: only the latest commit is captured — no version history.
- **Language detection is extension-based**: file extensions are mapped to languages; there is
  no content-based language classification.
- **License detection is regex-based**: licenses are identified by pattern matching against
  common license file names and text; unusual or custom licenses may be misclassified or
  reported as `Unknown`.
- **No deduplication**: if multiple ASCL entries point to the same repository, its files may
  appear more than once.

## Licensing

This is a multi-license dataset. Each row carries a `license_type` field indicating the
license detected for that repository. Individual source files retain their original licenses
as set by their authors. Catalog metadata originates from [ASCL](https://ascl.net).

## Usage

```python
from datasets import load_dataset

# Load catalog metadata
ds_manifest = load_dataset("Smith42/ascl-code", data_files="manifest.parquet")

# Load source code files
ds_code = load_dataset("Smith42/ascl-code", data_files="code/*.parquet")

# Filter to a specific license
mit_code = ds_code["train"].filter(lambda x: x["license_type"] == "MIT")

# Filter to Python files
python_code = ds_code["train"].filter(lambda x: x["language"] == "Python")
```