Skip to main content

Module linguist_data

Module linguist_data 

Source
Expand description

GitHub Linguist language data

Auto-generated from GitHub Linguist languages.yml Linguist commit: e51c2270 (2026-01-14)

The KNOWN_EXTENSIONS set is generated by the committed scripts/gen_linguist_extensions.py from the same pinned languages.yml. The alias maps predate that script; their generator was not committed, so regenerating them means rewriting it (and folding the manual additions below back in or bumping the pin past them).

Manual addition on top of the e51c2270 generation: py and py3 as aliases for Python in both ALIAS_TO_CANONICAL and CANONICAL_TO_ALIASES. Upstream added these in commit 6fc1cc65b3 (“Add py and py3 to Python aliases”, PR #7791, merged 2026-03-02), after the e51c2270 pin (2026-01-14), so a regeneration from that pinned commit alone would not include them.

Constants§

LINGUIST_DATE
Linguist commit date
LINGUIST_VERSION
Linguist commit hash this data was generated from

Statics§

ALIAS_TO_CANONICAL
Maps lowercase alias -> canonical language name
CANONICAL_TO_ALIASES
Maps canonical language name -> all valid aliases (for validation)
DEFAULT_ALIASES
Preferred default alias for common languages (curated for widespread usage)
KNOWN_EXTENSIONS
File extensions (lowercased, leading dot stripped) of every Linguist language. GitHub resolves fenced-code labels against names, aliases, AND extensions (```pytb highlights via Python traceback’s .pytb extension, with no such alias existing), so “is this label known” must consult this set. Extensions are deliberately NOT resolvable to a canonical language: many are ambiguous across languages (.pl is Perl and Prolog), so they participate in existence checks only, never in label rewriting.

Functions§

default_alias
Get the preferred default alias for a language
get_aliases
Get all valid aliases for a canonical language
is_known_language
Whether GitHub recognizes label as a fenced-code-block language: a language name, an alias, or a file extension. This is the accept-set for “unknown language” checks. It is intentionally broader than resolve_canonical, which answers the different question “which language is this” and must stay alias-only: extension labels like pytb are known (GitHub highlights them) but have no canonical resolution safe enough to rewrite or route on.
is_valid_alias
Check if an alias is valid for a canonical language
resolve_canonical
Resolve an alias to its canonical language name