# code_search_net_python_permissive — CodeSearchNet Python (permissive only) Added: 2026-12-05. Release: `None` (working copy, not a release). ## What the data is Function-level Python source with its docstring, restricted to repositories whose audited licence is permissive. | | | |---|---| | Rows (functions) | **289,457** | | Repositories | **3,408** | | Characters (`text`) | **408,109,489** | | Tokens, tiktoken `cl100k_base` | **91,672,340** | | Parquet | **213,678,070 bytes** (zstd), 20 columns | | Splits | train 262,453 · validation 14,202 · test 12,802 | | Language | Python (code) + English (docstrings) | | Not OCR, not translated | yes | `text` = docstring + `\n\n` + code. `id` is `sha1(repo|path|func_name|sha256(code))[:24]` and is unique. `record_sha256` is the canonical SHA-256 of the row and ships in the parquet. ## Where it comes from - Upstream: [`code-search-net/code_search_net`](https://huggingface.co/datasets/code-search-net/code_search_net), `python` configuration. - No intermediary snapshot beyond the official HF dataset; no repository contents were scraped (only the GitHub licence API was queried). ## Composition Licences (rows), from a per-repo audit against the GitHub licence API (`/repos/{owner}/{repo}/license`, 2026-12-05): | SPDX | rows | % | |---|---:|---:| | MIT | 130,531 | 45.1% | | Apache-2.0 | 100,626 | 34.8% | | BSD-3-Clause | 43,179 | 14.9% | | BSD-2-Clause | 11,810 | 4.1% | | ISC | 2,223 | 0.8% | | WTFPL | 525 | 0.2% | | BSL-1.0 | 247 | 0.1% | | CC0-1.0 | 239 | 0.1% | | Zlib | 77 | 0.0% | Audit coverage: all 3,408 retained repositories carry a permissive SPDX licence; rows from repositories with no licence or a non-permissive licence were removed (86,655 unknown, 81,347 non-permissive). Largest repositories by rows: 1. `saltstack/salt` — 11,211 rows 2. `mitsei/dlkit` — 2,551 rows 3. `brocade/pynos` — 1,921 rows 4. `google/grr` — 1,903 rows 5. `tensorflow/tensor2tensor` — 1,766 rows 6. `pypa/pipenv` — 1,726 rows 7. `apple/turicreate` — 1,725 rows 8. `spyder-ide/spyder` — 1,686 rows 9. `bcbio/bcbio-nextgen` — 1,682 rows 10. `pandas-dev/pandas` — 1,633 rows Row length (`token_count`): min 25 · mean 316.7 · max 38051. Docstrings are non-empty for 289,457 / 289,457 rows. ## Schema ``` id, repo, path, func_name, url, split, language, docstring, code, text, token_count, doc_chars, code_chars, license_basis, source, added, record_sha256, license, license_class, license_source ``` ## Collection, normalization, filtering Committed scripts: `build_csn_go.py` (shards → records), `audit_licenses.py` (GitHub licence API), `join_go.py` (join + permissive filter), `finalize_go.py`, `make_datasheet.py`. - Code ≥ 20 chars; text ≥ 100 chars. - Exact-code SHA-256 dedup (global). - Keep only repositories with a detected permissive SPDX licence (`license_class == "permissive"`). - Audit cap: 4,517 repositories audited (87.1% of rows); 483 selected repositories (8,566 rows) were not audited before the rate-limit window closed and are dropped; the 8,590-repo long tail is excluded too. - No text rewriting beyond stripping; no PII scrubbing (see Not checked). ## Rights - Every retained row has an audited permissive SPDX licence in `license` and a `license_source` URL; `license_class == "permissive"`. - No copyleft (LGPL/EPL/GPL/AGPL) and no `NOASSERTION`/`unknown` rows. - Permissive is not obligation-free: Apache-2.0 requires NOTICE/attribution and preservation of notices; MIT/BSD require the copyright notice. The parquet carries `repo` and `url` for attribution but **does not bundle licence texts or NOTICE files**. - Repo-level licence is not file-level: a repository may vendor or generate files under other terms; GitHub reports the repository licence only. ## Why include it / uses A licence-clean, function-level Python corpus with docstrings for code LLM pretraining/SFT, code–documentation retrieval, and function-level generation or summarisation. Python is under-represented relative to Java/Python code corpora. ## Limitations - Function-level only: no package context, imports, or call graph. - Licence state is a 2026-12-05 GitHub snapshot; repos can relicense later. - Domain balance follows CodeSearchNet's collection (CLI/tooling-heavy, web/scripting/data code prominent). - Docstrings are upstream quality. ## Not checked - PII in code or docstrings (author names, emails, keys): **no scrubber was run; SlayerLab/NERGAL not applied**. - Whether GitHub's LICENSE-file detection matches actual terms. - Vendored/generated files inside repos that may carry other licences. - Cross-corpus dedup against other code corpora. - Preservation of Apache NOTICE / BSD-MIT copyright notices in downstream use. ## Reproduce ```bash python build_csn_go.py python audit_licenses.py python join_go.py python make_datasheet.py python finalize_go.py ```